Skip to content

Commit

Permalink
Update GitHub Actions settings from the template
Browse files Browse the repository at this point in the history
Use an environment variable for the default Python version with
which to run most actions. Add timeouts to jobs that were missing
them. Use the tox-uv plugin uniformly. Fix one place where merge
queues weren't handled correctly.
  • Loading branch information
rra committed Jul 5, 2024
1 parent b27a61f commit 47f41ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Python CI

env:
# Default Python version used for all jobs other than test, which uses a
# matrix of supported versions. Quote the version to avoid interpretation as
# a floating point number.
PYTHON_VERSION: "3.12"

"on":
merge_group: {}
pull_request: {}
Expand All @@ -17,24 +23,26 @@ name: Python CI
types: [published]

jobs:

lint:

runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4

- 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]

test:

runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
Expand All @@ -50,11 +58,12 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "py,typing"
tox-plugins: "tox-docker"
tox-plugins: "tox-docker tox-uv"

docs:

runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
Expand All @@ -69,6 +78,7 @@ jobs:
with:
python-version: "3.12"
tox-envs: "docs,docs-linkcheck"
tox-plugins: tox-uv

# Only attempt documentation uploads for tagged releases and pull
# requests from ticket branches in the same repository. This avoids
Expand All @@ -82,8 +92,9 @@ jobs:
username: ${{ secrets.LTD_USERNAME }}
password: ${{ secrets.LTD_PASSWORD }}
if: >
github.event_name != 'pull_request'
|| startsWith(github.head_ref, 'tickets/')
github.event_name != 'merge_group'
&& (github.event_name != 'pull_request'
|| startsWith(github.head_ref, 'tickets/'))
test-packaging:

Expand All @@ -100,7 +111,7 @@ jobs:
- name: Build and publish
uses: lsst-sqre/build-and-publish-to-pypi@v2
with:
python-version: "3.12"
python-version: ${{ env.PYTHON_VERSION }}
upload: false

pypi:
Expand All @@ -123,4 +134,4 @@ jobs:

- uses: lsst-sqre/build-and-publish-to-pypi@v2
with:
python-version: "3.12"
python-version: ${{ env.PYTHON_VERSION }}
15 changes: 12 additions & 3 deletions .github/workflows/periodic-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

name: Periodic CI

env:
# Default Python version used for all jobs other than test, which uses a
# matrix of supported versions. Quote the version to avoid interpretation as
# a floating point number.
PYTHON_VERSION: "3.12"

"on":
schedule:
- cron: "0 12 * * 1"
Expand All @@ -13,6 +19,7 @@ name: Periodic CI
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
Expand All @@ -28,7 +35,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
tox-envs: "lint,typing,py"
tox-plugins: "tox-docker"
tox-plugins: "tox-docker tox-uv"
use-cache: false

- name: Report status
Expand All @@ -43,6 +50,7 @@ jobs:

docs:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
Expand All @@ -53,8 +61,9 @@ jobs:
- name: Build docs in tox
uses: lsst-sqre/run-tox@v1
with:
python-version: "3.12"
python-version: ${{ env.PYTHON_VERSION }}
tox-envs: "docs,docs-linkcheck"
tox-plugins: tox-uv
use-cache: false

- name: Report status
Expand All @@ -80,7 +89,7 @@ jobs:
- name: Build and publish
uses: lsst-sqre/build-and-publish-to-pypi@v2
with:
python-version: "3.12"
python-version: ${{ env.PYTHON_VERSION }}
upload: false

- name: Report status
Expand Down

0 comments on commit 47f41ca

Please sign in to comment.