Fixing mac build and clang compilation on v4-prep #63
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: Tests (No Integration Tests) | |
# Test on all pushes, except when the push is literally just a tag (because we | |
# tag automatically via CI, and therefore there's no extra code in that push). | |
# Also, only test on pull requests into master/production. | |
on: | |
push: | |
tags-ignore: | |
- 'v*' | |
pull_request: | |
branches: | |
- 'v4-prep' | |
jobs: | |
tests: | |
if: "!contains(github.event.pull_request.labels.*.name, 'auto-pr')" | |
env: | |
ENV_NAME: tests | |
PYTHON: ${{ matrix.python-version }} | |
OS: ${{ matrix.os }} | |
CC: gcc | |
name: Testing | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.10", "3.11", "3.12"] | |
defaults: | |
run: | |
# Adding -l {0} ensures conda can be found properly in each step | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@master | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Print head git commit message | |
id: get_head_commit_message | |
run: echo "commit_message=$(git show -s --format=%s)" >> "$GITHUB_ENV" | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
# auto-update-conda: true | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
python-version: ${{ matrix.python-version }} | |
environment-file: ci/${{ matrix.os }}-env.yml | |
activate-environment: tests | |
channel-priority: true | |
- name: Conda Info | |
run: | | |
conda info -a | |
conda list | |
conda config --show-sources | |
conda config --show | |
printenv | sort | |
- name: Make it a Debug Run | |
if: "contains(env.commit_message, 'ci debug')" | |
run: | | |
echo "log_level=ULTRA_DEBUG" >> $GITHUB_ENV | |
echo "extra_pytest_args=-s --log-level-21=DEBUG" >> $GITHUB_ENV | |
- name: Make it a Normal Run | |
if: "!contains(env.commit_message, 'ci debug')" | |
run: | | |
echo "log_level=INFO" >> $GITHUB_ENV | |
echo "extra_pytest_args=" >> $GITHUB_ENV | |
- name: Get C Libraries Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get install libfftw3-dev | |
sudo apt-get install libgsl0-dev | |
# - name: Setup GCC | |
# uses: Dup4/actions-setup-gcc@v1 | |
# with: | |
# version: latest | |
- name: Install 21cmFAST Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
LOG_LEVEL=${{ env.log_level }} pip install . | |
- name: Install 21cmFAST MacOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
LOG_LEVEL=${{ env.log_level }} CFLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" pip install . | |
- name: Run Tests | |
run: | | |
python -m pytest -n 2 -l ${{ env.extra_pytest_args }} --ignore tests/test_integration_features.py --cov=py21cmfast --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25 --plots=testplots | |
- name: Archive Integration Test Plots | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: integration-test-plots-${{ matrix.os }}-${{ matrix.python-version }} | |
path: | | |
testplots/*.pdf | |
- uses: codecov/codecov-action@v3 | |
if: matrix.os == 'ubuntu-latest' && success() && !contains(github.event.pull_request.labels.*.name, 'auto-pr') | |
with: | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} |