Skip to content

Commit 217649e

Browse files
matrssReimarBauer
andauthored
CI and development environment overhaul (#2298)
* CI and development environment overhaul This removes the docker image logic from the CI setup and instead replaces it with a setup based on pixi. As part of that it moves the dependency specification from localbuild/meta.yaml to pixi.toml and pixi.lock. This turns the MSS repository into a single source of truth for both the application code as well as the development environment (whereas the latter was previously only specified in the docker images, and not reproducible in any way). Setting up a development environment is as simple as installing pixi and running `pixi shell` (or `pixi run <cmd>`, or `pixi install` to just create the environment, etc.). This environment will, by construction, be the same that is used in the CI as well (modulo platform differences). There is a new workflow that periodically (once a week on Monday) recreates the pixi lockfile and opens a PR for that update. The checks in that PR essentially serve as a replacement for the previous scheduled runs to ensure that no dependency update breaks MSS. Merging that PR is a manual step that can be done just as with any other PR and would then update the environment on the given target branch. This is essentially what was previously the triggering of a docker image creation. Including new dependencies can be done with `pixi add`, which will also automatically add the dependency to the (pre-existing) lockfile. This means dependency additions can be part of the PR that necessitate them and they won't affect the entire environment (as they previously did, where they would trigger a full image rebuild) but instead just add that new package to the existing specification. * fixup! CI and development environment overhaul * Update commands in development docs * fixup! CI and development environment overhaul --------- Co-authored-by: ReimarBauer <[email protected]>
1 parent c5f8561 commit 217649e

30 files changed

+16811
-609
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
* text=auto
2+
# GitHub syntax highlighting
3+
pixi.lock linguist-language=YAML
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
name: Build Gallery
22

33
on:
4-
pull_request:
4+
pull_request:
55

66
jobs:
77
Test-MSS-docs:
88
runs-on: ubuntu-latest
9-
10-
container:
11-
image: openmss/testing-develop
12-
139
steps:
1410
- uses: actions/checkout@v4
15-
11+
- uses: prefix-dev/[email protected]
12+
with:
13+
pixi-version: latest
14+
cache: true
15+
environments: dev
1616
- name: Create gallery
1717
timeout-minutes: 5
1818
run: |
1919
cd docs
20-
mamba run --no-capture-output -n mssenv python conf.py
20+
pixi run -e dev python conf.py

.github/workflows/lint.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,26 @@ jobs:
1818
timeout-minutes: 10
1919
steps:
2020
- uses: actions/checkout@v4
21-
- name: Set up Python 3
22-
uses: actions/setup-python@v5
21+
- uses: prefix-dev/[email protected]
2322
with:
24-
python-version: "3.x"
23+
pixi-version: latest
24+
cache: true
25+
environments: dev
2526
- name: Lint with codespell
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install codespell
29-
git ls-files -z | xargs -0 codespell --check-filenames
27+
run: git ls-files -z | xargs -0 pixi run -e dev codespell --check-filenames
3028

3129
flake8:
3230
runs-on: ubuntu-latest
3331
timeout-minutes: 10
3432
steps:
3533
- uses: actions/checkout@v4
36-
- name: Set up Python 3.10
37-
uses: actions/setup-python@v5
34+
- uses: prefix-dev/[email protected]
3835
with:
39-
python-version: "3.10"
36+
pixi-version: latest
37+
cache: true
38+
environments: dev
4039
- name: Lint with flake8
41-
run: |
42-
python -m pip install --upgrade pip
43-
pip install flake8 flake8-builtins
44-
git ls-files -z '**.py' | xargs -0 flake8
40+
run: git ls-files -z '**.py' | xargs -0 pixi run -e dev flake8
4541

4642
no-crlf-in-git:
4743
runs-on: ubuntu-latest

.github/workflows/testing-all-oses.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,11 @@ jobs:
2121
os: ["macos-13", "macos-14", "ubuntu-latest"]
2222
steps:
2323
- uses: actions/checkout@v4
24-
- name: Build requirements.txt file
25-
run: |
26-
sed -n '/^requirements:/,/^test:/p' localbuild/meta.yaml |
27-
sed -e "s/.*- //" |
28-
sed -e "s/menuinst.*//" |
29-
sed -e "s/.*://" > requirements.tmp.txt
30-
cat requirements.d/development.txt >> requirements.tmp.txt
31-
echo "pytest-randomly" >> requirements.tmp.txt
32-
sed -e '/^$/d' -e '/^#.*$/d' -e 's/\s*# \[not win\]$//' requirements.tmp.txt > requirements.txt
33-
rm requirements.tmp.txt
34-
cat requirements.txt
35-
- name: Get current year and calendar week
36-
id: year-and-week
37-
run: echo "year-and-week=$(date +%Y-%V)" >> "$GITHUB_OUTPUT"
38-
- uses: mamba-org/setup-micromamba@v2
24+
- uses: prefix-dev/[email protected]
3925
with:
40-
environment-file: requirements.txt
41-
environment-name: ci
42-
cache-environment: true
43-
# Set the cache key in a way that the cache is invalidated every week on monday
44-
cache-environment-key: environment-${{ steps.year-and-week.outputs.year-and-week }}
26+
pixi-version: latest
27+
cache: true
28+
environments: dev
4529
- name: Run tests
4630
timeout-minutes: 40
47-
run: micromamba run -n ci env QT_QPA_PLATFORM=offscreen pytest -v -n logical --durations=20 --cov=mslib tests
31+
run: pixi run -e dev env QT_QPA_PLATFORM=offscreen pytest -v -n logical --durations=20 --cov=mslib tests

.github/workflows/testing-develop.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/testing-gsoc.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/testing-scheduled.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/testing-stable.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/testing.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Update pixi lockfile
2+
3+
on:
4+
schedule:
5+
# At 04:00 on Monday
6+
- cron: "0 4 * * 1"
7+
# ...or manually
8+
workflow_dispatch:
9+
10+
jobs:
11+
pixi-update:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
base_branch: ["develop", "stable"]
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: ${{ matrix.base_branch }}
21+
- name: Generate new lockfile
22+
uses: prefix-dev/[email protected]
23+
with:
24+
pixi-version: latest
25+
run-install: false
26+
- name: Update pixi lockfile
27+
run: |
28+
set -o pipefail
29+
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
30+
- name: Create or update pull request
31+
uses: peter-evans/create-pull-request@v7
32+
with:
33+
token: ${{ secrets.PAT }}
34+
branch: automation/update-pixi-lockfile
35+
delete-branch: true
36+
add-paths: pixi.lock
37+
commit-message: Update pixi lockfile
38+
title: Update pixi lockfile
39+
body-path: diff.md

0 commit comments

Comments
 (0)