File: ci.yaml

package info (click to toggle)
xarray-safe-rcm 2026.01.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: python: 1,083; sh: 23; makefile: 5
file content (84 lines) | stat: -rw-r--r-- 2,280 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  detect-skip-ci-trigger:
    name: "Detect CI Trigger: [skip-ci]"
    if: |
      github.repository == 'umr-lops/xarray-safe-rcm'
      && github.event_name == 'push'
      || github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    outputs:
      triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 2
      - uses: xarray-contrib/ci-trigger@v1
        id: detect-trigger
        with:
          keyword: "[skip-ci]"

  ci:
    name: ${{ matrix.os }} py${{ matrix.python-version }}
    runs-on: ${{ matrix.os }}
    needs: detect-skip-ci-trigger

    if: needs.detect-skip-ci-trigger.outputs.triggered == 'false'

    defaults:
      run:
        shell: bash -l {0}

    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.10", "3.11", "3.12"]
        os: ["ubuntu-latest", "macos-latest", "windows-latest"]

    steps:
      - name: Checkout the repository
        uses: actions/checkout@v6
        with:
          # need to fetch all tags to get a correct version
          fetch-depth: 0 # fetch all branches and tags

      - name: Setup environment variables
        run: |
          echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

          echo "CONDA_ENV_FILE=ci/requirements/environment.yaml" >> $GITHUB_ENV

      - name: Setup micromamba
        uses: mamba-org/setup-micromamba@v2
        with:
          environment-file: ${{ env.CONDA_ENV_FILE }}
          environment-name: xarray-safe-rcm-tests
          cache-environment: true
          cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
          create-args: >-
            python=${{matrix.python-version}}
            conda

      - name: Install xarray-safe-rcm
        run: |
          python -m pip install --no-deps -e .

      - name: Import xarray-safe-rcm
        run: |
          python -c "import safe_rcm"

      - name: Run tests
        run: |
          python -m pytest --cov=safe_rcm