-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (75 loc) · 2.79 KB
/
Copy pathci.yml
File metadata and controls
88 lines (75 loc) · 2.79 KB
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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
inputs:
test_suite:
description: 'Which test suite to run'
required: true
default: 'unit'
type: choice
options:
- unit
- integration
- all
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
with:
submodules: recursive
- uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: latest
- name: Run pre-commit
run: pixi run -e dev pre-commit run --all-files
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v7.0.0
with:
submodules: recursive
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.10.0
with:
pixi-version: latest
environments: test
- name: Refresh CMIP7 vocabularies to latest upstream
run: |
git -C src/access_moppy/vocabularies/cmip7-cmor-tables fetch origin main
git -C src/access_moppy/vocabularies/cmip7-cmor-tables checkout --detach FETCH_HEAD
- name: Create default config file
run: |
mkdir -p ~/.moppy
cat <<EOF > ~/.moppy/user.yml
creator_name: "CI Bot"
organisation: "ACCESS-NRI"
creator_email: "ci@example.com"
creator_url: "https://example.com"
EOF
- name: List installed packages
run: pixi list -e test
- name: Run smoke and unit tests (automatic)
if: github.event_name != 'workflow_dispatch'
run: pixi run -e test pytest tests/test_smoke.py tests/unit --cov=access_moppy --cov-config=.coveragerc --cov-report=xml
- name: Run unit tests only (manual)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'unit'
run: pixi run -e test pytest tests/test_smoke.py tests/unit --cov=access_moppy --cov-config=.coveragerc --cov-report=xml
- name: Run integration tests only (manual)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'integration'
run: pixi run -e test pytest tests/integration --cov=access_moppy --cov-config=.coveragerc --cov-report=xml
- name: Run all tests (manual)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'all'
run: pixi run -e test pytest tests --cov=access_moppy --cov-config=.coveragerc --cov-report=xml
- name: Upload code coverage
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.codecov_token }}
files: ./coverage.xml
flags: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite || 'unit' }}