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.
86 lines
2.9 KiB
86 lines
2.9 KiB
name: CI
|
|
# This workflow is triggered on pushes & pull requests
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
container: techknowlogick/xgo:go-1.13.x
|
|
|
|
# Service containers to run with `build` (Required for end-to-end testing)
|
|
services:
|
|
influxdb:
|
|
image: influxdb:2.2
|
|
env:
|
|
DOCKER_INFLUXDB_INIT_MODE: setup
|
|
DOCKER_INFLUXDB_INIT_USERNAME: admin
|
|
DOCKER_INFLUXDB_INIT_PASSWORD: password12345
|
|
DOCKER_INFLUXDB_INIT_ORG: scrutiny
|
|
DOCKER_INFLUXDB_INIT_BUCKET: metrics
|
|
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: my-super-secret-auth-token
|
|
ports:
|
|
- 8086:8086
|
|
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: Generate coverage report
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
files: ${{ env.PROJECT_PATH }}/coverage.txt
|
|
flags: unittests
|
|
fail_ci_if_error: true
|
|
verbose: true
|
|
- 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-darwin-arm64
|
|
# /build/scrutiny-collector-metrics-darwin-arm64
|
|
# /build/scrutiny-web-darwin-amd64
|
|
# /build/scrutiny-collector-metrics-darwin-amd64
|
|
# /build/scrutiny-web-freebsd-amd64
|
|
# /build/scrutiny-collector-metrics-freebsd-amd64
|
|
- uses: codecov/codecov-action@v2
|
|
with:
|
|
file: ${{ env.PROJECT_PATH }}/coverage.txt
|
|
flags: unittests
|
|
fail_ci_if_error: false
|
|
|
|
|