Skip to content

[pypi] revert macos runner to macos13 for x64 (macos14 unavailable) #16

[pypi] revert macos runner to macos13 for x64 (macos14 unavailable)

[pypi] revert macos runner to macos13 for x64 (macos14 unavailable) #16

Workflow file for this run

# Copyright (c) 2019-2020 Luca Cappa
# Released under the term specified in file LICENSE.txt
# SPDX short identifier: MIT
name: abcranger-build
on: [push]
env:
VCPKG_REVISION: "2024.04.26"
PMM_VERSION: "2.1.0"
MKL_VERSION: "intel-oneapi-mkl-devel-2024.1"
jobs:
create_release:
if: ${{ !contains(toJSON(github.event.commits.*.message), '[skip-ci]') }}
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.new_release.outputs.upload_url }}
new_tag: ${{ steps.bump_version.outputs.new_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Bump version and push tag
id: bump_version
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
INITIAL_VERSION: 1.2.9
DEFAULT_BUMP: patch
- name: Create release
id: new_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_tag }}
release_name: Release ${{ steps.bump_version.outputs.new_tag }}
draft: true
prerelease: true
job:
name: diyabc-${{ matrix.os }}
needs: create_release
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
arch: [x64]
include:
- os: windows-latest
shortos: windows
cmakeargs: -DTEST:BOOL=FALSE -DUSE_MKL:BOOL=FALSE -DMAKE_STATIC_EXE:BOOL=TRUE -DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja
- os: ubuntu-latest
shortos: linux
cmakeargs: "-DTEST:BOOL=FALSE -DUSE_MKL:BOOL=TRUE -DMAKE_STATIC_EXE:BOOL=TRUE -DLAPACK_ROOT:STRING=/opt/intel/oneapi/mkl/latest/lib '-DLAPACK_LIBRARIES:STRING=-Wl,--start-group /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_intel_lp64.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_tbb_thread.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a -Wl,--end-group;pthread;m;dl' '-DBLAS_LIBRARIES:STRING=-Wl,--start-group /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_intel_lp64.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_tbb_thread.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a -Wl,--end-group;pthread;m;dl' -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja"
- os: macos-13
shortos: macos-x64
cmakeargs: -DTEST:BOOL=FALSE -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DVCPKG_TARGET_TRIPLET:STRING=x64-osx -DUSE_MKL:BOOL=FALSE -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja
- os: macos-latest
shortos: macos-arm64
cmakeargs: -DTEST:BOOL=FALSE -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 -DVCPKG_TARGET_TRIPLET:STRING=arm64-osx -DUSE_MKL:BOOL=FALSE -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.4'
- uses: lukka/get-cmake@latest
- name: Get R version
run: echo "R_VERSION=$(Rscript -e 'cat(as.character(getRversion()))')" >> $GITHUB_OUTPUT
id: get-r-version
- name: restore/cache vcpkg/ubuntu
uses: actions/cache@v2
with:
path: /home/runner/.local/share/pmm
key: ubuntu-vcpkg-${{ env.PMM_VERSION }}-${{ env.VCPKG_REVISION }}
if: matrix.os == 'ubuntu-latest'
- name: restore/cache vcpkg/macos
uses: actions/cache@v2
with:
path: /Users/runner/.local/share/pmm
key: macos-vcpkg5-${{ matrix.shortos }}-${{ env.PMM_VERSION }}-${{ env.VCPKG_REVISION }}
if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
- name: restore/cache vcpkg/windows
uses: actions/cache@v2
with:
path: C:/Users/runneradmin/AppData/Local/pmm
key: windows-vcpkg2-${{ env.PMM_VERSION }}-${{ env.VCPKG_REVISION }}
if: matrix.os == 'windows-latest'
- name: restore/cache mkl
uses: actions/cache@v2
with:
path: /opt/intel
key: ${{ env.MKL_VERSION }}
if: matrix.os == 'ubuntu-latest'
- name: setup x64-linux
run: |
if [ ! -d /opt/intel/lib/intel64 ]; then
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install -y ${{ env.MKL_VERSION }}
fi
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV
if: matrix.os == 'ubuntu-latest'
- name: setup MacOS
run: |
brew install ninja
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
if [ "${{ matrix.shortos }}" == "macos-arm64" ]; then
echo "OSARCH=arm" >> $GITHUB_ENV
else
echo "OSARCH=x86" >> $GITHUB_ENV
fi
# echo "CC=gcc-14" >> $GITHUB_ENV
# echo "CXX=g++-14" >> $GITHUB_ENV
# echo "CXXFLAGS=-static-libstdc++ -static-libgcc" >> $GITHUB_ENV
if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
- name: Configure MSVC console (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: setup windows
run: |
# Set these env vars so cmake picks the correct compiler
echo "CXX=cl.exe" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "CC=cl.exe" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
if: matrix.os == 'windows-latest'
# - uses: actions/setup-python@v5
# name: Install Python
# if: matrix.os != 'ubuntu-latest'
- name: Run CMake+Ninja
uses: lukka/run-cmake@v3
id: runcmake_cmd
with:
cmakeGenerator: 'Ninja'
cmakeListsOrSettingsJson: 'CMakeListsTxtAdvanced'
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildWithCMakeArgs: '--target abcranger -- -v'
buildWithCMake: true
buildDirectory: ${{ runner.workspace }}/b/ninja/
cmakeAppendedArgs: '${{ matrix.cmakeargs }}'
- name: Minimal tests
run: |
python -m pip install pytest
pytest -s test/test.py --path ${{ runner.workspace }}/b/ninja/abcranger
- name: Failure standalone
if: failure()
uses: author/action-rollback@stable
with:
id: ${{ needs.create_release.id }}
tag: ${{ needs.create_release.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload windows binary
# uses: actions/upload-artifact@v2
# with:
# name: diyabc-${{ matrix.os }}
# path: ${{ runner.workspace }}/b/ninja/install/
# if: contains( matrix.os, 'windows')
# - name: Upload binary
# uses: actions/upload-artifact@v2
# with:
# name: diyabc-${{ matrix.os }}
# path: ${{ runner.workspace }}/b/ninja/install/general
# if: "! contains( matrix.os, 'windows')"
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Upload Release Asset Unix
id: upload-release-asset-unix
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ runner.workspace }}/b/ninja/abcranger
asset_name: abcranger-${{ matrix.shortos }}-${{ needs.create_release.outputs.new_tag }}
asset_content_type: application/octet-stream
if: matrix.os != 'windows-latest'
- name: Upload Release Asset Windows
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ runner.workspace }}/b/ninja/abcranger.exe
asset_name: abcranger-${{ matrix.shortos }}-${{ needs.create_release.outputs.new_tag }}.exe
asset_content_type: application/octet-stream
if: matrix.os == 'windows-latest'
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.0
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
needs: [job]
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
name: Install Python
- name: restore/cache vcpkg/ubuntu
uses: actions/cache@v2
with:
path: /home/runner/.local/share/pmm
key: ubuntu-vcpkg-${{ env.VCPKG_REVISION }}
- name: Build sdist
run: |
pip install setuptools cmake ninja cmaketools wheel
python setup.py sdist
- uses: actions/upload-artifact@v2
if: failure()
with:
path: dist/*.tar.gz
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [job, build_sdist]
if: ${{ contains(toJSON(github.event.commits.*.message), '[pypi]') }}
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
# repository_url: https://test.pypi.org/legacy/