Merge pull request #49 from valentin-kaiser/service #200
This file contains hidden or 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: ["*"] | |
| pull_request: | |
| branches: [main, master] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test on Linux | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.24.x | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Run tests | |
| run: | | |
| # Exclude machine package on Linux as it requires hardware access not available in CI | |
| packages=$(go list ./... | grep -v '/machine$') | |
| go test -race -coverprofile=coverage.out -covermode=atomic $packages | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Run go fmt check | |
| run: | | |
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
| echo "The following files are not formatted correctly:" | |
| gofmt -s -l . | |
| exit 1 | |
| fi | |
| test-windows: | |
| name: Test on Windows | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.24.x | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: | | |
| # Exclude machine package on Windows as it requires hardware access not available in CI | |
| $packages = go list ./... | Where-Object { $_ -notmatch '/machine$' } | |
| go test -v $packages | |
| test-macos: | |
| name: Test on macOS | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.24.x | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: | | |
| # Exclude machine package on macOS as it requires hardware access not available in CI | |
| packages=$(go list ./... | grep -v '/machine$') | |
| go test -v $packages |