devops: add -coverpkg=./... to tests #7
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: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install system-level dependencies | |
run: | | |
# Install libpcsclite using apt package manager | |
sudo apt-get update | |
sudo apt-get install -y libpcsclite-dev | |
# Install other system-level dependencies if needed | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '>=1.21.3' # Use the Go version you require | |
- name: Run tests and generate coverage report | |
run: | | |
go test -coverpkg=./... -coverprofile=coverage.out ./... | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload code coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.out # Path to the coverage report generated earlier |