ci: capture serve test output with continue-on-error for annotations #90
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: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12"] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip setuptools wheel | |
| pip install -e ".[dev]" --no-build-isolation | |
| - name: Lint with ruff | |
| run: pip install ruff && ruff check src/ --target-version py310 | |
| - name: Run serve tests (capture output) | |
| id: serve_tests | |
| continue-on-error: true | |
| run: | | |
| python -m pytest tests/test_serve.py -v --tb=long > /tmp/serve-out.txt 2>&1 | |
| echo "pytest_exit=$?" >> $GITHUB_OUTPUT | |
| - name: Report serve test results | |
| if: always() | |
| run: | | |
| echo "=== SERVE TEST OUTPUT ===" | |
| cat /tmp/serve-out.txt || echo "No output file" | |
| echo "=== END ===" | |
| # Emit annotations for failures | |
| grep -E "^(FAILED|ERROR| )" /tmp/serve-out.txt | head -50 | while IFS= read -r line; do | |
| echo "::error file=tests/test_serve.py::$line" | |
| done || true | |
| - name: Fail if serve tests failed | |
| if: steps.serve_tests.outcome == 'failure' | |
| run: exit 1 | |
| - name: Check CLI works | |
| run: | | |
| rh-envault --help |