Skip to content

CI

CI #3041

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # Daily “At 00:00”
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
# if: |
# github.repository == 'NCAR/geocat-comp'
name: Python (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: checkout
uses: actions/checkout@v4
- name: set environment variables
run: |
echo "TODAY=$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: environment setup
id: env-setup
continue-on-error: true
uses: mamba-org/setup-micromamba@v1
with:
environment-file: build_envs/environment.yml
cache-environment: true
cache-environment-key: "CI ${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}"
create-args: >-
python=${{matrix.python-version}}
- name: retry environment set up if failed
if: steps.env-setup.outcome == 'failure'
uses: mamba-org/setup-micromamba@v1
with:
download-micromamba: false
environment-file: build_envs/environment.yml
cache-environment: true
cache-environment-key: "CI ${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}"
create-args: >-
python=${{matrix.python-version}}
- name: Install geocat-comp
run: |
python -m pip install --no-deps -e .
- name: Run Tests (non-windows)
if: matrix.os != 'windows-latest'
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate
micromamba activate geocat_comp_build
python -m pytest test -v --cov=./geocat/comp --cov-report=xml --junitxml=pytest.xml
- name: Run Tests (windows)
if: matrix.os == 'windows-latest'
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression
micromamba activate
micromamba activate geocat_comp_build
python -m pytest test -v --cov=./geocat/comp --cov-report=xml --junitxml=pytest.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: Test results for ${{ runner.os }}-${{ matrix.python-version }}
path: pytest.xml
- name: Upload code coverage to Codecov
if: github.repository == 'NCAR/geocat-comp'
uses: codecov/codecov-action@v4.4.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
link-check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: checkout
uses: actions/checkout@v4
- name: environment setup
id: link-env-setup
continue-on-error: true
uses: mamba-org/setup-micromamba@v1
with:
environment-file: build_envs/docs.yml
cache-environment: true
cache-environment-key: "linkcheck-${{env.TODAY}}"
create-args: >-
python=3.11
- name: retry environment set up if failed
if: steps.link-env-setup.outcome == 'failure'
uses: mamba-org/setup-micromamba@v1
with:
download-micromamba: false
environment-file: build_envs/docs.yml
cache-environment: true
cache-environment-key: "linkcheck-${{env.TODAY}}"
create-args: >-
python=3.11
- name: Install geocat-comp
run: |
python -m pip install .
- name: check conda list
run: |
conda list
- name: Make docs with linkcheck
uses: nick-fields/retry@v3
with:
timeout_minutes: 60
max_attempts: 3
command: |
eval "$(micromamba shell hook --shell bash)"
micromamba activate
micromamba activate gc-docs
cd docs
make linkcheck