Skip to content

Commit

Permalink
add source code
Browse files Browse the repository at this point in the history
  • Loading branch information
iczc committed Jan 11, 2021
0 parents commit 1b8f6c7
Show file tree
Hide file tree
Showing 63 changed files with 4,727 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This is a basic workflow that is manually triggered

name: billboard

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on: [push, pull_request]

# This workflow makes x86_64 binaries for mac, windows, and linux.


jobs:
mac-windows:
runs-on: ubuntu-latest
strategy:
matrix:
targetos: [windows, darwin]
name: billboard for ${{ matrix.targetos }}
steps:
- uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v1
with:
go-version: 1.15
env:
GOOS: ${{ matrix.targetos }}

- name: Compile
run: |
cd cmd/billboardd
go build .
cd ..
cd billboardcli
go build .
# - uses: actions/upload-artifact@v2
# with:
# name: billboardcli ${{ matrix.targetos }}
# path: cmd/billboardcli/billboardcli
#
# - uses: actions/upload-artifact@v2
# with:
# name: billboardd ${{ matrix.targetos }}
# path: cmd/billboardd/billboardd

linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [arm64, riscv64, amd64]

name: billboard for ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v1
with:
go-version: 1.15
env:
GOARCH: ${{ matrix.arch }}

- name: Compile
run: |
cd cmd/billboardd
go build .
cd ..
cd billboardcli
go build .
# - uses: actions/upload-artifact@v2
# with:
# name: billboardcli ${{ matrix.arch }}
# path: cmd/billboardcli/billboardcli
#
# - uses: actions/upload-artifact@v2
# with:
# name: billboardd ${{ matrix.arch }}
# path: cmd/billboardd/billboardd
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
.idea
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Simple usage with a mounted data directory:
# > docker build -t billboard .
#
# > docker run -it -p 26657:26657 -v ~/.billboardd:/root/.billboardd billboard billboardd init testing
# > docker run -it -p 26657:26657 -v ~/.billboardd:/root/.billboardd billboard billboardd start
FROM golang:alpine AS build-env

# Install minimum necessary dependencies,
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN apk add --no-cache $PACKAGES

# Set working directory for the build
WORKDIR /go/src/github.com/iczc/billboard

# Add source files
COPY . .

# build billboard
RUN make install


# Final image
FROM alpine:edge

# Install ca-certificates
RUN apk add --update ca-certificates
WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/billboardd /usr/bin/billboardd
COPY --from=build-env /go/bin/billboardcli /usr/bin/billboardcli

# Run billboardd by default, omit entrypoint to ease using container with billboardcli
CMD ["billboardd"]
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PACKAGES=$(shell go list ./... | grep -v '/simulation')

VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=billboard \
-X github.com/cosmos/cosmos-sdk/version.ServerName=billboardd \
-X github.com/cosmos/cosmos-sdk/version.ClientName=billboardcli \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)

BUILD_FLAGS := -ldflags '$(ldflags)'

all: install

install: go.sum
@echo "--> Installing billboardd & billboardcli"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/billboardd
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/billboardcli

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify

test:
@go test -mod=readonly $(PACKAGES)
Loading

0 comments on commit 1b8f6c7

Please sign in to comment.