Update version to 0.10.2 for new release. #116
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: CLI Integration Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| schedule: | |
| # Run daily at 06:00 UTC | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: "Test mode: 'verify' to check against fixtures, 'record' to update fixtures" | |
| required: true | |
| default: "verify" | |
| type: choice | |
| options: | |
| - verify | |
| - record | |
| permissions: | |
| contents: read | |
| jobs: | |
| cli-verify: | |
| name: CLI integration tests (verify) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| small_mismatches: ${{ steps.check_results.outputs.small_mismatches }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| make requirements | |
| - name: Verify wikipedia-api command is available | |
| run: | | |
| uv run wikipedia-api --version | |
| - name: Verify CLI output against fixtures | |
| id: verify_step | |
| run: | | |
| uv run tests/cli/test_cli.sh verify | tee verify_output.txt || true | |
| - name: Check for small mismatches and failures | |
| id: check_results | |
| run: | | |
| MISMATCH_COUNT=$(grep 'Small Mismatch:' verify_output.txt | awk '{print $3}' || echo "0") | |
| FAILED_COUNT=$(grep 'Failed:' verify_output.txt | awk '{print $2}' || echo "0") | |
| echo "small_mismatches=$MISMATCH_COUNT" >> $GITHUB_OUTPUT | |
| echo "failed_count=$FAILED_COUNT" >> $GITHUB_OUTPUT | |
| - name: Fail job if there were test failures | |
| if: steps.check_results.outputs.failed_count > 0 | |
| run: | | |
| echo "Failing job due to test failures." | |
| exit 1 | |
| cli-record: | |
| name: CLI integration tests (record) | |
| needs: cli-verify | |
| if: > | |
| (github.event_name == 'workflow_dispatch' && inputs.mode == 'record') || | |
| (needs.cli-verify.outputs.small_mismatches > 1 && github.event_name != 'pull_request') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| make requirements | |
| - name: Verify wikipedia-api command is available | |
| run: | | |
| uv run wikipedia-api --version | |
| - name: Record CLI fixtures | |
| run: | | |
| uv run bash tests/cli/test_cli.sh record | |
| - name: Verify freshly recorded fixtures | |
| run: | | |
| uv run bash tests/cli/test_cli.sh verify | |
| - name: Commit updated fixtures | |
| id: commit | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add tests/cli/expected/ | |
| if git diff --cached --quiet; then | |
| echo "No fixture changes detected." | |
| else | |
| # Create new branch for fixture updates | |
| BRANCH_NAME="update-cli-fixtures-$(date +%Y%m%d-%H%M%S)" | |
| git checkout -b $BRANCH_NAME | |
| git commit -m "Update CLI test fixtures [automated]" | |
| git push origin $BRANCH_NAME | |
| echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.commit.outputs.branch_name | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh pr create \ | |
| --base master \ | |
| --head ${{ steps.commit.outputs.branch_name }} \ | |
| --title "Update CLI test fixtures [automated]" \ | |
| --body "This PR updates CLI test fixtures automatically. Please review and merge if the changes look correct." |