Add stdout msgs to log object #275
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
# must be specified without patch version | |
version: v1.51 | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Check formatting | |
run: | | |
make format-check | |
vulnerability-check: | |
name: "Vulnerability check" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Scan for Vulnerabilities | |
uses: golang/govulncheck-action@v0.2.0 | |
with: | |
go-package: ./... | |
test: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- platform: ubuntu-latest | |
target: linux | |
- platform: windows-latest | |
target: windows | |
- platform: macos-latest | |
target: darwin | |
name: 'Test (${{ matrix.target }})' | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Install go-junit-report | |
run: go install github.com/jstemmer/go-junit-report/v2@latest | |
- name: Unit testing | |
run: | | |
mkdir -p build | |
go test -v ./... > build/cbuildtests-${{ matrix.target }}-amd64.txt | |
go-junit-report -set-exit-code -in build/cbuildtests-${{ matrix.target }}-amd64.txt -iocopy -out build/cbuild-testreport-${{ matrix.target }}-amd64.xml | |
- name: Install qemu (for Linux-Arm64) | |
if: ${{ startsWith(runner.os, 'Linux') }} | |
run: | | |
sudo apt update | |
sudo apt-get install -y \ | |
gcc-aarch64-linux-gnu \ | |
g++-aarch64-linux-gnu \ | |
qemu-user-binfmt | |
- name: Unit testing (for Linux-Arm64) | |
if: ${{ startsWith(runner.os, 'Linux') }} | |
run: | | |
GOOS=linux GOARCH=arm64 go test -v ./... > build/cbuildtests-${{ matrix.target }}-arm64.txt | |
go-junit-report -set-exit-code -in build/cbuildtests-${{ matrix.target }}-arm64.txt -iocopy -out build/cbuild-testreport-${{ matrix.target }}-arm64.xml | |
- name: Archive unit test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unit-test-result-${{ matrix.target }} | |
path: ./build/cbuild-testreport-*.xml | |
if-no-files-found: error | |
publish-test-results: | |
if: github.event_name != 'release' | |
name: "Publish Tests Results" | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "artifacts/**/cbuild-testreport-*.xml" | |
report_individual_runs: true | |
coverage: | |
if: github.event_name != 'release' | |
needs: [ test ] | |
name: 'Coverage check' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Check coverage | |
run: | | |
make coverage-check | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./build/cover.out | |
fail_ci_if_error: true | |
functionalities: fix |