chore: refactor #21
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: Tests | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [main] | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-22.04 | |
name: Unit Tests | |
env: | |
TEST_COVERAGE_FILE: test-coverage.out | |
TEST_COVERAGE_HTML_FILE: test-coverage.html | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
- name: Run unit tests | |
run: go test -v -cover -coverprofile=${TEST_COVERAGE_FILE} ./... | |
- name: Convert test coverage to HTML | |
if: always() | |
continue-on-error: true | |
run: | | |
set -eu | |
if [ -f ${TEST_COVERAGE_FILE} ] | |
then | |
go tool cover -html=${TEST_COVERAGE_FILE} \ | |
-o=${TEST_COVERAGE_HTML_FILE} | |
fi | |
- name: Upload HTML test coverage | |
uses: actions/upload-artifact@v3 | |
if: always() | |
continue-on-error: true | |
with: | |
name: chisel-test-coverage.html | |
path: ./*.html | |
real-archive-tests: | |
# Do not change to newer releases as "fips" may not be available there. | |
runs-on: ubuntu-20.04 | |
name: Real Archive Tests | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
- name: Run real archive tests | |
run: | | |
go test ./internal/archive/ --real-archive |