Skip to content

Commit 5a73ead

Browse files
authored
Modernize CIs and fix zizmor lints (#224)
* modernize CIs and fix zizmor lints * add env to call python * remove unused deps
1 parent aca3093 commit 5a73ead

9 files changed

Lines changed: 119 additions & 55 deletions

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
2+
3+
version: 2
4+
updates:
5+
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"
10+
labels:
11+
- "Bot"
12+
groups:
13+
github-actions:
14+
patterns:
15+
- '*'
16+
cooldown:
17+
default-days: 7
18+
19+
- package-ecosystem: "pre-commit"
20+
directory: "/"
21+
schedule:
22+
interval: "daily"
23+
labels:
24+
- "Bot"
25+
cooldown:
26+
default-days: 7

.github/workflows/deploy-docs.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
name: Documentation
33

4+
# no permissions by default
5+
permissions: {}
6+
47
on:
58
pull_request:
69
push:
@@ -13,28 +16,31 @@ on:
1316
jobs:
1417
build-docs:
1518
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
defaults:
22+
run:
23+
shell: bash -l {0}
1624

1725
steps:
18-
- name: checkout
19-
uses: actions/checkout@v3
26+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2027
with:
2128
fetch-depth: 0
29+
persist-credentials: false
2230

2331
- name: Setup Micromamba
24-
uses: mamba-org/setup-micromamba@v1
32+
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
2533
with:
2634
environment-name: TEST
2735
init-shell: bash
2836
create-args: >-
2937
python=3 --file requirements.txt --file requirements-dev.txt --channel conda-forge
3038
31-
- name: Install branca
32-
shell: bash -l {0}
39+
- name: Install library
3340
run: |
3441
python -m pip install -e . --no-deps --force-reinstall
3542
3643
- name: Build documentation
37-
shell: bash -l {0}
3844
run: >
3945
set -e
4046
&& pushd docs
@@ -43,7 +49,7 @@ jobs:
4349
4450
- name: Deploy
4551
if: success() && github.event_name == 'release'
46-
uses: peaceiris/actions-gh-pages@v3
52+
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
4753
with:
4854
github_token: ${{ secrets.GITHUB_TOKEN }}
4955
publish_dir: docs/build/html

.github/workflows/pypi.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
name: Publish to PyPI
33

4+
# no permissions by default
5+
permissions: {}
6+
47
on:
58
pull_request:
69
push:
@@ -17,11 +20,17 @@ defaults:
1720
jobs:
1821
packages:
1922
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
2025
steps:
21-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
27+
with:
28+
# Should be enough for setuptools-scm
29+
fetch-depth: 100
30+
persist-credentials: false
2231

2332
- name: Set up Python
24-
uses: actions/setup-python@v4
33+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
2534
with:
2635
python-version: "3.x"
2736

@@ -47,7 +56,7 @@ jobs:
4756
4857
- name: Publish a Python distribution to PyPI
4958
if: success() && github.event_name == 'release'
50-
uses: pypa/gh-action-pypi-publish@release/v1
59+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
5160
with:
5261
user: __token__
5362
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test_code.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Code Tests
22

3+
# no permissions by default
4+
permissions: {}
5+
36
on:
47
pull_request:
58
push:
@@ -8,29 +11,33 @@ on:
811
jobs:
912
run:
1013
runs-on: ${{ matrix.os }}
14+
defaults:
15+
run:
16+
shell: bash -l {0}
1117
strategy:
1218
fail-fast: false
1319
matrix:
14-
os: [ubuntu-latest, windows-latest]
15-
python-version: ["3.8", "3.12"]
20+
os: [ ubuntu-latest, windows-latest, macos-latest ]
21+
python-version: ["3.10", "3.14"]
1622

1723
steps:
18-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
25+
with:
26+
fetch-depth: 0
27+
persist-credentials: false
1928

20-
- name: Setup Micromamba Python ${{ matrix.python-version }}
21-
uses: mamba-org/setup-micromamba@v1
29+
- name: Setup Micromamba
30+
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
2231
with:
2332
environment-name: TEST
2433
init-shell: bash
2534
create-args: >-
2635
python=${{ matrix.python-version }} pip --file requirements.txt --file requirements-dev.txt --channel conda-forge
2736
28-
- name: Install branca
29-
shell: bash -l {0}
37+
- name: Install library
3038
run: |
3139
python -m pip install -e . --no-deps --force-reinstall
3240
3341
- name: Tests
34-
shell: bash -l {0}
3542
run: |
3643
python -m pytest -vv -rxs tests -m "not headless"
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Notebook Tests
22

3+
# no permissions by default
4+
permissions: {}
5+
36
on:
47
pull_request:
58
push:
@@ -8,24 +11,28 @@ on:
811
jobs:
912
run:
1013
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
shell: bash -l {0}
1117

1218
steps:
13-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
1423

15-
- name: Setup Micromamba Python 3
16-
uses: mamba-org/setup-micromamba@v1
24+
- name: Setup Micromamba
25+
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
1726
with:
1827
environment-name: TEST
1928
init-shell: bash
2029
create-args: >-
2130
python=3 pip --file requirements.txt --file requirements-dev.txt --channel conda-forge
2231
23-
- name: Install branca
24-
shell: bash -l {0}
32+
- name: Install library
2533
run: |
2634
python -m pip install -e . --no-deps --force-reinstall
2735
2836
- name: Notebook tests
29-
shell: bash -l {0}
3037
run: |
3138
python -m pytest --nbval-lax examples

.github/workflows/test_mypy.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
name: Mypy type hint checks
22

3+
# no permissions by default
4+
permissions: {}
5+
36
on:
47
pull_request:
58
push:
6-
branches:
7-
- main
9+
branches: [main]
810

911
jobs:
1012
run:
1113
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
shell: bash -l {0}
1217

1318
steps:
14-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
1523

16-
- name: Setup Micromamba env
17-
uses: mamba-org/setup-micromamba@v1
24+
- name: Setup Micromamba
25+
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
1826
with:
1927
environment-name: TEST
28+
init-shell: bash
2029
create-args: >-
21-
python=3
22-
--file requirements.txt
23-
--file requirements-dev.txt
30+
python=3 pip --file requirements.txt --file requirements-dev.txt --channel conda-forge
2431
25-
- name: Install branca from source
26-
shell: bash -l {0}
32+
- name: Install library
2733
run: |
2834
python -m pip install -e . --no-deps --force-reinstall
2935
3036
- name: Mypy test
31-
shell: bash -l {0}
3237
run: |
3338
mypy branca
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
name: Headless Tests
1+
name: Full Tests
2+
3+
# no permissions by default
4+
permissions: {}
25

36
on:
47
pull_request:
@@ -8,24 +11,28 @@ on:
811
jobs:
912
run:
1013
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
shell: bash -l {0}
1117

1218
steps:
13-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
1423

15-
- name: Setup Micromamba Python 3
16-
uses: mamba-org/setup-micromamba@v1
24+
- name: Setup Micromamba
25+
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
1726
with:
1827
environment-name: TEST
1928
init-shell: bash
2029
create-args: >-
2130
python=3 pip --file requirements.txt --file requirements-dev.txt --channel conda-forge
2231
23-
- name: Install branca
24-
shell: bash -l {0}
32+
- name: Install library
2533
run: |
2634
python -m pip install -e . --no-deps --force-reinstall
2735
2836
- name: Tests
29-
shell: bash -l {0}
3037
run: |
3138
pytest -vv -rxs tests -m "headless"

.pre-commit-config.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
args: [--max-line-length=105, "--ignore=E203,W503"]
2222

2323
- repo: https://github.com/pycqa/isort
24-
rev: 9.0.0a3
24+
rev: 9.0.0b1
2525
hooks:
2626
- id: isort
2727
additional_dependencies: [toml]
@@ -56,3 +56,12 @@ repos:
5656
rev: v4.0.0
5757
hooks:
5858
- id: add-trailing-comma
59+
60+
ci:
61+
autofix_commit_msg: |
62+
[pre-commit.ci] auto fixes from pre-commit.com hooks
63+
64+
for more information, see https://pre-commit.ci
65+
autofix_prs: false
66+
skip: []
67+
submodules: false

requirements-dev.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
black
21
check-manifest
3-
flake8
4-
flake8-builtins
5-
flake8-comprehensions
6-
flake8-mutable
7-
flake8-print
8-
isort
92
jupyter
103
mypy
114
nbsphinx
125
nbval
136
numpy
14-
pre-commit
15-
pylint
167
pytest
178
pytest-cov
18-
pytest-flake8
199
pytest-xdist
2010
selenium
2111
setuptools_scm
2212
sphinx
23-
twine
24-
wheel

0 commit comments

Comments
 (0)