Simplify conda environments #256
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: CI/CD Build Workflow | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
workflow_dispatch: | |
env: | |
CANCEL_OTHERS: true | |
PATHS_IGNORE: '["**/README.md", "**/docs/**", "**/examples/**", "**/misc/**", "**/.vscode/**"]' | |
jobs: | |
build: | |
name: Build (Python ${{ matrix.python-version }}) | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 10 | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
cancel_others: ${{ env.CANCEL_OTHERS }} | |
paths_ignore: ${{ env.PATHS_IGNORE }} | |
do_not_skip: '["push", "workflow_dispatch"]' | |
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
uses: actions/checkout@v3 | |
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
name: Cache Conda | |
uses: actions/cache@v3 | |
env: | |
# Increase this value to reset cache if conda-env/ci.yml has not changed in the workflow | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }} | |
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
name: Set up Conda Environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: "e3sm_to_cmip_ci" | |
environment-file: conda-env/ci.yml | |
channel-priority: strict | |
auto-update-conda: true | |
# IMPORTANT: This needs to be set for caching to work properly! | |
use-only-tar-bz2: true | |
python-version: ${{ matrix.python-version }} | |
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
name: Install e3sm_to_cmip | |
run: | | |
python -m pip install . | |
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
name: Run Tests | |
run: pytest | |
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
name: Upload Coverage Report | |
uses: codecov/codecov-action@v3 | |
with: | |
file: "tests_coverage_reports/coverage.xml" | |
fail_ci_if_error: true |