Skip to content

Commit

Permalink
ci: add upgrade-requirements ci job (uv pip compile) (#322)
Browse files Browse the repository at this point in the history
Fixes: #317
  • Loading branch information
afuetterer authored Apr 12, 2024
1 parent f2fc7bc commit ae31adc
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
key: docs-${{ hashFiles('pyproject.toml') }}
path: ~/.cache/pip
- name: Install pre-requisites (e.g. hatch)
run: python -m pip install --require-hashes --requirement=.github/workflows/requirements.txt
run: python -m pip install --require-hashes --requirement=.github/requirements/ci.txt
- run: hatch run docs:build
- run: hatch run docs:deploy
if: github.event_name == 'release'
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
python-version: '3.12'
- name: Install pre-requisites (e.g. hatch)
run: python -m pip install --require-hashes --requirement=.github/workflows/requirements.txt
run: python -m pip install --require-hashes --requirement=.github/requirements/ci.txt
- name: Update version and date in CITATION.cff
run: |
hatch run release:update-citation
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Checks

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review # this is needed to trigger checks, when an auto-generated "draft" PR is set for "ready for review".


concurrency:
group: pr-${{ github.head_ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: '3.12'
cache: pip
- name: Install pre-requisites (e.g. hatch)
run: python -m pip install --require-hashes --requirement=.github/workflows/requirements.txt
run: python -m pip install --require-hashes --requirement=.github/requirements/ci.txt
- run: python -m build --installer=uv
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install pre-requisites (e.g. hatch)
run: python -m pip install --require-hashes --requirement=.github/workflows/requirements.txt
run: python -m pip install --require-hashes --requirement=.github/requirements/ci.txt
- name: Run test suite
run: hatch run cov
- name: Generate coverage report
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- run: python -Ic 'import oaipmh_scythe.__about__; print(oaipmh_scythe.__about__.__version__)'
- name: Set up pipdeptree
if: matrix.os == 'ubuntu-latest'
run: python -m pip install --require-hashes --requirement=.github/workflows/requirements.txt
run: python -m pip install --require-hashes --requirement=.github/requirements/ci.txt
- name: Write info to step summary
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/upgrade-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This CI job is adapted from:
# build-and-inspect-python-package (2024-03-25), MIT license
# Ref: https://github.com/hynek/build-and-inspect-python-package/blob/v2.2.1/.github/workflows/update-dependencies.yml

name: Upgrade requirements

on:
schedule:
# run once a month at midnight of the first day of the month
- cron: 0 0 1 * *
# run manually from actions tab
workflow_dispatch:

permissions:
contents: read

jobs:
upgrade:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: Upgrade requirements
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Upgrade requirements
run: >
uv pip compile
--upgrade
--generate-hashes
--python-version=3.10
--output-file=.github/requirements/ci.txt
.github/requirements/ci.in
# Ref: https://github.com/peter-evans/create-pull-request
- uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: requirement-upgrades
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
title: 'build(deps-dev): upgrade ci requirements'
commit-message: 'build(deps-dev): upgrade ci requirements'
body: |
Monthly scheduled CI requirements upgrade (`uv pip compile --upgrade`).
> [!NOTE]
> Mark this PR as "ready for review" to trigger additional checks.
add-paths: .github/requirements/ci.txt
labels: |
type: build
deps: python
delete-branch: true
draft: true

0 comments on commit ae31adc

Please sign in to comment.