CI #37
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: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| # Daily monitor: re-verify every enumeration service still works live. | |
| - cron: "0 13 * * *" | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint & type-check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.4.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Install package + dev deps | |
| run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]" | |
| - name: Ruff lint | |
| run: ruff check . | |
| - name: Ruff format check | |
| run: ruff format --check quiet_riot tests | |
| - name: Mypy | |
| run: mypy quiet_riot | |
| unit: | |
| name: Unit tests (py${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.4.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package + dev deps | |
| run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]" | |
| - name: Unit tests (moto-mocked, no real AWS) | |
| run: pytest tests/unit | |
| live-aws: | |
| name: Live AWS + SaaS integration | |
| needs: [lint, unit] | |
| runs-on: ubuntu-latest | |
| # Skip live AWS for pull requests originating from forks (no OIDC trust). | |
| if: >- | |
| github.event_name != 'pull_request' || | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| AWS_REGION: us-east-1 | |
| QR_LIVE: "1" | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.4.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Install package + dev deps | |
| run: python -m pip install --upgrade pip && python -m pip install -e ".[dev]" | |
| - name: Configure AWS credentials (OIDC) | |
| uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | |
| with: | |
| role-to-assume: ${{ vars.AWS_IAM_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| role-session-name: QuietRiotCI-${{ github.run_id }} | |
| - name: Verify AWS identity | |
| run: aws sts get-caller-identity | |
| - name: Live integration tests (real ECR/SNS/S3 + M365/Google) | |
| env: | |
| # Known-real accounts for the SaaS detection canaries (masked in logs). | |
| QR_TEST_M365_EMAIL: ${{ secrets.QR_TEST_M365_EMAIL }} | |
| QR_TEST_M365_DOMAIN: ${{ secrets.QR_TEST_M365_DOMAIN }} | |
| QR_TEST_GOOGLE_EMAIL: ${{ secrets.QR_TEST_GOOGLE_EMAIL }} | |
| run: pytest tests/live --run-live |