update github action workflow #506
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
name: Build esig | |
on: | |
push: | |
branches: | |
- release | |
- develop | |
paths-ignore: | |
- 'examples/**' | |
- 'doc/**' | |
- README.md | |
pull_request: | |
branches: | |
- develop | |
types: [ opened, reopened, synchronize] | |
env: | |
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ | |
windows-2019, | |
macos-13, | |
macos-14, | |
ubuntu-latest | |
] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout recombine | |
id: clone_recombine | |
if: runner.os != 'macOs' | |
uses: actions/checkout@v4 | |
with: | |
repository: datasig-ac-uk/recombine | |
path: build/recombine | |
- name: Setup gha caching for vcpkg | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
# https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md | |
- name: Setup submodule vcpkg | |
shell: bash | |
if: runner.os != 'Linux' | |
run: | | |
rm -rf "$VCPKG_INSTALLATION_ROOT" | |
./build/vcpkg/bootstrap-vcpkg.sh | |
# In the future, this can be replaced by a download of the binary | |
# - name: Get recombine | |
# id: clone_recombine | |
# run: | | |
# bash ./build/git-preamble.sh | |
# continue-on-error: true | |
# env: | |
# RECOMBINE_USER: rolyp | |
# RECOMBINE_TOKEN: ${{ secrets.recombine_login }} | |
# - name: MKL Cache | |
# id: mkl-cache-get-windows | |
# if: runner.os == 'Windows' | |
# uses: pat-s/[email protected] | |
# with: | |
# key: ${{ runner.os }}-oneapi-dir | |
# path: | | |
# !C:/Program Files (x86)/Intel/oneAPI/Installer/** | |
# C:/Program Files (x86)/Intel/oneAPI | |
# !C:/Program Files (x86)/Intel/oneAPI/conda_channel/** | |
- name: Get MKL | |
id: get-mkl-windows | |
if: runner.os == 'Windows' # && steps.mkl-cache-get-windows.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
curl -v -o /d/a/intel-mkl-installer.exe "$URL" | |
/d/a/intel-mkl-installer.exe -s -x -f /d/a/webimage_extracted --log extract.log | |
rm -v /d/a/intel-mkl-installer.exe | |
/d/a/webimage_extracted/bootstrapper.exe -s --action install --config ./build/oneapi-install-config-x64-windows.ini --log-dir=. | |
curl -v -o /d/a/intel-mkl-installer-x86.exe "$URL32" | |
/d/a/intel-mkl-installer-x86.exe -s -x -f /d/a/webimage_extracted_x86 --log extractx86.log | |
rm -v /d/a/intel-mkl-installer-x86.exe | |
/d/a/webimage_extracted_x86/bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=. --ignore-errors | |
env: | |
URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18599/w_BaseKit_p_2022.1.3.210.exe | |
URL32: https://registrationcenter-download.intel.com/akdlm/irc_nas/18599/w_BaseKit_32bit_p_2022.1.3.44.exe | |
- name: Set MKL vars | |
if: runner.os == 'Windows' | |
shell: bash | |
# run: | | |
# @call "C:/Program Files (x86)/Intel/oneAPI/setvars.bat" | |
# set | |
# echo "MKLROOT=%MKLROOT%" >> %GITHUB_ENV% | |
run: | | |
echo "CMAKE_PREFIX_PATH=C:/Program Files (x86)/Intel/oneAPI/mkl/2022.0.3" >> $GITHUB_ENV | |
echo "ONEAPI_SCRIPT=C:/Progam Files (x86)/Intel/oneAPI/setvars.bat" >> $GITHUB_ENV | |
# - name: cache-boost-windows | |
# id: cache-boost-windows | |
# uses: pat-s/[email protected] | |
# if: runner.os == 'Windows' | |
# with: | |
# path: C:/vcpkg/packages | |
# key: win-boost-packages | |
- name: Get Boost Windows | |
id: boost-windows | |
shell: bash | |
run: | | |
build/vcpkg/vcpkg install boost-system boost-thread boost-container boost-multiprecision --triplet x86-windows | |
build/vcpkg/vcpkg install boost-system boost-thread boost-container boost-multiprecision --triplet x64-windows | |
if: runner.os == 'Windows' | |
env: | |
VCPKG_KEEP_ENV_VARS: "MKLROOT" | |
- name: Get Boost macos | |
id: boost-macos | |
run: | | |
find /usr/lib -name omp | |
brew install boost | |
brew install ninja | |
if: runner.os == 'macOS' | |
# - name: Build Recombine | |
# id: build-recombine | |
# if: steps.clone_recombine.outcome == 'success' && runner.os != 'Linux' | |
# run: | | |
# source ${{ env.oneapi_script }} | |
# pushd build/recombine | |
# cmake -S . -B recombine_build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../esig | |
# cmake --install recombine_build | |
# popd | |
# echo "recombine_prefix=$(pwd)/esig" >> $GITHUB_ENV | |
# env: | |
# MKLROOT: ${{ env.MKLROOT }} | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
VERBOSE: 1 | |
BOOST_ROOT: ${{ env.boost_root }} | |
- name: Cache outputs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install Build deps | |
run: python -m pip install wheel setuptools build | |
# - name: Check version updated | |
# - name: Copy manifest into main dir | |
# run: cp build/MANIFEST.in . | |
- name: Build source distribution | |
run: python -m build --sdist . | |
- name: Cache sdist | |
uses: actions/upload-artifact@v2 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
# - name: Create GitHub release | |
# run: | | |
# gh release create "v$(<esig/VERSION)" ./dist/*.whl | |
publish: | |
runs-on: ubuntu-latest | |
needs: [ build_wheels, build_sdist ] | |
if: github.ref == 'refs/heads/release' | |
steps: | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install Build deps | |
run: python -m pip install setuptools wheel build twine | |
- name: Retrieve sdist | |
uses: actions/download-artifact@v4 | |
with: | |
name: sdist | |
path: dist | |
- name: Retrieve wheels | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish | |
run: | | |
python -m twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.pypi_password }} |