Skip to content

Update Makefile

Update Makefile #16

Workflow file for this run

name: Unit Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
cancel-in-progress: true
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
env:
# Using upload token helps against rate limiting errors.
# Cannot define it as secret as we need it accessible from forks.
# See https://github.com/codecov/codecov-action/issues/837
CODECOV_TOKEN: f457b710-93af-4191-8678-bcf51281f98c
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after a couple of runs
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.21.x
- name: Install tools
run: make install-ci
- name: Run unit tests
run: |
make test-ci
# After running tests, package test results into an artifact
mkdir test-results
mv cover.out test-results/
echo "test-results" >> .gitignore
echo "cover.out" >> .gitignore
echo "test-report.xml" >> .gitignore
echo "unittests" >> .gitignore
echo ".github/workflows" >> .gitignore
# Upload test results as an artifact
- name: Upload Test Results
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results
- name: Lint
run: make lint
publish-results:
runs-on: ubuntu-latest
needs: unit-tests
steps:
# Download test results from the artifact
- name: Download Test Results
uses: actions/download-artifact@v2
with:
name: test-results
path: test-results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.sha }}
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "test-results/cover.out"