name: CI # This workflow is triggered on pushes to the repository. on: [push, pull_request] jobs: build: name: Build runs-on: ubuntu-latest container: golang:1.13 env: PROJECT_PATH: /go/src/github.com/analogj/scrutiny steps: - name: Checkout uses: actions/checkout@v2 - name: Build env: GOOS: linux GOARCH: amd64 run: | mkdir -p $PROJECT_PATH cp -a $GITHUB_WORKSPACE/* $PROJECT_PATH/ cd $PROJECT_PATH go mod vendor go test -v -tags "static" $(go list ./... | grep -v /vendor/) go build -ldflags "-X main.goos=linux -X main.goarch=amd64" -o scrutiny-web-linux-amd64 -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go go build -ldflags "-X main.goos=linux -X main.goarch=amd64" -o scrutiny-collector-metrics-linux-amd64 -tags "static" collector/cmd/collector-metrics/collector-metrics.go chmod +x scrutiny-web-linux-amd64 chmod +x scrutiny-collector-metrics-linux-amd64 - name: Archive uses: actions/upload-artifact@v2 with: name: binaries path: | ${{ env.PROJECT_PATH }}/scrutiny-web-linux-amd64 ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-amd64 build-docker: name: Build Docker runs-on: ubuntu-latest container: docker:19.03.2 steps: - name: Checkout uses: actions/checkout@v2 - name: Build Docker run: | docker build -t analogj/scrutiny . docker save -o docker-analogj-scrutiny-latest.tar analogj/scrutiny:latest - name: Archive Docker uses: actions/upload-artifact@v2 with: name: docker path: docker-analogj-scrutiny-latest.tar