Skip to content

TokaMaker+TORAX updates (#318) #16

TokaMaker+TORAX updates (#318)

TokaMaker+TORAX updates (#318) #16

Workflow file for this run

name: CD Build and Deployment
on:
push:
branches:
- main
- pypi_release
pull_request:
paths:
- .github/workflows/cd_combined.yaml
- src/utilities/build_libs.py
- src/python/pyproject.toml.in
- src/python/make_package.sh.in
concurrency:
group: cd_comb-${{ github.ref }}
cancel-in-progress: ${{ contains(github.ref, 'pull/')}}
jobs:
linux-build:
if: github.repository == 'OpenFUSIONToolkit/OpenFUSIONToolkit'
name: ${{ format('Linux CD ({0})', matrix.config.name) }}
runs-on: ${{ matrix.config.os }}
container: ${{ matrix.config.image }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
config:
- {
name: "Linux-x86_64",
os: ubuntu-24.04,
image: "quay.io/pypa/manylinux_2_28_x86_64",
python: "/opt/python/cp314-cp314/bin/python"
}
- {
name: "Linux-arm64",
os: ubuntu-24.04-arm,
image: "quay.io/pypa/manylinux_2_28_aarch64",
python: "/opt/python/cp314-cp314/bin/python"
}
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install prerequisites
run: |
dnf -y update
dnf -y --enablerepo=powertools install git zlib-devel m4 make cmake patch perl
dnf clean all
rm -rf /var/cache/yum
${{ matrix.config.python }} -m venv ${{ github.workspace }}/oft_venv
echo "source ${{ github.workspace }}/oft_venv/bin/activate" > ${{ github.workspace }}/setup_env.sh
source ${{ github.workspace }}/setup_env.sh
python -m pip install -U pip
python -m pip install jupyter nbconvert build wheel
- name: Mark repository as safe
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Create build directory
run: mkdir builds
- name: Build external (Nightly)
if: github.ref != 'refs/heads/pypi_release'
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/setup_env.sh
python ../src/utilities/build_libs.py --no_dl_progress --nthread=4 --oblas_dynamic_arch --build_umfpack=1 --build_arpack=1 --oft_package
- name: Build external (Release)
if: github.event_name == 'push' && github.ref == 'refs/heads/pypi_release'
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/setup_env.sh
python ../src/utilities/build_libs.py --no_dl_progress --nthread=4 --oblas_dynamic_arch --build_umfpack=1 --build_arpack=1 --oft_package --oft_package_release
- name: Upload library failure log
uses: actions/upload-artifact@v6
if: failure()
with:
name: Library failure log
path: builds/build/build_error.log
- name: Remove external build directory
shell: bash
working-directory: builds
run: rm -rf build
- name: Configure OFT
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/setup_env.sh
bash config_cmake.sh
- name: Build OFT
shell: bash
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/setup_env.sh
make
- name: Install OFT
shell: bash
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/setup_env.sh
make install
- name: Package OFT
shell: bash
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/setup_env.sh
make package
- name: Upload binary artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.config.name }}-${{ github.sha }}
path: builds/build_release/OpenFUSIONToolkit_*
overwrite: true
- name: Build Python Wheels
shell: bash
working-directory: builds/install_release/python
run: |
source ${{ github.workspace }}/setup_env.sh
bash make_package.sh
- name: Upload PYPI artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.config.name }}-wheel
path: builds/install_release/python/dist/*.whl
overwrite: true
retention-days: 2
macos-build:
if: github.repository == 'OpenFUSIONToolkit/OpenFUSIONToolkit'
name: ${{ format('macOS CD ({0})', matrix.config.name) }}
runs-on: ${{ matrix.config.os }}
timeout-minutes: 45
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
FC: ${{ matrix.config.fc }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.deployment_target }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "macOS-x86_64-Rosetta",
os: macos-15-intel,
cc: "gcc-15", cxx: "g++-15", fc: "gfortran-15",
python: "python3.13",
xcode_path: "/Applications/Xcode_16.4.app/Contents/Developer",
build_libs_flags: "--nthread=4 --build_umfpack=1 --oblas_no_avx",
cache_key: "openmp_noavx",
deployment_target: "15.0"
}
- {
name: "macOS-arm64",
os: macos-14,
cc: "gcc-15", cxx: "g++-15", fc: "gfortran-15",
python: "python3.12",
xcode_path: "/Applications/Xcode_16.2.app/Contents/Developer",
build_libs_flags: "--nthread=3 --build_umfpack=1",
cache_key: "openmp",
deployment_target: "14.0"
}
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get OS version
run: |
sw_vers -productVersion
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
sudo xcode-select -s ${{ matrix.config.xcode_path }}
xcode-select -p
- name: Install prerequisites
run: |
${{ matrix.config.python }} -m venv ${{ github.workspace }}/oft_venv
echo "source ${{ github.workspace }}/oft_venv/bin/activate" > ${{ github.workspace }}/setup_env.sh
source ${{ github.workspace }}/setup_env.sh
python -m pip install build wheel jupyter nbconvert
- name: Check compilers
run: |
source ${{ github.workspace }}/setup_env.sh
$CC --version
$CXX --version
$FC --version
- name: Create build directory
run: mkdir builds
- name: Build external (Nightly)
if: github.ref != 'refs/heads/pypi_release'
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/setup_env.sh
python ../src/utilities/build_libs.py --no_dl_progress --build_arpack=1 --oft_package ${{ matrix.config.build_libs_flags }}
- name: Build external (Release)
if: github.event_name == 'push' && github.ref == 'refs/heads/pypi_release'
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/setup_env.sh
python ../src/utilities/build_libs.py --no_dl_progress --build_arpack=1 --oft_package --oft_package_release ${{ matrix.config.build_libs_flags }}
- name: Upload library failure log
uses: actions/upload-artifact@v6
if: failure()
with:
name: Library failure log
path: builds/build/build_error.log
- name: Remove external build directory
shell: bash
working-directory: builds
run: rm -rf build
- name: Configure OFT
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/setup_env.sh
bash config_cmake.sh
- name: Build OFT
shell: bash
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/setup_env.sh
make
- name: Install OFT
shell: bash
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/setup_env.sh
make install
- name: Package OFT
shell: bash
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/setup_env.sh
make package
- name: Upload binary artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.config.name }}-${{ github.sha }}
path: builds/build_release/OpenFUSIONToolkit_*
overwrite: true
- name: Build Python Wheels
shell: bash
working-directory: builds/install_release/python
run: |
source ${{ github.workspace }}/setup_env.sh
bash make_package.sh
- name: Upload PYPI artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.config.name }}-wheel
path: builds/install_release/python/dist/*.whl
overwrite: true
retention-days: 2
publish-to-testpypi:
name: Publish Python distribution to TestPyPI
needs:
- macos-build
- linux-build
if: (github.event_name == 'push') && (github.repository == 'OpenFUSIONToolkit/OpenFUSIONToolkit')
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/openfusiontoolkit
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v6
with:
path: staging/
- name: Combine all dists into one directory
run: |
ls -l staging/
ls -l staging/*/
mkdir dist
cp staging/*/*.whl dist/
ls -l dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-to-pypi:
name: Publish Python distribution to PyPI
needs:
- macos-build
- linux-build
if: (github.event_name == 'push') && (github.ref == 'refs/heads/pypi_release') && (github.repository == 'OpenFUSIONToolkit/OpenFUSIONToolkit')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/openfusiontoolkit
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v6
with:
path: staging/
- name: Combine all dists into one directory
run: |
ls -l staging/
ls -l staging/*/
mkdir dist
cp staging/*/*.whl dist/
ls -l dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1