-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (103 loc) · 3.35 KB
/
ci.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
105
106
107
108
109
name: CI
on:
pull_request:
push:
branches: [main]
tags: ['v*']
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
# Verifies that Ruff and mypy checks are passing
- name: pre-commit
run: make pre-commit
tests:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: "${{ matrix.os }}"
defaults:
run:
# This might be needed for Windows and doesn't seem to affect unix-based systems
# so we include it. If you have better proof of whether this is needed or not,
# feel free to update.
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
run: |
make fetch-test-data
make test
uv run coverage xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
imports-without-extras:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- name: Check importable without extras
run: uv run --package cmip_ref_core python scripts/test-install.py
check-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Check build
run: |
make build
tar -tvf dist/cmip_ref-*.tar.gz --wildcards '*ref/py.typed' '*/LICENCE' '*/NOTICE'
tar -tvf dist/cmip_ref_core-*.tar.gz --wildcards '*ref_core/py.typed' '*/LICENCE' '*/NOTICE'
- name: Check installable
run: |
uv pip install dist/*.whl
uv pip freeze
uv run --no-sync python -c "import cmip_ref; print(cmip_ref.__version__)"
uv run --no-sync ref config list
# Check if a changelog message was added to the PR
# Only runs on pull requests
check-for-changelog:
runs-on: ubuntu-latest
if: github.event.pull_request
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Get all changelog files
id: changed-changelog-files
uses: tj-actions/changed-files@v45
with:
# Avoid using single or double quotes for multiline patterns
files: |
changelog/*.md
- name: Print out the changed files
if: steps.changed-files-specific.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-changelog-files.outputs.all_changed_files }}
run: |
make changelog-draft
- name: Fail if no changelog message is present
if: steps.changed-changelog-files.outputs.any_changed == 'false'
run: |
echo "No changelog present."
exit 1