forked from hed-standard/hed-python
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 2.02 KB
/
ci.yaml
File metadata and controls
74 lines (63 loc) · 2.02 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
name: CI
on:
push:
branches: ["*"]
pull_request:
branches: ["*"]
permissions:
contents: read
id-token: write
jobs:
determine_version:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/main' ]]; then
# Push to main branch
echo 'matrix=["3.10", "3.11", "3.12", "3.13", "3.14"]' >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == 'pull_request' && "${{ github.event.pull_request.base.ref }}" == 'main' ]]; then
# PR to main branch
echo 'matrix=[ "3.10", "3.11", "3.12", "3.13", "3.14"]' >> $GITHUB_OUTPUT
else
echo 'matrix=["3.10", "3.13"]' >> $GITHUB_OUTPUT
fi
build:
needs: determine_version
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ${{fromJson(needs.determine_version.outputs.matrix)}}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Create virtual environment
run: |
uv venv --clear .venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
# Install dependencies
- name: Install dependencies
run: uv pip install -e ".[docs,test]"
# Run spec tests without coverage for non Python 3.10
- name: Run spec_test
env:
GITHUB_TOKEN: ${{ github.token }}
continue-on-error: true
run: |
python -m unittest discover spec_tests
# Run unittest without coverage
- name: Test with unittest
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
python -m unittest discover tests