Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/_build_sdist_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build sdist

on:
workflow_call:
workflow_dispatch: # Manual trigger

jobs:
_build-sdist_:
name: Build sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: python -m pip install --upgrade pip build setuptools

- name: Set PVCAM_SDK_PATH on Linux
run: echo "PVCAM_SDK_PATH=${GITHUB_WORKSPACE}/pvcam-sdk/linux" >> $GITHUB_ENV

- name: Build package
run: python -m build --sdist

- uses: actions/upload-artifact@v4
with:
name: pyvcam_sdist
path: dist/
if-no-files-found: error
71 changes: 71 additions & 0 deletions .github/workflows/_build_wheels_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build wheels

on:
workflow_call:
workflow_dispatch: # Manual trigger

jobs:
_build-wheels_:
name: Build wheel (${{ matrix.os }} Python ${{ matrix.python }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
# Don't use '*-latest' to ensure the oldest Python version is not
# dropped on upgrade.
# Use 'ubuntu-22.04' because 24.04 is not available for 'act' yet.
# The 'ubuntu-*-arm' runners are not free for open source yet.
os:
- 'ubuntu-22.04'
#- 'ubuntu-22.04-arm'
- 'windows-2022'
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
exclude:
# The 'ubuntu-*-arm' and 'windows*' runners are not supported by 'act'
#- os: ${{ github.event.act && 'ubuntu-22.04-arm' }}
- os: ${{ github.event.act && 'windows-2022' }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: python -m pip install --upgrade pip build setuptools

- if: runner.os == 'Windows'
name: Set PVCAM_SDK_PATH on Windows
shell: bash
run: echo "PVCAM_SDK_PATH=${GITHUB_WORKSPACE}/pvcam-sdk/windows" >> $GITHUB_ENV
- if: runner.os == 'Linux'
name: Set PVCAM_SDK_PATH on Linux
run: echo "PVCAM_SDK_PATH=${GITHUB_WORKSPACE}/pvcam-sdk/linux" >> $GITHUB_ENV

- if: runner.os == 'Linux'
name: Create PVCAM library symlinks on Linux
shell: bash
run: |
for d in i686 x86_64 aarch64; do
cd "$PVCAM_SDK_PATH/library/$d"
f=$(echo libpvcam.so.*.*)
chmod +x "$f"
ln -sf "$f" "${f%.*}"
ln -sf "$f" "${f%%.so.*}.so"
done

- name: Build package
run: python -m build --wheel

- uses: actions/upload-artifact@v4
with:
name: pyvcam_wheel_${{ matrix.os }}_py${{ matrix.python }}
path: dist/
if-no-files-found: error
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build all

on:
push:
branches:
- master
paths:
- '!docs/**'
- '!README.md'
pull_request:
branches:
- master
paths:
- '!docs/**'
- '!README.md'
workflow_dispatch: # Manual trigger

jobs:
build-sdist:
uses: './.github/workflows/_build_sdist_.yml'

build-wheels:
uses: './.github/workflows/_build_wheels_.yml'

build:
needs:
- build-sdist
- build-wheels

name: Build all
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
pattern: pyvcam_*
path: dist/
merge-multiple: true

- uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: python -m pip install --upgrade pip twine packaging

- name: Check package
run: python -m twine check --strict dist/*
44 changes: 44 additions & 0 deletions .github/workflows/deploy_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PyPI Release

on:
release:
types:
- released
workflow_dispatch: # Manual trigger

jobs:
_build-sdist:
if: github.repository == 'Photometrics/PyVCAM' && !github.event.act # Skip job during local testing
uses: './.github/workflows/_build_sdist_.yml'

_build-wheels:
if: github.repository == 'Photometrics/PyVCAM' && !github.event.act # Skip job during local testing
uses: './.github/workflows/_build_wheels_.yml'

deploy-pypi:
if: github.repository == 'Photometrics/PyVCAM' && !github.event.act # Skip job during local testing
needs:
- _build-sdist
- _build-wheels

name: Upload to PyPI
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/PyVCAM

permissions:
id-token: write # Mandatory for trusted publishing

steps:
- uses: actions/download-artifact@v4
with:
pattern: pyvcam_*
path: dist/
merge-multiple: true

- name: Print out packages
run: ls -la dist

- uses: pypa/gh-action-pypi-publish@release/v1
52 changes: 52 additions & 0 deletions .github/workflows/deploy_testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: TestPyPI Release

on:
push:
tags:
- 'v*'
release:
types:
- prereleased
- released
workflow_dispatch: # Manual trigger

jobs:
_build-sdist:
if: github.repository == 'Photometrics/PyVCAM'
uses: './.github/workflows/_build_sdist_.yml'

_build-wheels:
if: github.repository == 'Photometrics/PyVCAM'
uses: './.github/workflows/_build_wheels_.yml'

deploy-testpypi:
if: github.repository == 'Photometrics/PyVCAM'
needs:
- _build-sdist
- _build-wheels

name: Upload to TestPyPI
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/PyVCAM

steps:
- uses: actions/download-artifact@v4
with:
pattern: pyvcam_*
path: dist/
merge-multiple: true

- name: Print out downloaded artifacts
run: ls -la dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
# Using token instead of trusted publishing to allow
# 'act' to publish to TestPyPI when testing actions locally.
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}
22 changes: 9 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,30 @@ name: Tests

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch: # Manual trigger

jobs:
check:
name: Check code quality - ${{ matrix.os }} - ${{ matrix.python-version }}

name: Check code quality (${{ matrix.os }} Python ${{ matrix.python }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.12']
os:
- 'ubuntu-latest'
python:
- '3.13'

steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python }}

- name: Update pip
run: python -m pip install --upgrade pip
Expand All @@ -37,9 +34,8 @@ jobs:
# Rather installing dependencies manually
#- name: Install the package with dependencies
# run: python -m pip install '.[gui,dev]'
# Rather installing dependencies manually
- name: Install the package dependencies
run: python -m pip install setuptools numpy opencv-python matplotlib
run: python -m pip install --upgrade setuptools numpy opencv-python matplotlib

- name: Validate pyproject.toml
run: |
Expand Down
Loading