Skip to content

Commit f7a619e

Browse files
authored
Merge pull request #86 from imcf/devel
Start finalizing the `imcflibs-1.5.0` release
2 parents 2affd76 + caf69f7 commit f7a619e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6243
-301
lines changed

β€Ž.coveragerc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[run]
2+
source =
3+
src/imcflibs
4+
5+
omit =
6+
conftest.py
7+
tests/*
8+
# omit anything in a venv / venv2 directory
9+
./venv/*
10+
./venv2/*
11+
12+
[report]
13+
## NOTE: `exclude_also` is only supported for coverage 7.2 and newer, which
14+
## won't work when testing with Python2 (coverage 5.5 is the latest one
15+
## supporting Python2), hence we cannot use it:
16+
; exclude_also =
17+
; if _python_platform.python_implementation\(\) == \"Jython\":

β€Ž.github/codecov.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
coverage:
2+
precision: 0
3+
round: nearest
4+
range:
5+
- 0
6+
- 75
7+
# notification blocks
8+
# https://docs.codecov.io/docs/codecovyml-reference#section-coverage-notify
9+
# notify:
10+
# status:
11+
# project:
12+
# patch:
13+
# changes: off

β€Ž.github/workflows/build.yml

+162-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,44 @@
1-
name: build
1+
name: 🚚🌍 Publish to πŸ”¬β˜• SciJava and πŸŽͺ PyPI
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
tags:
8-
- "*-[0-9]+.*"
9-
pull_request:
10-
branches:
11-
- master
4+
5+
release:
6+
types:
7+
- published # A release, pre-release, or draft of a release was published.
8+
9+
workflow_dispatch:
10+
11+
## Do NOT run on pushes or PR's, as they won't have a 'release.properties',
12+
## which is required by the build-tooling (see the comment at the "Inspect" /
13+
## "check-if-release.sh" section below for details).
14+
# push:
15+
# pull_request:
16+
1217

1318
jobs:
14-
build:
19+
20+
publish-to-scijava:
21+
22+
name: πŸ”¬β˜• publish to SciJava
23+
1524
runs-on: ubuntu-latest
1625

1726
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Java
27+
28+
- uses: actions/checkout@v4
29+
name: πŸ“₯ Checkout repo
30+
31+
- name: β˜• Set up Java
2032
uses: actions/setup-java@v3
2133
with:
2234
java-version: '8'
2335
distribution: 'zulu'
2436
cache: 'maven'
25-
- name: Set up CI environment
37+
38+
- name: πŸͺ Set up CI environment
2639
run: .github/setup.sh
27-
- name: Execute the build
40+
41+
- name: πŸ‘· Build and publish on πŸ”¬β˜• SciJava
2842
run: .github/build.sh
2943
env:
3044
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
@@ -33,3 +47,137 @@ jobs:
3347
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
3448
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
3549
SIGNING_ASC: ${{ secrets.SIGNING_ASC }}
50+
51+
52+
build-via-poetry:
53+
54+
name: πŸ‘· build via 🎭 Poetry
55+
56+
runs-on: ubuntu-22.04
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
name: πŸ“₯ Checkout repo
61+
62+
- name: πŸ—ƒ Cache πŸ“¦ APT Packages
63+
uses: awalsh128/[email protected]
64+
with:
65+
packages: xmlstarlet
66+
version: 1.0
67+
68+
- name: πŸ•΅ Inspect if this is a proper "scijava-scripts" release
69+
run: scripts/check-if-release.sh
70+
# This will make sure the file 'release.properties' exists, meaning
71+
# `release-version.sh` from the 'scijava-scripts' repo has been run to
72+
# prepare the release and modify 'pom.xml' (which is in turn
73+
# required by the local 'scripts/run-poetry.sh' script for building the
74+
# Python package through Poetry.
75+
76+
- name: 🐍 Set up Python
77+
uses: actions/setup-python@v5
78+
with:
79+
python-version: "3.10"
80+
81+
- name: πŸ—ƒ Cache 🎭 Poetry install
82+
uses: actions/cache@v4
83+
with:
84+
path: ~/.local
85+
key: poetry-2.0.1-0
86+
87+
# The key configuration value here is `virtualenvs-in-project: true`: this
88+
# creates the venv as a `.venv` in your testing directory, which allows
89+
# the next step to easily cache it.
90+
- name: πŸ”©πŸ”§ Install 🎭 Poetry
91+
uses: snok/install-poetry@v1
92+
with:
93+
version: 2.0.1
94+
virtualenvs-create: true
95+
virtualenvs-in-project: true
96+
97+
### No dependencies and project installation required, we're just packaging.
98+
# # Cache dependencies (i.e. all the stuff in your `pyproject.toml`).
99+
# - name: πŸ—ƒ Cache 🧾 Dependencies
100+
# id: cache-deps
101+
# uses: actions/cache@v4
102+
# with:
103+
# path: .venv
104+
# key: pydeps-${{ hashFiles('**/poetry.lock') }}
105+
106+
### No poetry-dynamic-versioning here, we're using the POM instead!
107+
# - name: 🎭 Install Poetry dynamic-versioning πŸ”Œ plugin
108+
# run: poetry self add "poetry-dynamic-versioning[plugin]"
109+
110+
### No dependencies and project installation required, we're just packaging.
111+
# # Install dependencies. `--no-root` means "install all dependencies but
112+
# # not the project itself", which is what you want to avoid caching _your_
113+
# # code. The `if` statement ensures this only runs on a cache miss.
114+
# - name: 🎭 Install 🧾 Dependencies
115+
# run: scripts/run-poetry.sh install --no-interaction --no-root
116+
# if: steps.cache-deps.outputs.cache-hit != 'true'
117+
118+
# - name: 🎭 Install πŸ›– project
119+
# run: scripts/run-poetry.sh install --no-interaction
120+
121+
- name: πŸŽ­πŸ‘· Build 🧱 project
122+
run: scripts/run-poetry.sh build
123+
env:
124+
IGNORE_DEPS_PYTHON: true # required to build "py2.py3" wheels
125+
126+
- name: πŸ“€ Upload build artifacts
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: release-dists
130+
path: dist/
131+
132+
133+
publish-to-pypi:
134+
135+
name: 🚚🌍 publish to πŸŽͺ PyPI
136+
137+
runs-on: ubuntu-latest
138+
139+
needs:
140+
- build-via-poetry
141+
142+
permissions:
143+
id-token: write
144+
145+
environment:
146+
name: release
147+
148+
steps:
149+
- name: πŸ“₯ Retrieve release πŸ“¦ distributions
150+
uses: actions/download-artifact@v4
151+
with:
152+
name: release-dists
153+
path: dist/
154+
155+
- name: πŸ₯ Publish release distributions to πŸŽͺ PyPI
156+
uses: pypa/gh-action-pypi-publish@release/v1
157+
with:
158+
packages-dir: dist/
159+
160+
161+
trigger-foreign-workflows:
162+
163+
name: πŸš€ Dispatch foreign workflows
164+
165+
strategy:
166+
matrix:
167+
repo: ['imcf/imcf.github.io']
168+
169+
runs-on: ubuntu-latest
170+
171+
needs:
172+
- publish-to-pypi
173+
174+
steps:
175+
- name: 🏹 Fire event on `${{ matrix.repo }}`
176+
run: |
177+
curl -L \
178+
-X POST \
179+
-H "Accept: application/vnd.github+json" \
180+
-H "Authorization: Bearer ${{ secrets.DISPATCH_DEPLOY_PAGES }}" \
181+
-H "X-GitHub-Api-Version: 2022-11-28" \
182+
https://api.github.com/repos/${{ matrix.repo }}/dispatches \
183+
-d '{"event_type":"dispatch-event"}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: πŸš€ Dispatch foreign workflows
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
8+
trigger-event:
9+
10+
strategy:
11+
matrix:
12+
repo: ['imcf/imcf.github.io']
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: 🏹 Fire event on `${{ matrix.repo }}`
18+
run: |
19+
curl -L \
20+
-X POST \
21+
-H "Accept: application/vnd.github+json" \
22+
-H "Authorization: Bearer ${{ secrets.DISPATCH_DEPLOY_PAGES }}" \
23+
-H "X-GitHub-Api-Version: 2022-11-28" \
24+
https://api.github.com/repos/${{ matrix.repo }}/dispatches \
25+
-d '{"event_type":"dispatch-event"}'

