chore: improve GitHub Actions workflows #2
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Install Ginkgo CLI | |
| run: go install github.com/onsi/ginkgo/v2/ginkgo@latest | |
| - name: Run unit tests | |
| run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... | |
| - name: Run acceptance tests (Ginkgo) | |
| env: | |
| PIVNET_TOKEN: ${{ secrets.PIVNET_TOKEN }} | |
| # ENABLE_DOWNLOAD_TESTS: "1" # Uncomment to run all 12 tests (slower, downloads tiles) | |
| run: | | |
| go build -v ./cmd/tile-diff | |
| TILE_DIFF_BIN="$(pwd)/tile-diff" ginkgo -v ./test | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.txt | |
| flags: unittests | |
| fail_ci_if_error: false | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Build binary | |
| run: | | |
| go build -v -o bin/tile-diff ./cmd/tile-diff | |
| ./bin/tile-diff --version || echo "Version command not implemented yet" | |
| - name: Test binary runs | |
| run: | | |
| ./bin/tile-diff --help |