Fixing build workflow #2312
Workflow file for this run
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: continuous-integration | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- releases/* | |
pull_request: null | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
CONDA_ENV: .github/environment.yml | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
include: | |
- os: macos-latest | |
label: osx-64 | |
prefix: /Users/runner/miniconda3 | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3 | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout CCL repository | |
uses: actions/checkout@v4 | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
channels: conda-forge, defaults | |
channel-priority: strict | |
show-channel-urls: true | |
miniforge-version: latest | |
miniforge-variant: Mambaforge | |
- name: "macOS: set env variables" | |
if: matrix.label == 'osx-64' | |
run: | | |
#mamba install llvm-openmp | |
echo "DYLD_FALLBACK_LIBRARY_PATH=${CONDA_PREFIX}/lib" >> $GITHUB_ENV | |
SDKROOT=$(xcrun --sdk macosx --show-sdk-path) | |
echo "SDKROOT: ${SDKROOT}" | |
echo "SDKROOT=${SDKROOT}" >> $GITHUB_ENV | |
echo "CONDA_BUILD_SYSROOT=${SDKROOT}" >> $GITHUB_ENV | |
export CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" | |
export LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" | |
- name: Set current date as environment variable | |
run: echo "TODAY=$(date +'%Y.%m.%d')" >> $GITHUB_ENV | |
- name: Get cached environment | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ${{ matrix.prefix }} | |
key: | |
conda-py${{ matrix.py }}--${{ | |
matrix.os }}--${{ | |
hashFiles(env.CONDA_ENV) }}-${{ | |
hashFiles('setup.py') }}--${{ | |
env.TODAY }}-${{ | |
env.CACHE_NUMBER }} | |
- name: Install environment packages | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
export MAMBA_NO_BANNER=1 # hide mamba banner from output | |
mamba env update --file ${{ env.CONDA_ENV }} --prune | |
- name: Install classy | |
run: | | |
pip install 'setuptools' 'wheel' 'numpy>=1.19.0' 'Cython>=0.29.21,<3' # for classy | |
pip install --no-build-isolation classy==2.9.4 | |
- name: Install CCL | |
run: pip install -v -e . | |
- name: Unit tests | |
run: | | |
OMP_NUM_THREADS=2 pytest -vv pyccl --cov=pyccl --cov-report=lcov:lcov.info | |
- name: Benchmarks | |
run: | | |
OMP_NUM_THREADS=2 pytest -vv benchmarks --cov=pyccl --cov-report=lcov:lcov.info --cov-append | |
- name: Code coverage | |
if: matrix.label == 'linux-64' | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: lcov.info | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout CCL repository | |
uses: actions/checkout@v3 | |
- name: Lint | |
uses: py-actions/flake8@v2 | |
with: | |
args: "--config .flake8" | |
# Legacy step: uninstall homebrew (CI works without it). | |
# - name: "macOS: remove homebrew" | |
# if: matrix.label == 'osx-64' | |
# run: | | |
# curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh -o uninstall_homebrew.sh | |
# chmod u+x ./uninstall_homebrew.sh | |
# ./uninstall_homebrew.sh -f -q >& /dev/null | |
# rm -f uninstall_homebrew.sh |