From 225ae9e88efd1aac03ce8ccbefd4918ff88858ed Mon Sep 17 00:00:00 2001 From: Pete Cornish Date: Thu, 28 May 2026 19:24:56 +0100 Subject: [PATCH 1/2] ci: add downstream github action assurance gate Build the current-branch CLI and drive the official imposter-github-action against it, so breaking changes to CLI commands or arguments are caught before reaching downstream consumers. --- .github/workflows/downstream-action.yaml | 97 ++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/downstream-action.yaml diff --git a/.github/workflows/downstream-action.yaml b/.github/workflows/downstream-action.yaml new file mode 100644 index 0000000..2db1208 --- /dev/null +++ b/.github/workflows/downstream-action.yaml @@ -0,0 +1,97 @@ +name: Downstream GitHub Action + +# Assurance gate: exercises the official imposter-github-action against the +# CLI built from the current branch, so that breaking changes to CLI commands +# or arguments are caught before they reach downstream consumers. +# +# The action's `setup` step is deliberately skipped: it installs the released +# CLI from GitHub, which would mask the change under test. Instead we build the +# branch CLI and place it on PATH where the action expects to find `imposter`. + +on: + - push + - pull_request + +jobs: + github-action: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout CLI (current branch) + uses: actions/checkout@v6 + with: + path: cli + + - name: Checkout imposter-github-action + uses: actions/checkout@v6 + with: + repository: imposter-project/imposter-github-action + ref: main + path: imposter-github-action + + - name: Setup Go + uses: actions/setup-go@v6 + with: + go-version: '1.25.0' + + - name: Build branch CLI and place on PATH + working-directory: cli + run: | + make build + # Same install location the action's setup step uses. + cp ./imposter /usr/local/bin/imposter + echo "Installed CLI under test:" + imposter version + + - name: Create test mock config + run: | + mkdir -p mocks + # Pin the engine version so the gate fails on CLI changes, not on a + # new engine release. + cat > mocks/.imposter.yaml << 'EOF' + version: "4.5.4" + EOF + cat > mocks/imposter-config.yaml << 'EOF' + plugin: rest + resources: + - path: /test + response: + statusCode: 200 + content: Hello from Imposter + EOF + + - name: Start mocks (downstream action) + id: start-mocks + uses: ./imposter-github-action/start-mocks + with: + port: '8080' + config-dir: './mocks' + engine-type: 'docker' + + - name: Assert mock responds + run: | + base="${{ steps.start-mocks.outputs.base-url }}" + code=$(curl -s -o /dev/null -w "%{http_code}" "$base/test") + if [ "$code" != "200" ]; then + echo "Expected status 200 but got $code" + exit 1 + fi + body=$(curl -s "$base/test") + if [ "$body" != "Hello from Imposter" ]; then + echo "Expected 'Hello from Imposter' but got '$body'" + exit 1 + fi + echo "Mock responded correctly" + + - name: Stop mocks (downstream action) + uses: ./imposter-github-action/stop-mocks + with: + engine-type: 'docker' + + - name: Assert server stopped + run: | + if curl -s --max-time 5 "${{ steps.start-mocks.outputs.base-url }}/system/status"; then + echo "Mock server is still running" + exit 1 + fi + echo "Mock server stopped" From eec1fbe4a0e7964e8609bd65dc2c8b30e2eb0270 Mon Sep 17 00:00:00 2001 From: Pete Cornish Date: Thu, 28 May 2026 20:06:26 +0100 Subject: [PATCH 2/2] ci: silence deprecation and cache warnings in downstream gate Drop the now-deprecated engine-type input from the stop-mocks step, and point setup-go's build cache at the CLI checkout under cli/. --- .github/workflows/downstream-action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/downstream-action.yaml b/.github/workflows/downstream-action.yaml index 2db1208..c9aa44e 100644 --- a/.github/workflows/downstream-action.yaml +++ b/.github/workflows/downstream-action.yaml @@ -33,6 +33,8 @@ jobs: uses: actions/setup-go@v6 with: go-version: '1.25.0' + # CLI is checked out under cli/, so point the build cache there. + cache-dependency-path: cli/go.sum - name: Build branch CLI and place on PATH working-directory: cli @@ -85,8 +87,6 @@ jobs: - name: Stop mocks (downstream action) uses: ./imposter-github-action/stop-mocks - with: - engine-type: 'docker' - name: Assert server stopped run: |