name: CI # This workflow is triggered on pushes & pull requests on: [push, pull_request] jobs: build: name: Build runs-on: ubuntu-latest container: karalabe/xgo-1.13.x env: PROJECT_PATH: /go/src/github.com/analogj/scrutiny CGO_ENABLED: 1 steps: - name: Git run: | apt-get update && apt-get install -y software-properties-common add-apt-repository ppa:git-core/ppa && apt-get update && apt-get install -y git git --version - name: Checkout uses: actions/checkout@v2 - name: Test run: | mkdir -p $(dirname "$PROJECT_PATH") cp -a $GITHUB_WORKSPACE $PROJECT_PATH cd $PROJECT_PATH go mod vendor go test -race -coverprofile=coverage.txt -covermode=atomic -v -tags "static" $(go list ./... | grep -v /vendor/) - name: Build Binaries run: | cd $PROJECT_PATH make all - name: Archive uses: actions/upload-artifact@v2 with: name: binaries.zip path: | /build/scrutiny-web-linux-amd64 /build/scrutiny-collector-metrics-linux-amd64 /build/scrutiny-web-linux-arm64 /build/scrutiny-collector-metrics-linux-arm64 /build/scrutiny-web-linux-arm-5 /build/scrutiny-collector-metrics-linux-arm-5 /build/scrutiny-web-linux-arm-6 /build/scrutiny-collector-metrics-linux-arm-6 /build/scrutiny-web-linux-arm-7 /build/scrutiny-collector-metrics-linux-arm-7 /build/scrutiny-web-windows-4.0-amd64.exe /build/scrutiny-collector-metrics-windows-4.0-amd64.exe # /build/scrutiny-web-freebsd-amd64 # /build/scrutiny-collector-metrics-freebsd-amd64 - uses: codecov/codecov-action@v1 with: file: ${{ env.PROJECT_PATH }}/coverage.txt flags: unittests fail_ci_if_error: false buildfreebsd: name: Build FreeBSD runs-on: macos-latest env: PROJECT_PATH: /go/src/github.com/analogj/scrutiny GOPATH: /go GOOS: freebsd GOARCH: amd64 steps: - name: Checkout uses: actions/checkout@v2 - name: Build Binaries uses: vmactions/freebsd-vm@v0.1.3 with: envs: 'PROJECT_PATH GOPATH GOOS GOARCH' usesh: true #TODO: lock go version using https://www.jeremymorgan.com/tutorials/golang/how-to-install-go-freebsd/ prepare: pkg install -y curl go gmake run: | pwd ls -lah whoami freebsd-version mkdir -p $(dirname "$PROJECT_PATH") cp -R $GITHUB_WORKSPACE $PROJECT_PATH cd $PROJECT_PATH mkdir -p /build echo "building web binary (OS = ${GOOS}, ARCH = ${GOARCH})" go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o /build/scrutiny-web-${GOOS}-${GOARCH} -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go chmod +x "/build/scrutiny-web-${GOOS}-${GOARCH}" file "/build/scrutiny-web-${GOOS}-${GOARCH}" || true ldd "/build/scrutiny-web-${GOOS}-${GOARCH}" || true echo "building collector binary (OS = ${GOOS}, ARCH = ${GOARCH})" go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o /build/scrutiny-collector-metrics-${GOOS}-${GOARCH} -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go chmod +x "/build/scrutiny-collector-metrics-${GOOS}-${GOARCH}" file "/build/scrutiny-collector-metrics-${GOOS}-${GOARCH}" || true ldd "/build/scrutiny-collector-metrics-${GOOS}-${GOARCH}" || true