diff --git a/.github/workflows/compose-smoke-test.yml b/.github/workflows/compose-smoke-test.yml new file mode 100644 index 0000000..94c9eda --- /dev/null +++ b/.github/workflows/compose-smoke-test.yml @@ -0,0 +1,47 @@ +name: Compose Smoke Test + +# Longer activity: actually brings each example's stack up and confirms +# every service reaches "running"/healthy state, then tears it down. +# Manual trigger only (workflow_dispatch) - not wired to push/pull_request, +# since standard runners may be undersized for the heavier examples +# (datastax, kafka-confluent) and image pulls make this slow. + +on: + workflow_dispatch: + +jobs: + discover: + runs-on: ubuntu-latest + outputs: + examples: ${{ steps.find.outputs.examples }} + steps: + - uses: actions/checkout@v5 + - id: find + run: | + examples=$(find . -maxdepth 2 -name docker-compose.yml -printf '%h\n' \ + | sed 's|^\./||' | sort | jq -R -s -c 'split("\n")[:-1]') + echo "examples=$examples" >> "$GITHUB_OUTPUT" + + smoke-test: + needs: discover + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + example: ${{ fromJson(needs.discover.outputs.examples) }} + steps: + - uses: actions/checkout@v5 + - name: Seed .env from template if present + run: | + if [ -f "${{ matrix.example }}/.env.template" ]; then + cp "${{ matrix.example }}/.env.template" "${{ matrix.example }}/.env" + fi + - name: Start stack and wait for services to be healthy/running + run: docker compose -f "${{ matrix.example }}/docker-compose.yml" up -d --wait --wait-timeout 120 + - name: Show container status + if: always() + run: docker compose -f "${{ matrix.example }}/docker-compose.yml" ps -a + - name: Tear down + if: always() + run: docker compose -f "${{ matrix.example }}/docker-compose.yml" down -v diff --git a/.github/workflows/compose-validate.yml b/.github/workflows/compose-validate.yml new file mode 100644 index 0000000..fa814a1 --- /dev/null +++ b/.github/workflows/compose-validate.yml @@ -0,0 +1,40 @@ +name: Compose Validate + +# Fast pass: confirms every example's docker-compose.yml parses and +# resolves (services, networks, volumes, env interpolation) without +# pulling images or starting any containers. + +on: + push: + branches: [main] + pull_request: + +jobs: + discover: + runs-on: ubuntu-latest + outputs: + examples: ${{ steps.find.outputs.examples }} + steps: + - uses: actions/checkout@v5 + - id: find + run: | + examples=$(find . -maxdepth 2 -name docker-compose.yml -printf '%h\n' \ + | sed 's|^\./||' | sort | jq -R -s -c 'split("\n")[:-1]') + echo "examples=$examples" >> "$GITHUB_OUTPUT" + + validate: + needs: discover + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + example: ${{ fromJson(needs.discover.outputs.examples) }} + steps: + - uses: actions/checkout@v5 + - name: Seed .env from template if present + run: | + if [ -f "${{ matrix.example }}/.env.template" ]; then + cp "${{ matrix.example }}/.env.template" "${{ matrix.example }}/.env" + fi + - name: Validate compose construction + run: docker compose -f "${{ matrix.example }}/docker-compose.yml" config --quiet