Complete module review: Fix CI gaps, add examples, update documentation, and resolve example failures #275
Workflow file for this run
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 ] | |
| env: | |
| GO_VERSION: '^1.23.5' | |
| 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: ${{ env.GO_VERSION }} | |
| check-latest: true | |
| cache: true | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| go mod verify | |
| - name: Run tests with coverage | |
| run: | | |
| go test ./... -v | |
| go test -v -coverprofile=coverage.txt -covermode=atomic -json ./... >> report.json | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: GoCodeAlone/modular | |
| - name: CTRF Test Output | |
| run: | | |
| go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest | |
| cat report.json | go-ctrf-json-reporter -o report.ctrf.json | |
| if: always() | |
| # https://github.com/ctrf-io/github-test-reporter | |
| - name: Publish CTRF Test Summary Results | |
| run: npx github-actions-ctrf report.ctrf.json | |
| if: always() | |
| test-cli: | |
| name: Test CLI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| check-latest: true | |
| cache: true | |
| - name: Get dependencies | |
| run: | | |
| cd cmd/modcli | |
| go mod download | |
| go mod verify | |
| - name: Run CLI tests with coverage | |
| run: | | |
| cd cmd/modcli | |
| go test ./... -v -coverprofile=cli-coverage.txt -covermode=atomic -json >> cli-report.json | |
| - name: Upload CLI coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: GoCodeAlone/modular | |
| directory: cmd/modcli/ | |
| files: cli-coverage.txt | |
| flags: cli | |
| - name: CTRF Test Output for CLI | |
| run: | | |
| go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest | |
| cd cmd/modcli | |
| cat cli-report.json | go-ctrf-json-reporter -o cli-report.ctrf.json | |
| if: always() | |
| - name: Publish CLI CTRF Test Summary Results | |
| run: | | |
| cd cmd/modcli | |
| npx github-actions-ctrf cli-report.ctrf.json | |
| if: always() | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache-dependency-path: go.sum | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| # See: https://github.com/marketplace/actions/golangci-lint for configuration options | |
| with: | |
| # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | |
| version: latest | |
| only-new-issues: true | |
| args: -c .golangci.github.yml |