|
|
|
name: CI
|
|
|
|
# This workflow is triggered on pushes to the repository.
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
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 -race -coverprofile=coverage.txt -covermode=atomic -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
|
|
|
|
- uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
file: ${{ env.PROJECT_PATH }}/coverage.txt
|
|
|
|
flags: unittests
|
|
|
|
fail_ci_if_error: true
|
|
|
|
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 -f docker/Dockerfile .
|
|
|
|
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
|