|
| 1 | +name: CI Additional |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "*" |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - "*" |
| 9 | + workflow_dispatch: # allows you to trigger manually |
| 10 | + |
| 11 | +jobs: |
| 12 | + detect-ci-trigger: |
| 13 | + name: detect ci trigger |
| 14 | + runs-on: ubuntu-latest |
| 15 | + if: github.event_name == 'push' || github.event_name == 'pull_request' |
| 16 | + outputs: |
| 17 | + triggered: ${{ steps.detect-trigger.outputs.trigger-found }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + fetch-depth: 2 |
| 22 | + - uses: ./.github/actions/detect-ci-trigger |
| 23 | + id: detect-trigger |
| 24 | + with: |
| 25 | + keyword: "[skip-ci]" |
| 26 | + |
| 27 | + test: |
| 28 | + name: ${{ matrix.os }} ${{ matrix.env }} |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + needs: detect-ci-trigger |
| 31 | + if: needs.detect-ci-trigger.outputs.triggered == 'false' |
| 32 | + defaults: |
| 33 | + run: |
| 34 | + shell: bash -l {0} |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + os: ["ubuntu-latest"] |
| 39 | + env: |
| 40 | + [ |
| 41 | + "py37-bare-minimum", |
| 42 | + "py37-min-all-deps", |
| 43 | + "py37-min-nep18", |
| 44 | + "py38-all-but-dask", |
| 45 | + "py38-backend-api-v2", |
| 46 | + "py38-flaky", |
| 47 | + ] |
| 48 | + steps: |
| 49 | + - name: Cancel previous runs |
| 50 | + |
| 51 | + with: |
| 52 | + access_token: ${{ github.token }} |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + with: |
| 55 | + fetch-depth: 0 # Fetch all history for all branches and tags. |
| 56 | + |
| 57 | + - name: Set environment variables |
| 58 | + run: | |
| 59 | + if [[ ${{ matrix.env }} == "py38-backend-api-v2" ]] ; |
| 60 | + then |
| 61 | + echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV |
| 62 | + echo "XARRAY_BACKEND_API=v2" >> $GITHUB_ENV |
| 63 | +
|
| 64 | + elif [[ ${{ matrix.env }} == "py38-flaky" ]] ; |
| 65 | + then |
| 66 | + echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV |
| 67 | + echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV |
| 68 | +
|
| 69 | + else |
| 70 | + echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV |
| 71 | + fi |
| 72 | + - name: Cache conda |
| 73 | + uses: actions/cache@v2 |
| 74 | + with: |
| 75 | + path: ~/conda_pkgs_dir |
| 76 | + key: |
| 77 | + ${{ runner.os }}-conda-${{ matrix.env }}-${{ |
| 78 | + hashFiles('ci/requirements/**.yml') }} |
| 79 | + |
| 80 | + - uses: conda-incubator/setup-miniconda@v2 |
| 81 | + with: |
| 82 | + channels: conda-forge |
| 83 | + channel-priority: strict |
| 84 | + mamba-version: "*" |
| 85 | + activate-environment: xarray-tests |
| 86 | + auto-update-conda: false |
| 87 | + python-version: 3.8 |
| 88 | + use-only-tar-bz2: true |
| 89 | + |
| 90 | + - name: Install conda dependencies |
| 91 | + run: | |
| 92 | + mamba env update -f $CONDA_ENV_FILE |
| 93 | +
|
| 94 | + - name: Install xarray |
| 95 | + run: | |
| 96 | + python -m pip install --no-deps -e . |
| 97 | +
|
| 98 | + - name: Version info |
| 99 | + run: | |
| 100 | + conda info -a |
| 101 | + conda list |
| 102 | + python xarray/util/print_versions.py |
| 103 | + - name: Import xarray |
| 104 | + run: | |
| 105 | + python -c "import xarray" |
| 106 | + - name: Run tests |
| 107 | + run: | |
| 108 | + python -m pytest -n 4 \ |
| 109 | + --cov=xarray \ |
| 110 | + --cov-report=xml \ |
| 111 | + $PYTEST_EXTRA_FLAGS |
| 112 | +
|
| 113 | + - name: Upload code coverage to Codecov |
| 114 | + uses: codecov/codecov-action@v1 |
| 115 | + with: |
| 116 | + file: ./coverage.xml |
| 117 | + flags: unittests,${{ matrix.env }} |
| 118 | + env_vars: RUNNER_OS |
| 119 | + name: codecov-umbrella |
| 120 | + fail_ci_if_error: false |
| 121 | + doctest: |
| 122 | + name: Doctests |
| 123 | + runs-on: "ubuntu-latest" |
| 124 | + defaults: |
| 125 | + run: |
| 126 | + shell: bash -l {0} |
| 127 | + |
| 128 | + steps: |
| 129 | + - name: Cancel previous runs |
| 130 | + |
| 131 | + with: |
| 132 | + access_token: ${{ github.token }} |
| 133 | + - uses: actions/checkout@v2 |
| 134 | + with: |
| 135 | + fetch-depth: 0 # Fetch all history for all branches and tags. |
| 136 | + - uses: conda-incubator/setup-miniconda@v2 |
| 137 | + with: |
| 138 | + channels: conda-forge |
| 139 | + channel-priority: strict |
| 140 | + mamba-version: "*" |
| 141 | + activate-environment: xarray-tests |
| 142 | + auto-update-conda: false |
| 143 | + python-version: "3.8" |
| 144 | + |
| 145 | + - name: Install conda dependencies |
| 146 | + run: | |
| 147 | + mamba env update -f ci/requirements/environment.yml |
| 148 | + - name: Install xarray |
| 149 | + run: | |
| 150 | + python -m pip install --no-deps -e . |
| 151 | + - name: Version info |
| 152 | + run: | |
| 153 | + conda info -a |
| 154 | + conda list |
| 155 | + python xarray/util/print_versions.py |
| 156 | + - name: Run doctests |
| 157 | + run: | |
| 158 | + python -m pytest --doctest-modules xarray --ignore xarray/tests |
| 159 | +
|
| 160 | + min-version-policy: |
| 161 | + name: Minimum Version Policy |
| 162 | + runs-on: "ubuntu-latest" |
| 163 | + needs: detect-ci-trigger |
| 164 | + if: needs.detect-ci-trigger.outputs.triggered == 'false' |
| 165 | + defaults: |
| 166 | + run: |
| 167 | + shell: bash -l {0} |
| 168 | + |
| 169 | + steps: |
| 170 | + - name: Cancel previous runs |
| 171 | + |
| 172 | + with: |
| 173 | + access_token: ${{ github.token }} |
| 174 | + - uses: actions/checkout@v2 |
| 175 | + with: |
| 176 | + fetch-depth: 0 # Fetch all history for all branches and tags. |
| 177 | + - uses: conda-incubator/setup-miniconda@v2 |
| 178 | + with: |
| 179 | + channels: conda-forge |
| 180 | + channel-priority: strict |
| 181 | + mamba-version: "*" |
| 182 | + auto-update-conda: false |
| 183 | + python-version: "3.8" |
| 184 | + |
| 185 | + - name: minimum versions policy |
| 186 | + run: | |
| 187 | + mamba install -y pyyaml conda |
| 188 | + python ci/min_deps_check.py ci/requirements/py37-bare-minimum.yml |
| 189 | + python ci/min_deps_check.py ci/requirements/py37-min-all-deps.yml |
0 commit comments