Try msmpi on windows, having intelmpi issues. #4
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: wheels and conda | |
on: | |
pull_request: | |
push: | |
# workflow_dispatch: | |
# release: | |
# types: | |
# - published | |
# pull_request: | |
# paths: | |
# - .github/workflows/cd.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# Many color libraries just need this to be set to any value, but at least | |
# one distinguishes color depth, where "3" -> "256-bit color". | |
FORCE_COLOR: 3 | |
jobs: | |
make_sdist: | |
name: Make 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 | |
build_wheels: | |
name: Wheel on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Use intel mpi on windows | |
- uses: mpi4py/setup-mpi@v1 | |
if: ${{ contains(matrix.os, 'windows') }} | |
with: | |
mpi: msmpi | |
# Else, use the default for the OS and setup-mpi action | |
- uses: mpi4py/setup-mpi@v1 | |
if: ${{ !contains(matrix.os, 'windows') }} | |
- name: Checkout LLVM on macOS | |
if: runner.os == 'macOS' | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: release/18.x | |
path: llvm-project | |
- name: Build OpenMP on macOS | |
if: runner.os == 'macOS' | |
env: | |
MACOSX_DEPLOYMENT_TARGET: "10.9" | |
working-directory: llvm-project | |
run: | | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$(brew --prefix) \ | |
-DCMAKE_INSTALL_NAME_DIR=$(brew --prefix)/lib \ | |
-DCMAKE_C_COMPILER=clang \ | |
-DCMAKE_CXX_COMPILER=clang++ \ | |
-DLIBOMP_INSTALL_ALIASES=OFF \ | |
-S openmp \ | |
-B build | |
cmake --build build --parallel | |
cmake --install build | |
- uses: actions/setup-python@v5 | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel | |
- 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_conda: | |
name: Conda on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-13, macos-latest ] | |
python-version: [ '3.9', '3.10', '3.11' ] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Can't figure out a way to get the package version from setuptools_scm inside the conda build | |
# We need to install setuptools_scm, call it as a module, and store the version in an environment variable | |
- name: Run setuptools_scm to get package version and store in environment variable BRAINIAK_VERSION (Linux\Mac) | |
if: ${{ !contains(matrix.os, 'windows') }} | |
run: | | |
python -m pip install setuptools_scm | |
export BRAINIAK_VERSION=$(python -m setuptools_scm) | |
echo "BRAINIAK_VERSION=${BRAINIAK_VERSION}" >> "$GITHUB_ENV" | |
- name: Run setuptools_scm to get package version and store in environment variable BRAINIAK_VERSION (Windows) | |
if: ${{ contains(matrix.os, 'windows') }} | |
run: | | |
python -m pip install setuptools_scm | |
set BRAINIAK_VERSION=$(python -m setuptools_scm) | |
echo "BRAINIAK_VERSION=${BRAINIAK_VERSION}" >> "$GITHUB_ENV" | |
- name: Setup micromamba and boa | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: test-env | |
create-args: >- | |
python=${{ matrix.python-version }} | |
conda-forge::conda-build | |
boa | |
init-shell: >- | |
bash | |
powershell | |
- name: Build and test package | |
id: build-package | |
run: | | |
conda config --add channels conda-forge | |
conda config --set channel_priority strict | |
conda mambabuild --output-folder=conda-package .conda/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: conda-package-${{ matrix.os }}-${{ matrix.python-version }} | |
path: conda-package | |
publish_pypi: | |
name: Publish to PyPI | |
needs: [ build_wheels, build_conda, make_sdist ] | |
environment: | |
name: pypi | |
url: https://pypi.org/p/brainiak | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: List files in artifact(s) | |
run: ls -l dist | |
# - uses: pypa/gh-action-pypi-publish@release/v1 | |
publish_conda: | |
name: Publish to Anaconda | |
needs: [ build_conda, build_wheels, make_sdist ] | |
environment: anaconda | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: conda-package-* | |
path: conda-packages | |
merge-multiple: false | |
- name: List files in artifact | |
run: find conda-packages -type f -name "*.tar.bz2" | |
# - name: Upload to Anaconda | |
# run: | | |
# export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }} | |
# find conda-packages -type f -name "*.tar.bz2" -exec echo "anaconda upload {}" \; | |