Skip to content

Commit 1af2a0f

Browse files
ytauschpavelzw
andauthored
ci: Add pixi update script + dependabot (#44)
Co-authored-by: Pavel Zwerschke <pavelzw@gmail.com>
1 parent e4f3148 commit 1af2a0f

File tree

8 files changed

+119
-9
lines changed

8 files changed

+119
-9
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
groups:
8+
gh-actions:
9+
patterns:
10+
- "*"

.github/scripts/check-deps.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
# Check that all dependencies in pixi.toml are also in pyproject.toml.
4+
# Note: If you add any dependencies which do have a different name on PyPI,
5+
# you need to adjust this script to address that.
6+
set -euo pipefail
7+
8+
contains_dependency_all=true
9+
10+
while read -r dependency; do
11+
contains_dependency=$(yq -r ".project.dependencies | map(. == \"${dependency}\") | any" pyproject.toml)
12+
if [[ $contains_dependency == "false" ]]; then
13+
echo "${dependency} not found in pyproject.toml"
14+
contains_dependency_all=false
15+
fi
16+
done < <(yq -r '.dependencies | to_entries | .[] | select(.key != "python") | "\(.key)\(.value)"' pixi.toml)
17+
18+
if [[ $contains_dependency_all == "false" ]]; then
19+
exit 1
20+
fi

.github/scripts/sync-deps.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
# Sync explicit dependencies from pixi.lock into requirements.txt
4+
# Note: If you add any dependencies which do have a different name on PyPI,
5+
# you need to adjust this script to address that.
6+
set -euo pipefail
7+
8+
echo "# this file is auto-generated, please make changes in pixi.toml instead" > requirements.txt
9+
pixi list -e default --explicit --json | jq -r '.[] | select(.name != "python") | "\(.name)==\(.version)"' >> requirements.txt

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,35 @@ jobs:
2121
echo "::error::The schema is out of date. Please run 'pixi run schema' and commit the changes."
2222
exit 1
2323
fi
24+
25+
check-requirements-txt:
26+
name: Check requirements.txt
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
- name: Set up pixi
31+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293 # v0.9.0
32+
with:
33+
run-install: false
34+
- name: Sync to requirements.txt
35+
run: ./.github/scripts/sync-deps.sh
36+
- name: Check for changes
37+
run: |
38+
git diff --exit-code
39+
if [ $? -eq 1 ]
40+
then
41+
echo "::error::The requirements.txt is out of date. Please run './.github/scripts/sync-deps.sh' and commit the changes."
42+
exit 1
43+
fi
44+
45+
check-deps:
46+
name: Check pixi.toml in sync with pyproject.toml
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
50+
- name: Set up pixi
51+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293 # v0.9.0
52+
with:
53+
run-install: false
54+
- name: Check Dependencies
55+
run: ./.github/scripts/check-deps.sh
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Update lockfiles
2+
permissions:
3+
contents: write
4+
pull-requests: write
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: 7 5 1 * * # each 1st at 05:07 UTC
10+
11+
jobs:
12+
pixi-update:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
- name: Set up pixi
17+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293 # v0.9.0
18+
with:
19+
run-install: false
20+
- name: Update lockfile
21+
run: |
22+
pixi update --json --no-install | pixi exec pixi-diff-to-markdown >> diff.md
23+
- name: Sync to requirements.txt
24+
run: ./.github/scripts/sync-deps.sh
25+
- name: Create pull request
26+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
commit-message: Update dependencies
30+
title: Update dependencies
31+
body-path: diff.md
32+
branch: update-pixi
33+
base: main
34+
labels: |
35+
pixi
36+
dependencies
37+
delete-branch: true
38+
add-paths: |
39+
pixi.lock
40+
requirements.txt

pixi.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ save-version-info = "python -m conda_metadata_app.version_info"
1414
postinstall-production = "pip install --no-deps --disable-pip-version-check dist/conda_metadata_app-*.whl"
1515

1616

17-
# please sync the dependencies with pyproject.toml and requirements.txt
1817
[dependencies]
1918
python = "3.12.*"
2019
pydantic-settings = ">=2.4.0,<3"

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ classifiers = [
1616
]
1717
requires-python = ">=3.12"
1818

19-
# please sync the dependencies with pixi.toml and requirements.txt
2019
dependencies = [
2120
"pydantic-settings>=2.4.0,<3",
2221
"pydantic>=2.8.2,<3",

requirements.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# please sync the dependencies with pyproject.toml and pixi.toml
2-
pydantic-settings==2.10.1
3-
pydantic==2.11.9
4-
typing-extensions==4.15.0
5-
zstandard==0.23.0
6-
py-rattler==0.7.2
1+
# this file is auto-generated, please make changes in pixi.toml instead
72
conda-forge-metadata==0.11.0
8-
conda-package-streaming==0.12.0
93
conda-oci-mirror==0.2.3
4+
conda-package-streaming==0.12.0
5+
pip==25.2
6+
py-rattler==0.7.2
7+
pydantic==2.11.9
8+
pydantic-settings==2.10.1
109
streamlit==1.49.1
1110
streamlit-searchbox==0.1.20
11+
typing-extensions==4.15.0
12+
zstandard==0.23.0

0 commit comments

Comments
 (0)