Skip to content

Commit

Permalink
Update ci-unit-tests.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Harshvir Potpose <122517264+akagami-harsh@users.noreply.github.com>
  • Loading branch information
akagami-harsh committed Oct 20, 2023
1 parent 3e929a8 commit 25c7118
Showing 1 changed file with 35 additions and 18 deletions.
53 changes: 35 additions & 18 deletions .github/workflows/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,51 @@ jobs:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
egress-policy: audit # TODO: change to 'egress-policy: block' after a couple of runs

- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: actions/checkout@v2

- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
- 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

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "**/test-report.xml"

- name: Upload coverage to codecov
uses: codecov/codecov-action@894ff025c7b54547a9a2a1e9f228beae737ad3c2
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:
file: cover.out
verbose: true
flags: unittests
fail_ci_if_error: true
token: ${{ env.CODECOV_TOKEN }}
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"

0 comments on commit 25c7118

Please sign in to comment.