|
1 | 1 | # Built from: |
2 | | -# https://docs.github.com/en/actions/guides/building-and-testing-python |
| 2 | +# https://github.com/actions/checkout/ |
3 | 3 | # https://github.com/actions/setup-python/ |
| 4 | +# https://github.com/codecov/codecov-action |
4 | 5 |
|
5 | 6 | name: Build and test linkml-runtime |
6 | | - |
| 7 | +env: |
| 8 | + UV_VERSION: "0.7.13" |
7 | 9 | on: |
8 | 10 | push: |
9 | 11 | branches: |
10 | | - - main |
| 12 | + - main |
11 | 13 | pull_request: |
12 | 14 | workflow_dispatch: |
13 | 15 |
|
14 | 16 | jobs: |
| 17 | + quality-checks: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v5.0.0 |
| 21 | + - name: Install uv |
| 22 | + uses: astral-sh/setup-uv@v6.8.0 |
| 23 | + with: |
| 24 | + version: ${{ env.UV_VERSION }} |
| 25 | + enable-cache: true |
| 26 | + - uses: actions/setup-python@v6.0.0 |
| 27 | + with: |
| 28 | + python-version: 3.13 |
| 29 | + - name: Install tox |
| 30 | + run: python -m pip install tox |
| 31 | + - name: Run codespell |
| 32 | + run: tox -e codespell |
| 33 | + - name: Run code format checks |
| 34 | + run: tox -e format_check |
| 35 | + |
15 | 36 | test: |
| 37 | + needs: |
| 38 | + - quality-checks |
16 | 39 | strategy: |
17 | 40 | fail-fast: false |
18 | 41 | matrix: |
19 | 42 | os: [ubuntu-latest, windows-latest] |
20 | | - python-version: ["3.9", "3.10", "3.12", "3.13"] |
| 43 | + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 44 | + # Test on Windows with only the oldest and newest Python versions |
21 | 45 | exclude: |
22 | | - - os: windows-latest |
23 | | - python-version: "3.10" |
24 | | - - os: windows-latest |
25 | | - python-version: "3.12" |
| 46 | + - os: windows-latest |
| 47 | + python-version: "3.10" |
| 48 | + - os: windows-latest |
| 49 | + python-version: "3.11" |
| 50 | + - os: windows-latest |
| 51 | + python-version: "3.12" |
| 52 | + # See https://github.com/snok/install-poetry#running-on-windows |
| 53 | + defaults: |
| 54 | + run: |
| 55 | + shell: bash |
26 | 56 |
|
27 | 57 | runs-on: ${{ matrix.os }} |
28 | | - |
| 58 | + |
29 | 59 | steps: |
| 60 | + - name: Check out repository |
| 61 | + uses: actions/checkout@v5.0.0 |
| 62 | + with: |
| 63 | + fetch-depth: 0 |
30 | 64 |
|
31 | 65 | #---------------------------------------------- |
32 | | - # install poetry |
33 | | - #---------------------------------------------- |
34 | | - - name: Install Poetry |
35 | | - run: pipx install poetry==1.4.0 |
36 | | - |
| 66 | + # install uv |
37 | 67 | #---------------------------------------------- |
38 | | - # check-out repo and set-up python |
39 | | - #---------------------------------------------- |
40 | | - - name: Check out repository |
41 | | - uses: actions/checkout@v3 |
42 | | - |
43 | | - - name: Set up Python ${{ matrix.python-version }} |
44 | | - uses: actions/setup-python@v5 |
| 68 | + - name: Install uv |
| 69 | + uses: astral-sh/setup-uv@v6.8.0 |
45 | 70 | with: |
| 71 | + version: ${{ env.UV_VERSION }} |
| 72 | + enable-cache: true |
| 73 | + cache-dependency-glob: "uv.lock" |
46 | 74 | python-version: ${{ matrix.python-version }} |
47 | | - cache: 'poetry' |
48 | 75 |
|
49 | 76 | #---------------------------------------------- |
50 | | - # install your root project, if required |
51 | | - #---------------------------------------------- |
52 | | - - name: Install library |
53 | | - run: poetry install --no-interaction |
| 77 | + # install your root project, if required |
| 78 | + #---------------------------------------------- |
| 79 | + - name: Install dependencies |
| 80 | + run: | |
| 81 | + uv sync --group dev |
| 82 | +
|
| 83 | + - name: Verify uv.lock is up-to-date |
| 84 | + run: uv lock --check |
54 | 85 |
|
55 | 86 | #---------------------------------------------- |
56 | | - # coverage report |
| 87 | + # coverage report |
57 | 88 | #---------------------------------------------- |
58 | 89 | - name: Generate coverage results |
59 | | - # Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668 |
| 90 | + # Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668 |
60 | 91 | shell: bash |
61 | 92 | run: | |
62 | | - poetry run coverage run -m pytest |
63 | | - poetry run coverage xml |
64 | | - poetry run coverage report -m |
| 93 | + uv run coverage run -m pytest |
| 94 | + uv run coverage xml |
| 95 | + uv run coverage report -m |
65 | 96 |
|
66 | 97 | #---------------------------------------------- |
67 | 98 | # upload coverage results |
68 | 99 | #---------------------------------------------- |
69 | 100 | - name: Upload coverage report |
70 | | - uses: codecov/codecov-action@v3 |
| 101 | + uses: codecov/codecov-action@v5.5.1 |
71 | 102 | with: |
72 | 103 | name: codecov-results-${{ matrix.os }}-${{ matrix.python-version }} |
73 | 104 | token: ${{ secrets.CODECOV_TOKEN }} |
|
0 commit comments