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
28 changes: 28 additions & 0 deletions .github/actions/build-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Build Python Package"
description: "Build and package the library"
inputs:
python-version:
description: "Python version"
required: true
target:
description: "Target to build the package for"
required: true

runs:
using: composite
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ inputs.target }}
args: --release --out dist --find-interpreter
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ inputs.target }}
path: dist
63 changes: 63 additions & 0 deletions .github/actions/build-worker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "Build Worker"
description: "Build worker"
inputs:
python-version:
description: "Python version to use"
required: true
target:
description: "Target that is the worker is built for"
required: true

runs:
using: composite
steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Build
shell: bash -euxo pipefail {0}
run: scripts/build-worker.sh ${{ inputs.target }}

- name: Package the worker (Linux)
if: runner.os == 'Linux'
shell: bash -euxo pipefail {0}
run: |
cd dist
mv fluxqueue-worker-${{ inputs.target }} fluxqueue-worker
tar -czvf fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-linux-x86_64.tar.gz fluxqueue-worker
rm fluxqueue-worker

- name: Package the worker (macOS)
if: runner.os == 'macOS'
shell: bash -euxo pipefail {0}
run: |
cd dist
mv fluxqueue-worker-${{ inputs.target }} fluxqueue-worker
zip fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-${{ inputs.target }}.zip fluxqueue-worker
rm fluxqueue-worker

- name: Package the worker (Windows)
if: runner.os == 'Windows'
shell: bash -euxo pipefail {0}
run: |
cd dist
mv fluxqueue-worker-${{ inputs.target }}.exe fluxqueue-worker.exe
zip fluxqueue-${{ github.ref_name }}-py${{ inputs.python-version }}-windows-x86_64.zip fluxqueue-worker.exe
rm fluxqueue-worker.exe

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: fluxqueue-worker-${{ inputs.target }}-py${{ inputs.python-version }}
path: dist/*
33 changes: 33 additions & 0 deletions .github/actions/tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Run Python and Rust Tests"
description: "Standardized test suite with strict shell"
inputs:
python-version:
description: "Python version to use"
required: true

runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: pip

- name: Install dependencies
shell: bash -euxo pipefail {0}
run: |
python -m pip install --upgrade pip
pip install -e .[tests]

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Run Tests
shell: bash -euxo pipefail {0}
run: |
pytest tests/
cargo test --workspace --locked
53 changes: 20 additions & 33 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,32 @@ permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
build:
if: github.repository_owner == 'ccxlv' && startsWith(github.event.release.tag_name, 'v')
name: ${{ matrix.os }} (Py ${{ matrix.python-version }})
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
- runner: ubuntu-22.04
target: s390x
- runner: ubuntu-22.04
target: ppc64le
python-version: ["3.11", "3.12", "3.13", "3.14"]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-15-intel
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Run Build Suite
uses: ./.github/actions/build-package
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
python-version: ${{ matrix.python-version }}
target: ${{ matrix.target }}

sdist:
if: github.repository_owner == 'ccxlv' && startsWith(github.event.release.tag_name, 'v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -67,13 +57,10 @@ jobs:
if: (github.repository_owner == 'ccxlv') && ${{ startsWith(github.event.release.tag_name, 'v') }}
name: Release
runs-on: ubuntu-latest
needs: [linux, sdist]
needs: [build, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- name: Install uv
Expand Down
76 changes: 35 additions & 41 deletions .github/workflows/release-worker.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,55 @@
name: Release Worker

on:
push:
tags:
- worker-v*

env:
LINUX_TARGET: x86_64-unknown-linux-gnu
workflow_run:
workflows: ["Tests"]
types: [completed]

jobs:
linux:
if: (github.repository_owner == 'ccxlv')
check-main:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Ensure tag is on main
run: |
git fetch origin main
git merge-base --is-ancestor "$GITHUB_SHA" origin/main

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
build:
if: >
github.repository_owner == 'ccxlv'
&& github.event.workflow_run.conclusion == 'success'
&& startsWith(github.event.workflow_run.head_branch, 'worker-v')
name: ${{ matrix.os }} (Py ${{ matrix.python-version }})
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-15-intel
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Run Build Suite
uses: ./.github/actions/build-worker
with:
python-version: ${{ matrix.python-version }}

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Build
run: scripts/build-worker.sh ${{ env.LINUX_TARGET }}

- name: Package the worker
run: |
cd dist
mv fluxqueue-worker-${{ env.LINUX_TARGET }} fluxqueue-worker
tar -czvf fluxqueue-${{ github.ref_name }}-py${{ matrix.python-version }}-linux-x86_64.tar.gz fluxqueue-worker
rm fluxqueue-worker

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: fluxqueue-worker-linux-py${{ matrix.python-version }}
path: dist/*
target: ${{ matrix.target }}

release:
if: (github.repository_owner == 'ccxlv')
needs: [linux]
if: >
github.repository_owner == 'ccxlv'
&& github.event.workflow_run.conclusion == 'success'
&& startsWith(github.event.workflow_run.head_branch, 'worker-v')
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -72,5 +66,5 @@ jobs:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: artifacts/**/*
draft: false
draft: true
prerelease: false
56 changes: 29 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
branches:
- main

env:
REDIS_VERSION: 8.4.0

jobs:
# TODO: Add another job that will determine which tests to run based on push types and the changes that were made.
check-style:
Expand All @@ -25,42 +22,47 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: pip install -e .[dev]
- run: scripts/check-prettier.sh
- run: ruff check .
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace -- -D warnings
- run: |
pip install -e .[dev]
scripts/check-prettier.sh
ruff check .
cargo fmt --all -- --check
cargo clippy --workspace -- -D warnings

tests-linux:
runs-on: ubuntu-latest
tests:
name: ${{ matrix.os }} (Py ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]

os: [ubuntu-latest, macos-15-intel, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Redis (Linux)
if: runner.os == 'Linux'
shell: bash -euxo pipefail {0}
run: |
sudo apt-get update
sudo apt-get install -y redis-server
sudo systemctl start redis-server

- run: python -m pip install --upgrade pip
- name: Install Redis (macOS)
if: runner.os == 'macOS'
shell: bash -euxo pipefail {0}
run: |
brew install redis
brew services start redis

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- run: pip install -e .[tests]

- run: pytest tests/
- run: cargo test --workspace --locked
- name: Run Test Suite
uses: ./.github/actions/tests
with:
python-version: ${{ matrix.python-version }}

tests-pass:
needs:
- check-style
- tests-linux
if: (github.repository_owner == 'ccxlv')
needs: [check-style, tests]
runs-on: ubuntu-latest
steps:
- run: echo "All tests passed ✅"
Loading