Replace Twisted with aiohttp and native asyncio #225
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: | |
| pull_request: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-newsfile: | |
| name: Check PR has a changelog | |
| if: ${{ (github.base_ref == 'main' || contains(github.base_ref, 'release-')) && github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{github.event.pull_request.head.sha}} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - run: python -m pip install towncrier | |
| - run: "scripts-dev/check_newsfragment.sh ${{ github.event.number }}" | |
| checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Lint (ruff) | |
| run: uv run ruff check sydent/ tests/ integration-tests/ | |
| - name: Format (ruff) | |
| run: uv run ruff format --check sydent/ tests/ integration-tests/ | |
| - name: Restore/persist mypy's cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| .mypy_cache | |
| key: mypy-cache-${{ github.context.sha }} | |
| restore-keys: mypy-cache- | |
| - name: Typechecking (mypy) | |
| run: uv run mypy | |
| docker: | |
| # Sanity check that we can build the x64 image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| context: . | |
| push: false | |
| run-tests: | |
| name: Tests | |
| if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail | |
| needs: [check-newsfile, checks] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv run pytest tests/ | |
| # matrix_is_tester is a black-box integration test suite that launches | |
| # Sydent as a subprocess and makes HTTP requests against it. | |
| run-integration-tests: | |
| name: Integration Tests | |
| if: ${{ !cancelled() && !failure() }} | |
| needs: [check-newsfile, checks] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv run pytest --pyargs matrix_is_tester | |
| # a job which runs once all the other jobs are complete, thus allowing PRs to | |
| # be merged. | |
| tests-done: | |
| if: ${{ always() }} | |
| needs: | |
| - check-newsfile | |
| - checks | |
| - run-tests | |
| - run-integration-tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: matrix-org/done-action@v3 | |
| with: | |
| needs: ${{ toJSON(needs) }} | |
| # The newsfile lint may be skipped on non PR builds or on dependabot builds | |
| skippable: | |
| check-newsfile |