-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d4b1b1
commit 0be1882
Showing
3 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: dt4acc build | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
wrap_and_build: | ||
# Re-generate SWIG wrappers, then build and test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11" , "3.12" ] | ||
numpy-version : [ "numpy<2.0", # "numpy>=2.0" | ||
] | ||
steps: | ||
# Checkout the repository contents | ||
- name: Checkout dt4acc | ||
uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.numpy-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# numpy-version: ${{ matrix.numpy-version }} | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
**/pyproject.toml | ||
**/requirements*.txt | ||
# Install dependencies | ||
- name: Install apt dependencies | ||
run: | | ||
sudo apt-get install python3-dev python3-pip | ||
# Install Python dependencies | ||
- name: Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
python -m pip install pytest pycodestyle flake8 | ||
python -m pip install "${{ matrix.numpy-version }}" | ||
- name: wheel | ||
run: | | ||
python -m pip wheel -w wheel/ ./ | ||
- name: install | ||
run: | | ||
# listing a non existing directory fails .. | ||
python -m pip install wheel/pygsl-*.whl | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 pygsl --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 pygsl --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: test | ||
run: | | ||
# make sure to move out of the source directory | ||
cd /tmp | ||
python -m pytest -s /home/runner/work/hz-b/dt4acc/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Publish dt4acc to PyPI and TestPyPI | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
name: Build distribution | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
# meson build needs it at start | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- name: Install pypa/build | ||
run: python3 -m pip install build --user | ||
- name: Build a source tarball (wheel would have to be manylinux ) | ||
run: python3 -m build | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-pypi: | ||
name: Publish pygsl distribution to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/d/dt4acc | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
name: Sign dt4acc with Sigstore and upload them to GitHub Release | ||
needs: | ||
- publish-to-pypi | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/gh-action-sigstore-python@v3.0.0 | ||
with: | ||
inputs: ./dist/*.tar.gz | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "" | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' | ||
repository-url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
name: dt4acc from PyPI | ||
on: | ||
schedule: | ||
# ┌───────────── minute (0 - 59) | ||
# │ ┌───────────── hour (0 - 23) | ||
# │ │ ┌───────────── day of the month (1 - 31) | ||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | ||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# * * * * * | ||
- cron: '30 5 * * 0' | ||
|
||
jobs: | ||
pypi: | ||
# Build and test only, use pre-generated SWIG wrappers, install from PyPI | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
# Checkout the repository contents | ||
- name: Checkout dt4acc code | ||
uses: actions/checkout@v4 | ||
|
||
# Setup Python version | ||
- name: Setup Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
# Install dependencies | ||
- name: Install apt dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install python3-all-dev | ||
# Install Python dependencies | ||
- name: Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
python -m pip install pytest pycodestyle | ||
- name: install | ||
run: | | ||
python -m pip install dt4acc | ||
- name: test | ||
run: | | ||
# make sure to move out of the source directory | ||
cd /tmp | ||
python -m pytest -s /home/runner/work/hz-b/dt4acc/tests |