Skip to content

Commit a3c2999

Browse files
authored
Modernize development infraestructure (#925)
* Progress towards more modern repo * Start migration to pixi based dev * Use all 3 python versions * Run all tests, upload pixi.lock for caching * Update pixi.lock * Compare sets instead of lists * Finalize CI file, which is now called ci.yml * Update more workflows * Compare sets instead of lists * Final touches * Remove pixi.lock
1 parent d1115a9 commit a3c2999

40 files changed

+517
-974
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Run CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "bambi/**"
9+
- "tests/**"
10+
pull_request:
11+
types: [opened, synchronize, reopened, ready_for_review]
12+
paths:
13+
- "bambi/**"
14+
- "tests/**"
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
pixi-env: ["py311", "py312", "py313"]
22+
23+
name: CI on ${{ matrix.pixi-env }}
24+
steps:
25+
- name: Checkout source
26+
uses: actions/checkout@v5
27+
with:
28+
fetch-depth: 0
29+
30+
- uses: prefix-dev/[email protected]
31+
with:
32+
pixi-version: v0.48.0
33+
environments: ${{ matrix.pixi-env }}
34+
35+
- name: Run pre-commit checks
36+
run: pixi run -e ${{ matrix.pixi-env }} pre-commit run --all
37+
38+
- name: Run pylint
39+
run: pixi run -e ${{ matrix.pixi-env }} pylint bambi
40+
41+
- name: Run tests with Coverage
42+
run: pixi run -e ${{ matrix.pixi-env }} pytest -vv --cov=bambi --cov-report=term --cov-report=xml tests
43+
44+
- name: Check Coverage Report
45+
run: pixi run -e ${{ matrix.pixi-env }} coverage report -m
46+
47+
- name: Upload coverage to Codecov
48+
uses: codecov/codecov-action@v2
49+
with:
50+
env_vars: OS,PYTHON
51+
name: codecov-umbrella
52+
fail_ci_if_error: false

.github/workflows/post-release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ jobs:
99
name: Update changelog
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
with:
1414
ref: main
15+
fetch-depth: 0
16+
1517
- uses: rhysd/changelog-from-release/action@v3
1618
with:
1719
file: CHANGELOG.md
1820
github_token: ${{ secrets.GITHUB_TOKEN }}
19-
commit_summary_template: 'update changelog for %s changes'
21+
commit_summary_template: 'update changelog for %s changes'

.github/workflows/publish-docs.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,51 @@ on:
1111
- synchronize
1212

1313
jobs:
14-
build:
14+
build-dics:
15+
if: github.repository == 'bambinos/bambi'
1516
runs-on: ubuntu-latest
1617
strategy:
1718
fail-fast: false
1819
steps:
1920
- name: Checkout source
20-
uses: actions/checkout@v2
21+
uses: actions/checkout@v5
2122
with:
2223
fetch-depth: 0
2324

2425
- name: Set up Python
25-
uses: actions/setup-python@v3
26+
uses: actions/setup-python@v6
2627
with:
2728
python-version: "3.13"
2829

29-
- name: Install quartodoc and griffe
30-
run: |
31-
python -m pip install --upgrade pip
32-
python -m pip install quartodoc==0.11.1
30+
- name: Install quartodoc
31+
run: python -m pip install quartodoc==0.11.1
3332

3433
- name: Set up Quarto
3534
uses: quarto-dev/quarto-actions/setup@v2
3635
with:
3736
version: 1.7.32 # since this is my local version, we could change it
3837

39-
- name: Build docs
38+
- name: Build documentation
4039
shell: bash
4140
run: |
4241
python -m quartodoc build --config docs/_quarto.yml
4342
quarto render docs
4443
touch docs/_site/.nojekyll
4544
4645
- name: Publish to GitHub
47-
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') # Only from main or a tag
46+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
4847
uses: quarto-dev/quarto-actions/publish@v2
4948
with:
5049
target: gh-pages
5150
render: false
5251
path: docs/_site
5352

5453
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
56+
57+
# NOTES
58+
# 1. The job runs only in the bambinos/bambi repository. It does not make sense to do it elsewhere.
59+
# 2. The rendered webpage is published ONLY when the job was triggered by:
60+
# - A commit to main
61+
# - A tagged release

.github/workflows/publish-pypi.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v5
1515

1616
- name: Set up Python
17-
uses: actions/setup-python@v3
17+
uses: actions/setup-python@v6
1818
with:
1919
python-version: "3.13"
2020

@@ -42,7 +42,7 @@ jobs:
4242
path: dist
4343

4444
- name: Set up Python
45-
uses: actions/setup-python@v3
45+
uses: actions/setup-python@v6
4646
with:
4747
python-version: "3.13"
4848

@@ -55,7 +55,7 @@ jobs:
5555
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
5656
run: python3 -m twine upload --skip-existing --repository testpypi dist/*
5757

58-
- name: Test pip install from test.pypi
58+
- name: Test pip install from Test PyPI and verify version number
5959
run: |
6060
python -m venv venv-test-pypi
6161
venv-test-pypi/bin/python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple bambi
@@ -73,7 +73,7 @@ jobs:
7373
path: dist
7474

7575
- name: Set up Python
76-
uses: actions/setup-python@v3
76+
uses: actions/setup-python@v6
7777
with:
7878
python-version: "3.13"
7979

@@ -87,6 +87,6 @@ jobs:
8787
run: python3 -m twine upload dist/*
8888

8989
# See documentation on accesing the tag from the release
90-
# Look for 'github.ref' and 'github.ref_name' in https://docs.github.com/en/actions/learn-github-actions/contexts
90+
# Look for 'github.ref' and 'github.ref_name' in https://docs.github.com/en/actions/learn-github-actions/contexts
9191
# On October, 2023 it says "For workflows triggered by release, this is the release tag created"
92-
# So 'github.ref_name' should be the version number of the release we're making.
92+
# So 'github.ref_name' should be the version number of the release we're making.

.github/workflows/test.yml

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

.gitignore

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
*.pyc
2-
*.so
3-
*~
4-
.#*
5-
.DS_Store
6-
build
7-
*.egg-info/
8-
dist/
1+
.cache
92
.coverage
10-
tags
11-
*.zip
12-
*.nt.bz2
13-
*.tar.gz
14-
*.tgz
3+
.DS_Store
154
.ipynb_checkpoints
16-
*.orig
17-
.cache
18-
docs/_build
5+
.pixi
6+
.pytest_cache
7+
.Rproj.user
198
.vscode/
20-
pytest.ini
9+
*.egg-info/
10+
*.ipynb
11+
*.pyc
2112
/.quarto/
22-
.Rproj.user
23-
# Git ignore all the notebook files in the root
24-
*.ipynb
13+
build
14+
dist/
15+
docs/_build
16+
tags
17+
pixi.lock

.pre-commit-config.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
fail_fast: true
22

33
repos:
4-
- repo: https://github.com/ambv/black
5-
rev: 22.3.0
4+
- repo: https://github.com/psf/black
5+
rev: 25.9.0
66
hooks:
77
- id: black
8-
args: [--diff, --check]
8+
args: [--diff, --check, --color]
99

10-
- repo: https://github.com/PyCQA/pylint
11-
rev: v2.10.2
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.6.0
1212
hooks:
13-
- id: pylint
14-
args: [--rcfile=.pylintrc]
15-
- repo: https://github.com/MarcoGorelli/madforhooks
16-
rev: 0.3.0
17-
hooks:
18-
- id: no-print-statements
13+
- id: check-toml
14+
types: [toml]
15+
- id: check-yaml
16+
types: [yaml]
17+
- id: end-of-file-fixer
18+
types: [text]
19+
- id: check-added-large-files
20+
args: ["--maxkb=2048"]

0 commit comments

Comments
 (0)