From 09fa9e3918fecf7dc1a1fcb0d87daa06d3ea0eae Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Fri, 12 Jul 2024 09:05:14 -0700 Subject: [PATCH] Update GitHub Actions configuration Update the GitHub Actions configuration to match the current fastapi_safir_app template (with some changes that are still pending review). Stop testing with a matrix of Python versions, since services need only support one version. Stop using neophile and instead run make update-deps directly. Use the new tox requirements file instead of manually listing plugins. Use an environment variable to hold the Python version so that it can be changed in fewer places. Fix the way errors from the periodic CI job are reported to avoid a discouraged GitHub Actions construction. --- .github/workflows/ci.yaml | 18 +++++++++------- .github/workflows/periodic-ci.yaml | 34 ++++++++++++++++++------------ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 576fb48..912e801 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,5 +1,12 @@ name: CI +env: + # Current supported Python version. For applications, there is generally no + # reason to support multiple Python versions, so all actions are run with + # this version. Quote the version to avoid interpretation as a floating + # point number. + PYTHON_VERSION: "3.12" + "on": merge_group: {} pull_request: {} @@ -28,7 +35,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: ${{ env.PYTHON_VERSION }} - name: Run pre-commit uses: pre-commit/action@v3.0.1 @@ -37,20 +44,15 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 - strategy: - matrix: - python: - - "3.12" - steps: - uses: actions/checkout@v4 - name: Run tox uses: lsst-sqre/run-tox@v1 with: - python-version: ${{ matrix.python }} + python-version: ${{ env.PYTHON_VERSION }} tox-envs: "py,coverage-report,typing" - tox-plugins: "tox-docker tox-uv" + tox-requirements: requirements/tox.txt build: runs-on: ubuntu-latest diff --git a/.github/workflows/periodic-ci.yaml b/.github/workflows/periodic-ci.yaml index 19accc0..9ed4b08 100644 --- a/.github/workflows/periodic-ci.yaml +++ b/.github/workflows/periodic-ci.yaml @@ -5,6 +5,13 @@ name: Periodic CI +env: + # Current supported Python version. For applications, there is generally no + # reason to support multiple Python versions, so all actions are run with + # this version. Quote the version to avoid interpretation as a floating + # point number. + PYTHON_VERSION: "3.12" + "on": schedule: - cron: "0 12 * * 1" @@ -15,33 +22,32 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 - strategy: - matrix: - python: - - "3.12" - steps: - uses: actions/checkout@v4 - # Use the oldest supported version of Python to update dependencies, - # not the matrixed Python version, since this accurately reflects - # how dependencies should later be updated. - - name: Run neophile - uses: lsst-sqre/run-neophile@v1 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: "3.12" - mode: update + python-version: ${{ env.PYTHON_VERSION }} + + - name: Update dependencies + run: | + pip install --upgrade uv + uv venv + source .venv/bin/activate + make update-deps + shell: bash - name: Run tests in tox uses: lsst-sqre/run-tox@v1 with: python-version: ${{ matrix.python }} tox-envs: "lint,typing,py" + tox-requirements: requirements/tox.txt use-cache: false - tox-plugins: "tox-docker tox-uv" - name: Report status - if: always() + if: failure() uses: ravsamhq/notify-slack-action@v2 with: status: ${{ job.status }}