Prefixing the module names #67
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@v7 | |
| # 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 | |
| build-example: | |
| name: Build and run example app | |
| 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: ${{ env.GO_VERSION }} | |
| check-latest: true | |
| cache: true | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| go mod verify | |
| - name: Build example | |
| run: cd example && go build -v . | |
| - name: Test example executable | |
| run: | | |
| cd example | |
| # Run the example app in the background and give it 5 seconds to start | |
| ./$(basename $(pwd)) & | |
| APP_PID=$! | |
| sleep 5 | |
| # Check if process is still running (successful start) | |
| if ps -p $APP_PID > /dev/null; then | |
| echo "Example app started successfully" | |
| kill $APP_PID | |
| exit 0 | |
| else | |
| echo "Example app failed to start" | |
| exit 1 | |
| fi | |
| build-example-tenants: | |
| name: Build and run example tenants app | |
| 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: ${{ env.GO_VERSION }} | |
| check-latest: true | |
| cache: true | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| go mod verify | |
| - name: Build example | |
| run: cd example_tenants && go build -v . | |
| - name: Test example executable | |
| run: | | |
| cd example_tenants | |
| # Run the example app in the background and give it 5 seconds to start | |
| ./$(basename $(pwd)) & | |
| APP_PID=$! | |
| sleep 5 | |
| # Check if process is still running (successful start) | |
| if ps -p $APP_PID > /dev/null; then | |
| echo "Example tenants app started successfully" | |
| kill $APP_PID | |
| exit 0 | |
| else | |
| echo "Example tenants app failed to start" | |
| exit 1 | |
| fi |