-
Notifications
You must be signed in to change notification settings - Fork 1
194 lines (183 loc) · 5.22 KB
/
core.yml
File metadata and controls
194 lines (183 loc) · 5.22 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: core
on:
push:
branches: main
paths:
- 'relay/**'
- 'cli/**'
- 'pyproject.toml'
- 'Makefile'
- '.github/workflows/core.yml'
pull_request:
branches: main
paths:
- 'relay/**'
- 'cli/**'
- 'pyproject.toml'
- 'Makefile'
- '.github/workflows/core.yml'
release:
types: [published]
env:
UV_VERSION: "0.7.20"
PYTHON_VERSION: "3.11"
jobs:
install:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- name: Install the engine
run: make install
- name: Check that we can import the engine
run: |
python -c "import relay; print(relay.__version__)"
- name: Run the CLI
run: relay --help
code-quality:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
- name: Run ruff
run: |
make install-quality
ruff --version
make lint-check
- name: Run ty
run: make typing-check
deps-sync:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- name: Run dependency sync checker
run: make deps-check
test:
if: github.event_name != 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}-test
- name: Run tests
run: |
make install-test
make test
- uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: ./coverage.xml
codecov-upload:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
directory: ./coverage-reports
fail_ci_if_error: true
build:
if: github.event_name != 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- name: Build the package
run: make build
publish:
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
# For PyPI's trusted publishing.
id-token: write
outputs:
package_version: ${{ steps.set_version.outputs.package_version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- name: Set package version
id: set_version
run: |
RELEASE_TAG=${{ github.ref_name }}
# Strip "v" prefix
BUILD_VERSION=${RELEASE_TAG#v}
# Replace SemVer pre-release separators with PEP440 compatible ones
BUILD_VERSION=${BUILD_VERSION//-alpha./a}
BUILD_VERSION=${BUILD_VERSION//-beta./b}
BUILD_VERSION=${BUILD_VERSION//-rc./rc}
echo "package_version=${BUILD_VERSION}" >> $GITHUB_OUTPUT
echo "BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_ENV
- name: Publish to PyPI
env:
UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
make set-version
make build && make publish
verify-publish:
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
- name: Install package
run: |
uv pip install --system relaycli==${{ needs.publish.outputs.package_version }}
relay version