β€Ž.github/workflows/lint.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: πŸ”Ž Code Linting ⚑
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
10+
lint:
11+
name: Ruff βš‘πŸ•΅
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
17+
- name: πŸ“₯ Checkout repo
18+
uses: actions/checkout@v4
19+
20+
- name: Run Ruff checks ⚑
21+
uses: astral-sh/ruff-action@v3
22+
with:
23+
args: check
+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
## action file inspired by https://jacobian.org/til/github-actions-poetry/
2+
3+
name: πŸ§ͺ pytest (via 🎭 Poetry)
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
tags:
10+
- run-pytest*
11+
- py3-pytest*
12+
- "*-[0-9]+.*"
13+
pull_request:
14+
branches:
15+
- master
16+
- devel
17+
18+
jobs:
19+
pytest-poetry:
20+
# runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
22+
23+
steps:
24+
25+
- uses: actions/checkout@v4
26+
name: πŸ“₯ Checkout repo
27+
28+
- name: πŸ—ƒ Cache πŸ“¦ APT Packages
29+
uses: awalsh128/[email protected]
30+
with:
31+
packages: xmlstarlet
32+
version: 1.0
33+
34+
# If you wanted to use multiple Python versions, you'd have specify a
35+
# matrix in the job and reference the matrix python version here.
36+
- name: 🐍 Set up Python
37+
uses: actions/[email protected]
38+
with:
39+
python-version: "3.10"
40+
41+
# Cache the installation of Poetry itself, e.g. the next step. This
42+
# prevents the workflow from installing Poetry every time, which can be
43+
# slow. Note the use of the Poetry version number in the cache key, and
44+
# the "-0" suffix: this allows you to invalidate the cache manually
45+
# if/when you want to upgrade Poetry, or if something goes wrong (could be
46+
# done mildly cleaner by using an environment variable).
47+
- name: πŸ—ƒ Cache 🎭 Poetry install
48+
uses: actions/cache@v4
49+
with:
50+
path: ~/.local
51+
key: poetry-1.8.2-0
52+
53+
# Install Poetry. You could do this manually, or there are several actions
54+
# that do this. `snok/install-poetry` seems to be minimal yet complete,
55+
# and really just calls out to Poetry's default install script, which
56+
# feels correct. I pin the Poetry version here because Poetry does
57+
# occasionally change APIs between versions and I don't want my actions to
58+
# break if it does.
59+
#
60+
# The key configuration value here is `virtualenvs-in-project: true`: this
61+
# creates the venv as a `.venv` in your testing directory, which allows
62+
# the next step to easily cache it.
63+
- name: πŸ”©πŸ”§ Install 🎭 Poetry
64+
uses: snok/install-poetry@v1
65+
with:
66+
version: 1.8.2
67+
virtualenvs-create: true
68+
virtualenvs-in-project: true
69+
70+
# Cache your dependencies (i.e. all the stuff in your `pyproject.toml`).
71+
# Note the cache key: if you're using multiple Python versions, or
72+
# multiple OSes, you'd need to include them in the cache key. I'm not, so
73+
# it can be simple and just depend on the poetry.lock.
74+
- name: πŸ—ƒ Cache 🧾 Dependencies
75+
id: cache-deps
76+
uses: actions/cache@v4
77+
with:
78+
path: .venv
79+
key: pydeps-${{ hashFiles('**/poetry.lock') }}
80+
81+
### No poetry-dynamic-versioning here, we're using the POM instead!
82+
# - name: 🎭 Install Poetry dynamic-versioning πŸ”Œ plugin
83+
# run: poetry self add "poetry-dynamic-versioning[plugin]"
84+
85+
# Install dependencies. `--no-root` means "install all dependencies but
86+
# not the project itself", which is what you want to avoid caching _your_
87+
# code. The `if` statement ensures this only runs on a cache miss.
88+
- name: 🎭 Install 🧾 Dependencies
89+
run: scripts/run-poetry.sh install --no-interaction --no-root --verbose
90+
if: steps.cache-deps.outputs.cache-hit != 'true'
91+
92+
# Now install _your_ project. This isn't necessary for many types of
93+
# projects -- particularly things like Django apps don't need this. But
94+
# it's a good idea since it fully-exercises the pyproject.toml and makes
95+
# that if you add things like console-scripts at some point that they'll
96+
# be installed and working.
97+
- name: 🎭 Install πŸ›– project
98+
run: scripts/run-poetry.sh install --no-interaction --verbose
99+
100+
# And finally run the tests.
101+
- name: πŸ§ͺ🎭 Run Tests
102+
run: scripts/run-poetry.sh run pytest --color=yes --cov --cov-report=xml -vv
103+
104+
- name: πŸ“€ Upload πŸ“Š coverage reports to β˜‚ Codecov
105+
uses: codecov/codecov-action@v5
106+
with:
107+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
Β (0)