Add running tests on macos #118
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: Go tests | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go: [ '1.21', 'stable' ] | |
os: [ ubuntu-latest, macos-latest ] | |
name: Go ${{ matrix.go }} ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Install dependencies | |
run: | | |
if [ "$RUNNER_OS" = "Linux" ] | |
then | |
sudo apt-get update | |
sudo apt-get install -y fuse | |
fi | |
if [ "$RUNNER_OS" = "macOS" ] | |
then | |
brew install --cask macfuse | |
fi | |
- name: Build | |
run: | | |
which go | |
go build -v ./... | |
- name: Test | |
run: | | |
if [ "$RUNNER_OS" = "macOS" ] | |
then | |
sudo /Users/runner/hostedtoolcache/go/1.21.4/x64/bin/go test -timeout 1m `go list ./... | grep -v examples` -coverprofile=coverage.txt -covermode=atomic | |
else | |
go test -timeout 1m `go list ./... | grep -v examples` -coverprofile=coverage.txt -covermode=atomic | |
fi | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.txt | |
flags: unittests | |
name: codecov-umbrella |