diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml index f4c4741..76cc5d7 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/go-ci.yml @@ -7,13 +7,12 @@ on: branches: [main] jobs: - detect-go-ci-changes: + verify-and-build: runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.filter.outputs.should_run }} steps: - name: Checkout repo uses: actions/checkout@v4 + - name: Detect Go CI-impacting changes id: filter uses: dorny/paths-filter@v3 @@ -26,61 +25,28 @@ jobs: - 'vendor/**' - '.github/workflows/go-ci.yml' - verify-and-build: - needs: detect-go-ci-changes - if: ${{ needs.detect-go-ci-changes.outputs.should_run == 'true' }} - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - name: Set up Go + if: steps.filter.outputs.should_run == 'true' uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - name: Download dependencies + if: steps.filter.outputs.should_run == 'true' run: go mod download - name: Verify dependencies are synced + if: steps.filter.outputs.should_run == 'true' run: | go mod tidy go mod vendor git diff --exit-code -- go.mod go.sum - name: Build all packages + if: steps.filter.outputs.should_run == 'true' run: go build ./... - name: Run unit tests + if: steps.filter.outputs.should_run == 'true' run: go test ./... - - go-ci-skipped: - needs: detect-go-ci-changes - if: ${{ needs.detect-go-ci-changes.outputs.should_run != 'true' }} - runs-on: ubuntu-latest - steps: - - name: Go CI skipped by path filter - run: echo "No Go CI-impacting files changed. Skipping build and unit tests." - - golang-validation-pipeline-status: - needs: [detect-go-ci-changes, verify-and-build, go-ci-skipped] - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Check Go CI outcome - run: | - if [[ "${{ needs.detect-go-ci-changes.outputs.should_run }}" == "true" ]]; then - if [[ "${{ needs.verify-and-build.result }}" != "success" ]]; then - echo "Go validation was required and did not pass." - exit 1 - fi - echo "Go validation passed." - else - if [[ "${{ needs.go-ci-skipped.result }}" != "success" ]]; then - echo "Go CI skip marker job failed." - exit 1 - fi - echo "Go validation intentionally skipped." - fi diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 2679523..e7ef307 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -7,13 +7,15 @@ on: branches: [main] jobs: - detect-integration-changes: + integration: runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.filter.outputs.should_run }} + timeout-minutes: 30 + env: + INTEGRATION_READY_TIMEOUT: 120s steps: - name: Checkout repo uses: actions/checkout@v4 + - name: Detect integration-impacting changes id: filter uses: dorny/paths-filter@v3 @@ -30,58 +32,17 @@ jobs: - 'Makefile' - '.github/workflows/integration.yml' - integration: - needs: detect-integration-changes - if: ${{ needs.detect-integration-changes.outputs.should_run == 'true' }} - runs-on: ubuntu-latest - timeout-minutes: 30 - env: - # Compose can be slow on runners (Kafka + topic init + server build) - INTEGRATION_READY_TIMEOUT: 120s - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - name: Set up Go + if: steps.filter.outputs.should_run == 'true' uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - # make integration = docker compose up + go test -tags=integration (see testing/Makefile) - name: Run integration tests + if: steps.filter.outputs.should_run == 'true' run: make integration - name: Tear down Compose - if: always() + if: always() && steps.filter.outputs.should_run == 'true' run: make teardown-integration - - integration-skipped: - needs: detect-integration-changes - if: ${{ needs.detect-integration-changes.outputs.should_run != 'true' }} - runs-on: ubuntu-latest - steps: - - name: Integration skipped by path filter - run: echo "No integration-impacting files changed. Skipping integration tests." - - integration-pipeline-status: - needs: [detect-integration-changes, integration, integration-skipped] - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Check integration outcome - run: | - if [[ "${{ needs.detect-integration-changes.outputs.should_run }}" == "true" ]]; then - if [[ "${{ needs.integration.result }}" != "success" ]]; then - echo "Integration tests were required and did not pass." - exit 1 - fi - echo "Integration tests passed." - else - if [[ "${{ needs.integration-skipped.result }}" != "success" ]]; then - echo "Integration skip marker job failed." - exit 1 - fi - echo "Integration tests intentionally skipped." - fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5145fa5..e26e4c0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,13 +7,11 @@ on: branches: [ "main", "master" ] jobs: - detect-lint-changes: + lint-code: runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.filter.outputs.should_run }} steps: - - name: Checkout repo - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - name: Detect lint-impacting changes id: filter uses: dorny/paths-filter@v3 @@ -29,51 +27,16 @@ jobs: - '.golangci.toml' - '.golangci.json' - lint: - name: lint-code - needs: detect-lint-changes - if: ${{ needs.detect-lint-changes.outputs.should_run == 'true' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Go + if: steps.filter.outputs.should_run == 'true' uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - cache: false # golangci-lint-action handles its own caching + cache: false - name: golangci-lint + if: steps.filter.outputs.should_run == 'true' uses: golangci/golangci-lint-action@v7 with: version: v2.11.4 args: --timeout=5m - - lint-skipped: - needs: detect-lint-changes - if: ${{ needs.detect-lint-changes.outputs.should_run != 'true' }} - runs-on: ubuntu-latest - steps: - - name: Lint skipped by path filter - run: echo "No lint-impacting files changed. Skipping golangci-lint." - - lint-pipeline-status: - needs: [detect-lint-changes, lint, lint-skipped] - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Check lint outcome - run: | - if [[ "${{ needs.detect-lint-changes.outputs.should_run }}" == "true" ]]; then - if [[ "${{ needs.lint.result }}" != "success" ]]; then - echo "Lint was required and did not pass." - exit 1 - fi - echo "Lint passed." - else - if [[ "${{ needs.lint-skipped.result }}" != "success" ]]; then - echo "Lint skip marker job failed." - exit 1 - fi - echo "Lint intentionally skipped." - fi