Fixes to python test environment #361
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
# This uses actios: | |
# checkout: https://github.com/actions/checkout | |
# cache: https://github.com/actions/cache | |
# codecov-action: https://github.com/codecov/codecov-action | |
name: CI | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
# Nothing scheduled, just PRs and pushes | |
# schedule: | |
# - cron: "0 0 * * *" # Daily at midnight | |
jobs: | |
build: | |
name: Build (${{ matrix.python-version }} | ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
python-version: [ "3.9", "3.10" ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache conda | |
uses: actions/cache@v3 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-${{ matrix.python-version }}.yml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: test_env # Defined in ci/environment*.yml | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
python-version: ${{ matrix.python-version }} | |
environment-file: ci/environment-${{ matrix.python-version }}.yml | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Set up conda environment | |
shell: bash -l {0} | |
run: | | |
python -m pip install git+https://github.com/MITgcm/xmitgcm.git miepython petitRADTRANS==2.4.9 prt-phasecurve | |
python -m pip install -e . | |
conda list | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
py.test --cov=./ --cov-report=xml | |
- name: Upload code coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false | |
xarray-master: | |
name: Build xarray-master | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache conda | |
uses: actions/cache@v3 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-xarraymaster.yml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: test_env # Defined in ci/environment-*.yml | |
auto-update-conda: false | |
environment-file: ci/environment-xarraymaster.yml | |
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | |
- name: Set up conda environment | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade --upgrade-strategy only-if-needed git+https://github.com/MITgcm/xmitgcm.git miepython petitRADTRANS==2.4.9 prt-phasecurve | |
python -m pip install -e . | |
conda list | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
py.test --cov=./ --cov-report=xml | |
- name: Upload code coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false |