-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (92 loc) · 3.9 KB
/
test.yaml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Tests
on: [push, pull_request]
jobs:
build:
name: Build (${{ matrix.python-version }} | ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Cache Linux/macOS (x86) Conda environment
# if: ${{ runner.os != 'Windows' }}
# uses: actions/cache@v3
# env:
# # Increase this value to reset cache if ci/environment.yml has not changed
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
# - name: Cache Windows Conda environment
# if: ${{ runner.os == 'Windows' }}
# uses: actions/cache@v3
# env:
# # Increase this value to reset cache if ci/environment.yml has not changed
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}-win.yml') }}
- name: Setup Linux/macOS Micromamba Python ${{ matrix.python-version }}
if: ${{ runner.os != 'Windows' }}
uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} --channel conda-forge
environment-file: ci/environment-py${{ matrix.python-version }}.yml
cache-environment: true
post-cleanup: 'all'
- name: Setup Windows Micromamba Python ${{ matrix.python-version }}
if: ${{ runner.os == 'Windows' }}
uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} --channel conda-forge
environment-file: ci/environment-py${{ matrix.python-version }}-win.yml
cache-environment: true
post-cleanup: 'all'
# - name: Build and activate Linux/macOS Conda environment
# if: ${{ runner.os != 'Windows' }}
# uses: conda-incubator/setup-miniconda@v2
# with:
# miniforge-variant: Mambaforge
# python-version: ${{ matrix.python-version }}
# channels: conda-forge, defaults # These need to be specified to use mamba
# channel-priority: true
# environment-file: ci/environment-py${{ matrix.python-version }}.yml
# activate-environment: test-env-mac-unix
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
# - name: Build and activate Windows Conda environment
# if: ${{ runner.os == 'Windows' }}
# uses: conda-incubator/setup-miniconda@v2
# with:
# miniforge-variant: Mambaforge
# python-version: ${{ matrix.python-version }}
# channels: conda-forge, defaults # These need to be specified to use mamba
# channel-priority: true
# environment-file: ci/environment-py${{ matrix.python-version }}-win.yml
# activate-environment: test-env-win
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install package in environment
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall
- name: Run tests
shell: bash -l {0}
run: |
pytest -sv --cov=./ --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false