Skip to content

Injection

Injection #2

Workflow file for this run

name: 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:
- 'master'
- 'production'
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.7, 3.8, 3.9, "3.10"]
defaults:
run:
# Adding -l {0} ensures conda can be found properly in each step
shell: bash -l {0}
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.1.1
with:
# auto-update-conda: true
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
environment-file: ci/${{ matrix.os }}-env.yml
activate-environment: tests
channel-priority: strict
use-only-tar-bz2: true
- name: Conda Info
run: |
conda info -a
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Logging
run: |
echo ${{ github.event.commits }}
echo ${{ github.event.commits[0] }}
- name: Make it a Debug Run
if: "contains(github.event.payload.commits[0].message, 'ci debug')"
run: |
echo "log_level=ULTRA_DEBUG" >> $GITHUB_ENV
echo "extra_pytest_args='-s -k test_perturb_field_data --log-level-21=DEBUG'" >> $GITHUB_ENV
- name: 'Log Commit Message'
run: echo ${{ github.event.commits[0].message }}
- name: Make it a Normal Run
if: "!contains(github.event.commits[0].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: 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 -l --cov=py21cmfast --cov-config=.coveragerc -vv --cov-report xml:./coverage.xml --durations=25 ${{ env.extra_pytest_args }}
- uses: codecov/codecov-action@v2
if: matrix.os == 'ubuntu-latest' && success() && !contains(github.event.pull_request.labels.*.name, 'auto-pr')
with:
fail_ci_if_error: true
verbose: true
# CC=$HOME/miniconda/envs/$ENV_NAME/bin/gcc