CI #784
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 | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
schedule: | |
- cron: "0 0 * * *" # Daily “At 00:00” | |
workflow_dispatch: # allows you to trigger manually | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build (${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 10 # Fetch all history for all branches and tags. | |
- name: Set environment variables | |
run: | | |
echo "CONDA_ENV_FILE=ci/environment.yml" >> $GITHUB_ENV | |
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | |
- name: Setup micromamba | |
uses: mamba-org/provision-with-micromamba@v15 | |
with: | |
environment-file: ${{ env.CONDA_ENV_FILE }} | |
environment-name: xarray-tests | |
cache-env: true | |
cache-env-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{hashFiles(env.CONDA_ENV_FILE)}}" | |
extra-specs: | | |
python=${{matrix.python-version}} | |
conda | |
# We only want to install this on one run, because otherwise we'll have | |
# duplicate annotations. | |
- name: Install error reporter | |
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.10' | |
run: | | |
python -m pip install pytest-github-actions-annotate-failures | |
- name: Set up conda environment | |
shell: bash -l {0} | |
run: | | |
python -m pip install -e .[dev] | |
conda list | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
pytest |