@@ -2,64 +2,77 @@ name: CI
2
2
on : [push]
3
3
4
4
jobs :
5
- linter :
6
- name : " Linter (pre-commit)"
5
+ pre-commit-checks :
6
+ name : pre-commit checks
7
+ timeout-minutes : 30
7
8
runs-on : ubuntu-latest
8
9
env :
9
- CI : True
10
- strategy :
11
- fail-fast : true
12
- steps :
13
- - name : Pull image
14
- run : docker pull condaforge/mambaforge:latest
15
- - name : Checkout branch
16
- uses : actions/checkout@v3
17
- with :
18
- ref : ${{ github.head_ref }}
19
- - name : Run linter inside of container
20
- uses : ./.github/actions/linter
21
- linux :
22
- name : " Linux - tests - Py${{ matrix.PYTHON_VERSION }}"
23
- runs-on : ubuntu-latest
24
- env :
25
- CI : True
26
- strategy :
27
- fail-fast : true
28
- matrix :
29
- PYTHON_VERSION : ['3.7', '3.8', '3.9', '3.10']
10
+ PRE_COMMIT_USE_MICROMAMBA : 1
30
11
steps :
31
- - name : Pull image
32
- run : docker pull condaforge/mambaforge:latest
33
- - name : Checkout branch
34
- uses : actions/checkout@v3
35
- with :
36
- ref : ${{ github.head_ref }}
37
- - name : Run CI inside of container
38
- uses : ./.github/actions/unittests
39
- with :
40
- python_version : ${{ matrix.PYTHON_VERSION }}
41
- linux-conda-build :
42
- name : " Linux - conda-build - Python ${{ matrix.CONDA_BUILD_YML }}"
43
- runs-on : ubuntu-latest
44
- env :
45
- CI : True
12
+ - name : Checkout branch
13
+ uses : actions/checkout@v3
14
+ - name : Set up micromamba
15
+ uses : mamba-org/setup-micromamba@d05808540d968a55ca33c798e0661fb98f533c73
16
+ - name : Add micromamba to GITHUB_PATH
17
+ run : echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH"
18
+ - name : Install Python 3.10
19
+ uses : actions/setup-python@v4
20
+ with :
21
+ python-version : " 3.10"
22
+ - name : Run pre-commit checks
23
+ uses :
pre-commit/[email protected]
24
+
25
+ unit-tests :
26
+ name : Tests - ${{ matrix.os }} - Py${{ matrix.python-version }}
27
+ runs-on : ${{ matrix.os }}
46
28
strategy :
47
29
fail-fast : true
48
30
matrix :
49
- CONDA_BUILD_YML :
50
- - linux_64_python3.7_default.____cpython
51
- - linux_aarch64_python3.10_default.____cpython
52
- - linux_ppc64le_python3.10_default.____cpython
31
+ include :
32
+ - { os: ubuntu-latest, python-version: '3.7' }
33
+ - { os: ubuntu-latest, python-version: '3.8' }
34
+ - { os: ubuntu-latest, python-version: '3.9' }
35
+ - { os: ubuntu-latest, python-version: '3.10' }
36
+ - { os: ubuntu-latest, python-version: '3.11' }
37
+ - { os: macos-latest, python-version: '3.7' }
38
+ - { os: macos-latest, python-version: '3.11' }
39
+ - { os: windows-latest, python-version: '3.7' }
40
+ - { os: windows-latest, python-version: '3.11' }
53
41
steps :
54
- - name : Pull image
55
- run : docker pull condaforge/mambaforge:latest
56
42
- name : Checkout branch
57
43
uses : actions/checkout@v3
44
+ - name : Set up conda env
45
+ uses : mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1
58
46
with :
59
- ref : ${{ github.head_ref }}
60
- - name : Fetch full git history
61
- run : git fetch --prune --unshallow
62
- - name : Run CI inside of container
63
- uses : ./.github/actions/conda-build
64
- with :
65
- conda_build_yml : ${{ matrix.CONDA_BUILD_YML }}
47
+ environment-file : ${{ matrix.os == 'windows-latest' && 'environment-win.yml' || 'environment.yml' }}
48
+ init-shell : ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }}
49
+ cache-environment : true
50
+ create-args : >-
51
+ python=${{ matrix.python-version }}
52
+ - name : Install repository (unix)
53
+ if : matrix.os != 'windows-latest'
54
+ shell : bash -el {0}
55
+ run : pip install --no-use-pep517 --no-deps --disable-pip-version-check -e .
56
+ - name : Install repository (windows)
57
+ if : matrix.os == 'windows-latest'
58
+ shell : powershell
59
+ run : pip install --no-use-pep517 --no-deps --disable-pip-version-check -e .
60
+ - name : Run pytest (unix)
61
+ if : matrix.os != 'windows-latest'
62
+ shell : bash -el {0}
63
+ run : pytest -nauto tests -m "not high_memory" --doctest-modules src/
64
+ - name : Run pytest (windows)
65
+ if : matrix.os == 'windows-latest'
66
+ shell : powershell
67
+ run : pytest -nauto tests -m "not high_memory"
68
+ - name : Run doctest
69
+ if : matrix.os != 'windows-latest'
70
+ shell : bash -el {0}
71
+ # Check that the readme example will work by running via doctest.
72
+ # We run outside the repo to make the test a bit more similar to
73
+ # a user running after installing with conda.
74
+ run : |
75
+ mkdir ../temp
76
+ cp README.md ../temp
77
+ cd ../temp
78
+ python -m doctest -v README.md
0 commit comments