Skip to content

feat: add WithBodyDecoder option for custom JSON body decoding #107

feat: add WithBodyDecoder option for custom JSON body decoding

feat: add WithBodyDecoder option for custom JSON body decoding #107

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
paths-ignore:
- 'docs/**'
workflow_dispatch:
inputs:
run_integration:
description: 'Run integration tests'
type: boolean
default: true
spec:
description: 'Specific spec to test (e.g., 3.0/misc/stripe.com.yml)'
type: string
required: false
max_concurrency:
description: 'Max concurrency for integration tests'
type: number
default: 5
jobs:
build-ci:
name: Build CI
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check branch is up to date with main
if: github.event_name == 'pull_request'
run: |
git fetch origin main
if ! git merge-base --is-ancestor origin/main HEAD; then
echo "❌ Branch is not up to date with main. Please rebase or merge main into your branch."
exit 1
fi
echo "✅ Branch is up to date with main"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.3"
cache: true
- name: Install gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Download Go modules
run: go mod download
- name: Run build-ci
run: make build-ci
timeout-minutes: 30
test-ci:
name: Test CI
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.3"
cache: true
- name: Download Go modules
run: go mod download
- name: Run generate and check for uncommitted changes
run: |
make generate
if ! git diff --exit-code; then
echo "ERROR: make generate produced uncommitted changes"
echo "Please run 'make generate' locally and commit the changes"
exit 1
fi
- name: Run test-ci
run: make test-ci
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 65
# Run on: merge_group (merge queue), push to main, or manual trigger with run_integration=true
if: github.event_name == 'merge_group' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.run_integration)
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.3"
cache: true
- name: Cache Go build cache
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: go-build-integration-${{ runner.os }}-${{ hashFiles('**/*.go', 'go.sum') }}
restore-keys: |
go-build-integration-${{ runner.os }}-
- name: Restore integration test cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: .integration-cache.json
key: integration-cache-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
integration-cache-${{ github.ref_name }}-
- name: Debug cache restore
run: |
echo "Cache hit: ${{ steps.cache-restore.outputs.cache-hit }}"
echo "Cache key: ${{ steps.cache-restore.outputs.cache-primary-key }}"
echo "Cache matched key: ${{ steps.cache-restore.outputs.cache-matched-key }}"
if [ -f .integration-cache.json ]; then
echo "Cache file exists, size: $(wc -c < .integration-cache.json) bytes"
echo "Entries: $(grep -c '"passed": true' .integration-cache.json || echo 0)"
else
echo "Cache file does not exist"
fi
- name: Download Go modules
run: go mod download
- name: Fetch specs
run: make fetch-specs
- name: Run integration tests
run: |
if [ -n "${{ inputs.spec }}" ]; then
make test-integration SPEC="${{ inputs.spec }}"
else
INTEGRATION_MAX_CONCURRENCY=${{ inputs.max_concurrency }} go test -v -tags=integration -count=1 -timeout=55m .
fi
timeout-minutes: 60
- name: Debug cache before save
if: always()
run: |
if [ -f .integration-cache.json ]; then
echo "Cache file exists, size: $(wc -c < .integration-cache.json) bytes"
echo "Entries: $(grep -c '"passed": true' .integration-cache.json || echo 0)"
else
echo "Cache file does not exist - nothing to save"
fi
- name: Save integration test cache
uses: actions/cache/save@v4
if: always()
with:
path: .integration-cache.json
key: integration-cache-${{ github.ref_name }}-${{ github.run_id }}-${{ github.run_attempt }}