Skip to content

Commit 3629fe0

Browse files
authored
Merge pull request #1 from hz-b/dev/feature/poetry-build-system
[TASK] Poetry system, updated license and CI/CD
2 parents 5c958e9 + cc7e8de commit 3629fe0

Some content is hidden

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

57 files changed

+957
-86
lines changed

.github/workflows/dt4acc-ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: dt4acc build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
wrap_and_build:
11+
# Re-generate SWIG wrappers, then build and test
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: [ "3.9", "3.10", "3.11" , "3.12" ]
17+
numpy-version : [ "numpy<2.0", # "numpy>=2.0"
18+
]
19+
steps:
20+
# Checkout the repository contents
21+
- name: Checkout dt4acc
22+
uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.numpy-version }}
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
# numpy-version: ${{ matrix.numpy-version }}
28+
cache: 'pip'
29+
cache-dependency-path: |
30+
**/pyproject.toml
31+
**/requirements*.txt
32+
33+
# Install dependencies
34+
- name: Install apt dependencies
35+
run: |
36+
sudo apt-get install python3-dev python3-pip
37+
38+
# Install Python dependencies
39+
- name: Python dependencies
40+
run: |
41+
python -m pip install --upgrade pip wheel
42+
python -m pip install pytest pycodestyle flake8
43+
python -m pip install "${{ matrix.numpy-version }}"
44+
45+
- name: wheel
46+
run: |
47+
python -m pip wheel -w wheel/ ./
48+
49+
- name: install
50+
run: |
51+
# listing a non existing directory fails ..
52+
python -m pip install wheel/dt4acc-*.whl
53+
54+
- name: Lint with flake8
55+
run: |
56+
# stop the build if there are Python syntax errors or undefined names
57+
flake8 pygsl --count --select=E9,F63,F7,F82 --show-source --statistics
58+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
59+
flake8 pygsl --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
60+
61+
- name: test
62+
run: |
63+
# make sure to move out of the source directory
64+
cd /tmp
65+
python -m pytest -s /home/runner/work/hz-b/dt4acc/tests
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Publish dt4acc to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
# meson build needs it at start
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.x"
17+
- name: Install pypa/build
18+
run: python3 -m pip install build --user
19+
- name: Build a source tarball (wheel would have to be manylinux )
20+
run: python3 -m build
21+
- name: Store the distribution packages
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: python-package-distributions
25+
path: dist/
26+
27+
publish-to-pypi:
28+
name: Publish pygsl distribution to PyPI
29+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
30+
needs:
31+
- build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/d/dt4acc
36+
permissions:
37+
id-token: write # IMPORTANT: mandatory for trusted publishing
38+
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: python-package-distributions
44+
path: dist/
45+
- name: Publish distribution to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
48+
github-release:
49+
name: Sign dt4acc with Sigstore and upload them to GitHub Release
50+
needs:
51+
- publish-to-pypi
52+
runs-on: ubuntu-latest
53+
54+
permissions:
55+
contents: write # IMPORTANT: mandatory for making GitHub Releases
56+
id-token: write # IMPORTANT: mandatory for sigstore
57+
58+
steps:
59+
- name: Download all the dists
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: python-package-distributions
63+
path: dist/
64+
- name: Sign the dists with Sigstore
65+
uses: sigstore/[email protected]
66+
with:
67+
inputs: ./dist/*.tar.gz
68+
- name: Create GitHub Release
69+
env:
70+
GITHUB_TOKEN: ${{ github.token }}
71+
run: >-
72+
gh release create
73+
'${{ github.ref_name }}'
74+
--repo '${{ github.repository }}'
75+
--notes ""
76+
- name: Upload artifact signatures to GitHub Release
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
# Upload to GitHub Release using the `gh` CLI.
80+
# `dist/` contains the built packages, and the
81+
# sigstore-produced signatures and certificates.
82+
run: >-
83+
gh release upload
84+
'${{ github.ref_name }}' dist/**
85+
--repo '${{ github.repository }}'
86+
87+
repository-url: https://test.pypi.org/legacy/

.github/workflows/dt4acc-pypi.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
name: dt4acc from PyPI
3+
on:
4+
schedule:
5+
# ┌───────────── minute (0 - 59)
6+
# │ ┌───────────── hour (0 - 23)
7+
# │ │ ┌───────────── day of the month (1 - 31)
8+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
9+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
10+
# │ │ │ │ │
11+
# │ │ │ │ │
12+
# │ │ │ │ │
13+
# * * * * *
14+
- cron: '30 5 * * 0'
15+
16+
jobs:
17+
pypi:
18+
# Build and test only, use pre-generated SWIG wrappers, install from PyPI
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
23+
steps:
24+
# Checkout the repository contents
25+
- name: Checkout dt4acc code
26+
uses: actions/checkout@v4
27+
28+
# Setup Python version
29+
- name: Setup Python 3.12
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: 3.12
33+
34+
# Install dependencies
35+
- name: Install apt dependencies
36+
run: |
37+
sudo apt update
38+
sudo apt install python3-all-dev
39+
40+
# Install Python dependencies
41+
- name: Python dependencies
42+
run: |
43+
python -m pip install --upgrade pip wheel
44+
python -m pip install pytest pycodestyle
45+
46+
- name: install
47+
run: |
48+
python -m pip install dt4acc
49+
50+
- name: test
51+
run: |
52+
# make sure to move out of the source directory
53+
cd /tmp
54+
python -m pytest -s /home/runner/work/hz-b/dt4acc/tests

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ iocBoot/iocvaccel/envPaths
4040

4141
# python related stuff
4242
src/dist/
43+
wheels/
4344
*.pyc
4445
*.pyo
4546
__pycache__/
47+
48+
venv*/

0 commit comments

Comments
 (0)