Skip to content

Commit fb74817

Browse files
authored
Action_updates (#24)
* Update deps, add action and yml linting * Standardise format * bump version * Add cff manager actions * Update deps and format * Use official astral ruff action * add typechecking mode standard * add example data path * Fix py310 and py311 f-string escape sequence issues
1 parent 0528c12 commit fb74817

File tree

11 files changed

+182
-144
lines changed

11 files changed

+182
-144
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CITATION.cff Validator
2+
on:
3+
push:
4+
paths:
5+
- CITATION.cff
6+
workflow_dispatch:
7+
jobs:
8+
Validate-CITATION-cff:
9+
runs-on: ubuntu-latest
10+
name: Validate CITATION.cff
11+
env:
12+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v5
16+
- name: Validate CITATION.cff
17+
uses: dieghernan/cff-validator@v4

.github/workflows/publish.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
name: Publish to PyPI
2-
32
on:
43
release:
54
types:
65
- published
7-
86
jobs:
97
publish:
108
runs-on: ubuntu-latest
11-
129
permissions:
1310
contents: read
1411
packages: write
15-
1612
steps:
17-
- name: Check out the code
18-
uses: actions/checkout@v3
19-
20-
- name: Set up Python
21-
uses: actions/setup-python@v4
22-
with:
23-
python-version: '3.x'
24-
25-
- name: Install Hatch
26-
run: pip install hatch
27-
28-
- name: Build the package with Hatch
29-
run: hatch build
30-
31-
- name: Publish to PyPI
32-
env:
33-
HATCH_INDEX_USER: __token__
34-
HATCH_INDEX_AUTH: ${{ secrets.FLEXIDOT_PYPI_TOKEN }}
35-
run: hatch publish
13+
- name: Check out the code
14+
uses: actions/checkout@v5
15+
- name: Set up Python
16+
uses: actions/setup-python@v6
17+
with:
18+
python-version: '3.x'
19+
- name: Install Hatch
20+
run: pip install hatch
21+
- name: Build the package with Hatch
22+
run: hatch build
23+
- name: Publish to PyPI
24+
env:
25+
HATCH_INDEX_USER: __token__
26+
HATCH_INDEX_AUTH: ${{ secrets.FLEXIDOT_PYPI_TOKEN }}
27+
run: hatch publish

.github/workflows/pytest.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
name: Python Tests
2-
32
on: [pull_request]
4-
53
jobs:
64
test:
75
runs-on: ubuntu-latest
8-
96
strategy:
107
matrix:
118
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
12-
139
steps:
1410
# Checkout the latest commit associated with the PR
15-
- uses: actions/checkout@v4
16-
11+
- uses: actions/checkout@v5
1712
- name: Debug matrix value
1813
run: echo "Python version is ${{ matrix.python-version }}"
19-
2014
# Set up Miniconda
2115
- name: Set up Miniconda
22-
uses: conda-incubator/setup-miniconda@v2
16+
uses: conda-incubator/setup-miniconda@v3
2317
with:
24-
auto-update-conda: true # Optional: update Conda to the latest version
18+
auto-update-conda: true # Optional: update Conda to the latest version
2519
python-version: ${{ matrix.python-version }}
26-
2720
# Install any additional dependencies not included in the pyproject.toml file
2821
- name: Install additional dependencies
2922
run: |
3023
pip install '.[tests]' # Install all dependencies, including test-specific ones
3124
shell: bash -l {0}
32-
3325
# Run pytest on the specified directory
3426
- name: Run tests
3527
run: |

.github/workflows/ruff.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ jobs:
99
contents: write # Allows reading and writing repository contents (e.g., commits)
1010
pull-requests: write # Allows reading and writing pull requests
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
with:
1414
ref: ${{ github.sha }}
1515
token: ${{ secrets.GITHUB_TOKEN }}
16-
- uses: chartboost/ruff-action@v1
16+
- uses: astral-sh/ruff-action@v3
1717
with:
18-
src: './src/flexidot ./tests'
19-
args: 'format'
20-
- uses: chartboost/ruff-action@v1
18+
src: "./src ./tests"
19+
args: "format"
20+
- uses: astral-sh/ruff-action@v3
2121
with:
22-
src: './src/flexidot ./tests'
23-
args: 'check'
22+
src: "./src ./tests"
23+
args: "check --fix"
2424
- uses: isort/isort-action@v1
2525
with:
2626
configuration: "--settings-path=./pyproject.toml"
27-
paths: "./src/flexidot ./tests"
28-
- uses: stefanzweifel/git-auto-commit-action@v5
27+
paths: "./src ./tests"
28+
- uses: stefanzweifel/git-auto-commit-action@v7
2929
id: auto-commit-action
3030
with:
31-
commit_message: 'Style fixes by Ruff'
31+
commit_message: "Style fixes by Ruff"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Update CITATION.cff on Tag
2+
on:
3+
push:
4+
tags:
5+
# Match semantic version tags: v1.0.0, v1.2.3, v2.0.0-beta, etc.
6+
# Excludes moving tags: v1, v2
7+
- "v[0-9]+.[0-9]+.[0-9]+*"
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
jobs:
12+
update-citation:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
with:
17+
fetch-depth: 0
18+
- uses: Adamtaranto/citation-sync-action@v1
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
# Create PR instead of pushing to main
22+
use-pull-request: true
23+
update-mode: "match"

.pre-commit-config.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v5.0.0
5+
rev: v6.0.0
66
hooks:
77
- id: check-toml
88
- id: check-yaml
@@ -20,14 +20,21 @@ repos:
2020
- id: end-of-file-fixer
2121
- id: name-tests-test
2222
args: [--pytest-test-first]
23-
2423
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.11.4
24+
rev: v0.14.4
2625
hooks:
2726
- id: ruff
2827
args: [--fix, --exit-non-zero-on-fix, --show-fixes, --config=pyproject.toml]
2928
- id: ruff-format
3029
args: [--config=pyproject.toml]
30+
- repo: https://github.com/rhysd/actionlint
31+
rev: v1.7.8
32+
hooks:
33+
- id: actionlint
34+
- repo: https://github.com/google/yamlfmt
35+
rev: v0.20.0
36+
hooks:
37+
- id: yamlfmt
3138

3239
## Activate this after adding docstrings to all functions
3340
# - repo: https://github.com/numpy/numpydoc

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"tests"
66
],
77
"python.testing.unittestEnabled": false,
8-
"python.testing.pytestEnabled": true
8+
"python.testing.pytestEnabled": true,
9+
"python.analysis.typeCheckingMode": "standard"
910
}

0 commit comments

Comments
 (0)