Skip to content

Commit

Permalink
Update GitHub Actions configuration
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rra committed Jul 12, 2024
1 parent 31611b3 commit 5bd5f77
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
Expand Down Expand Up @@ -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/[email protected]
Expand All @@ -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
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/periodic-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 }}
Expand Down

0 comments on commit 5bd5f77

Please sign in to comment.