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
10 changes: 6 additions & 4 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ jobs:
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push pyomp container
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
file: buildscripts/containers/Dockerfile
push: true
provenance: false
tags: ghcr.io/python-for-hpc/pyomp:latest
tags: |
ghcr.io/python-for-hpc/pyomp:latest
ghcr.io/python-for-hpc/pyomp:${{ github.event.release.tag_name }}
76 changes: 0 additions & 76 deletions .github/workflows/build-upload-conda-base.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/build-upload-conda-test.yml

This file was deleted.

75 changes: 69 additions & 6 deletions .github/workflows/build-upload-conda.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,81 @@
name: Deploy conda pkgs (main)
name: conda

on:
release:
types: [published]
pull_request:
paths:
- "buildscripts/conda-recipes/**"
- ".github/workflows/build-upload-conda.yml"
- "src/**"
- setup.py
- MANIFEST.in
- pyproject.toml
workflow_dispatch:

jobs:
# Job to deploy pyomp conda matrixed on os and python version.
deploy-conda:
uses: ./.github/workflows/build-upload-conda-base.yml
with:
label: main
env: .github/workflows/envs/env.yml
secrets: inherit
name: ${{ matrix.os }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
env:
CONDA_LABEL: dev
strategy:
matrix:
# TODO: Add windows.
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Determine conda label
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "CONDA_LABEL=dev" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "release" && "${{ github.event.release.prerelease }}" == "true" ]]; then
echo "CONDA_LABEL=test" >> $GITHUB_ENV
else
echo "CONDA_LABEL=main" >> $GITHUB_ENV
fi

- uses: actions/checkout@v4
# Checkout the repo with history to get the commit hash for the build
# string.
with:
fetch-depth: 0

- name: Create and activate conda env
uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.10"
auto-update-conda: false
show-channel-urls: true

- name: Build and upload pyomp
# This ensures conda env is active.
shell: bash -l {0}
run: |
# Setup the anaconda environment.
conda remove --name base conda-anaconda-telemetry
conda install -q -y -c conda-forge conda-build conda-verify anaconda-client
conda config --set anaconda_upload no

# Build the package.
conda build \
-c conda-forge \
--python ${{ matrix.python-version }} \
buildscripts/conda-recipes/pyomp

# Get the output file path.
OUTPUT=$(conda build -c conda-forge --output \
--python ${{ matrix.python-version }} \
buildscripts/conda-recipes/pyomp)

# Upload the package.
anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload \
--user python-for-hpc --label ${{ env.CONDA_LABEL}} \
--force "$OUTPUT"

deploy-containers:
needs: deploy-conda
if: github.event_name == 'release' && !github.event.release.prerelease
uses: ./.github/workflows/build-containers.yml
secrets: inherit
150 changes: 150 additions & 0 deletions .github/workflows/build-upload-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: pypi

on:
release:
types: [published]
pull_request:
paths:
- "buildscripts/cibuildwheel/**"
- ".github/workflows/build-upload-wheels.yml"
- "src/**"
- setup.py
- MANIFEST.in
- pyproject.toml
workflow_dispatch:

jobs:
# Always runs: Build wheels for all platforms and upload artifacts.
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# TODO: Add windows.
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@v4
# Checkout the repo with history to get the commit hash for the build
# string.
with:
fetch-depth: 0

# Used to host cibuildwheel.
- uses: actions/setup-python@v5

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.1.4

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

# Always runs: Test wheels across OS/Python/Numba matrix.
test-wheels:
needs: build-wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
python-version: ['3.9', '3.10', '3.11', '3.12']
numba-version: ['0.57.0', '0.57.1', '0.58.0', '0.58.1', '0.59.0', '0.59.1', '0.60.0']
exclude:
# Known incompatibilities based on numba's official support
# Numba 0.57 supports Python 3.8-3.11
- python-version: '3.12'
numba-version: '0.57.0'
- python-version: '3.12'
numba-version: '0.57.1'

# Numba 0.58 supports Python 3.8-3.11
- python-version: '3.12'
numba-version: '0.58.0'
- python-version: '3.12'
numba-version: '0.58.1'
steps:
- name: Download built wheels
uses: actions/download-artifact@v5
with:
pattern: cibw-*
path: dist
merge-multiple: true

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

- name: Install and test wheel
run: |
python -m pip install --upgrade pip
python -m pip install "numba==${{ matrix.numba-version }}" lark cffi setuptools
python -m pip install --pre --no-deps --no-index --find-links dist/ pyomp

# Verify the numba version.
python -c "import numba; assert numba.__version__ == '${{ matrix.numba-version }}'"

# Run host OpenMP tests.
TEST_DEVICES=0 RUN_TARGET=0 python -m numba.runtests -v -- numba.openmp.tests.test_openmp

# Run device (cpu target) OpenMP tests.
OMP_TARGET_OFFLOAD=mandatory TEST_DEVICES=1 RUN_TARGET=1 \
python -m numba.runtests -v -- numba.openmp.tests.test_openmp.TestOpenmpTarget

# Only on pre-release: Publish to TestPyPI for testing.
publish-testpypi:
needs: [build-wheels, test-wheels, build-sdist]
if: github.event.release.prerelease
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish testpypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true

# Only on full release: Publish to production PyPI.
publish-pypi:
needs: [build-wheels, test-wheels, build-sdist]
if: github.event_name == 'release' && !github.event.release.prerelease
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
8 changes: 0 additions & 8 deletions .github/workflows/envs/env-test.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .github/workflows/envs/env.yml

This file was deleted.

Loading
Loading