Skip to content

CI

CI #284

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
schedule:
- cron: '0 0 * * *' # Daily “At 00:00”
workflow_dispatch: # allows you to trigger manually
jobs:
build:
name: Build (${{ matrix.python-version }}, ${{ matrix.os }})
if: github.repository == 'openradar/cmweather'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set environment variables
run: |
if [[ ${{ matrix.os }} == windows* ]] ;
then
echo "CONDA_ENV_FILE=ci/environment-windows.yml" >> $GITHUB_ENV
else
echo "CONDA_ENV_FILE=ci/environment.yml" >> $GITHUB_ENV
fi
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Cache conda
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{
hashFiles('ci/requirements/**.yml') }}
- name: Fetch all history for all tags and branches
run: |
git fetch --prune
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/environment.yml
activate-environment: cmweather-dev
cache-downloads: true
python-version: ${{ matrix.python-version }}
- name: Set up conda environment
shell: bash -l {0}
run: |
python -m pip install -e .
conda list
- name: Run Tests
shell: bash -l {0}
run: |
pytest --cov=./ --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-umbrella
fail_ci_if_error: false