-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (124 loc) · 3.73 KB
/
Copy pathci.yml
File metadata and controls
131 lines (124 loc) · 3.73 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# This file is part of cjdk.
# Copyright 2022-25 Board of Regents of the University of Wisconsin System
# SPDX-License-Identifier: MIT
name: CI
on:
pull_request:
push:
branches:
- main
tags:
- v*
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- uses: astral-sh/setup-uv@v5
- run: uv run ty check # Until they add a pre-commit hook
test:
strategy:
fail-fast: false
matrix:
include:
# All Python versions on Ubuntu
- runner: ubuntu-latest
python: "3.10"
- runner: ubuntu-latest
python: "3.11"
- runner: ubuntu-latest
python: "3.12"
- runner: ubuntu-latest
python: "3.13"
- runner: ubuntu-latest
python: "3.14"
# Oldest and newest Python on other platforms
- runner: macos-latest
python: "3.10"
- runner: macos-latest
python: "3.14"
- runner: windows-latest
python: "3.10"
- runner: windows-latest
python: "3.14"
name: test-${{ matrix.runner }}-py${{ matrix.python }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for hatch-vcs
- uses: astral-sh/setup-uv@v5
- name: Run tests
run: uv run --python ${{ matrix.python }} --group test pytest
docs:
needs:
- lint
- test
concurrency:
group: publish-gh-pages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for hatch-vcs
- uses: astral-sh/setup-uv@v5
- name: Build docs
run: uv run --group docs jb build docs/
env:
CJDK_HIDE_PROGRESS_BARS: "1"
- name: Publish to gh-pages (latest)
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: latest
commit_message: Deploy latest
- name: Get version from tag
id: get_version
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${GITHUB_REF##refs/tags/v}"
echo "version=${VERSION}" >>$GITHUB_OUTPUT
- name: Publish to gh-pages (tag)
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: ${{ steps.get_version.outputs.version }}
commit_message: Deploy ${{ steps.get_version.outputs.version }}
publish:
needs:
- lint
- test
- docs
runs-on: ubuntu-latest
permissions: # https://docs.pypi.org/trusted-publishers/
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Full history needed for hatch-vcs
- uses: astral-sh/setup-uv@v5
- name: Build sdist and wheel
run: uv build
- name: Publish on PyPI
if: >-
github.repository == 'cachedjdk/cjdk' &&
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1