You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.9 KiB
75 lines
2.9 KiB
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: Test
|
|
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/)
|
|
- name: Build amd64
|
|
env:
|
|
GOOS: linux
|
|
GOARCH: amd64
|
|
run: |
|
|
cd $PROJECT_PATH
|
|
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: Build arm64
|
|
env:
|
|
GOOS: linux
|
|
GOARCH: arm64
|
|
run: |
|
|
cd $PROJECT_PATH
|
|
go build -ldflags "-X main.goos=linux -X main.goarch=arm64" -o scrutiny-web-linux-arm64 -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
|
|
go build -ldflags "-X main.goos=linux -X main.goarch=arm64" -o scrutiny-collector-metrics-linux-arm64 -tags "static" collector/cmd/collector-metrics/collector-metrics.go
|
|
|
|
chmod +x scrutiny-web-linux-arm64
|
|
chmod +x scrutiny-collector-metrics-linux-arm64
|
|
|
|
- name: Build windows
|
|
env:
|
|
GOOS: windows
|
|
GOARCH: amd64
|
|
run: |
|
|
cd $PROJECT_PATH
|
|
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-web-windows-amd64.exe -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
|
|
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-collector-metrics-windows-amd64.exe -tags "static" collector/cmd/collector-metrics/collector-metrics.go
|
|
|
|
- name: Archive
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: binaries.zip
|
|
path: |
|
|
${{ env.PROJECT_PATH }}/scrutiny-web-linux-amd64
|
|
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-amd64
|
|
${{ env.PROJECT_PATH }}/scrutiny-web-linux-arm64
|
|
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-arm64
|
|
${{ env.PROJECT_PATH }}/scrutiny-web-windows-amd64.exe
|
|
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-windows-amd64.exe
|
|
- uses: codecov/codecov-action@v1
|
|
with:
|
|
file: ${{ env.PROJECT_PATH }}/coverage.txt
|
|
flags: unittests
|
|
fail_ci_if_error: true
|