-
Notifications
You must be signed in to change notification settings - Fork 28
188 lines (182 loc) · 6.33 KB
/
Copy pathmain.yml
File metadata and controls
188 lines (182 loc) · 6.33 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
name: main
on:
push:
branches: [main]
tags: ['*']
schedule:
- cron: "0 09 * * *" # Runs 11 AM UTC == 2 AM PDT
pull_request:
branches: [main]
workflow_dispatch:
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
test-python-versions:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
include:
- os: macos-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.13'
runs-on: ${{ matrix.os }}
name: test (py${{ matrix.python-version }} ${{ matrix.os }})
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
with:
version: ">=0.9.0"
- uses: extractions/setup-just@v3
# Fail fast if uv.lock has drifted from pyproject.toml.
- run: uv lock --locked
- run: just lint
- run: uv run --python ${{ matrix.python-version }} --group test rsconnect version
- run: just test ${{ matrix.python-version }}
- if: github.event_name == 'pull_request' && matrix.python-version == '3.8'
uses: orgoro/coverage@v3
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
prerelease-test:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
with:
version: ">=0.9.0"
- uses: extractions/setup-just@v3
- run: just lint
# --upgrade forces a fresh resolve (ignoring the lock) so prereleases are
# actually exercised; plain `--prerelease allow` against the lock is a no-op.
- run: uv run --upgrade --prerelease allow --group test rsconnect version
- run: uv run --python 3.8 --upgrade --prerelease allow --group test ./scripts/runtests
distributions:
needs: test-python-versions
strategy:
matrix:
package_name: ["rsconnect_python", "rsconnect"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
with:
version: ">=0.9.0"
- uses: extractions/setup-just@v3
- run: uv sync --group test
- name: assert tag matches pyproject version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
tag="${GITHUB_REF_NAME}"
ver="$(uv version --short)"
if [ "$tag" != "$ver" ]; then
echo "::error::tag '$tag' does not match pyproject version '$ver'"
exit 1
fi
- name: assert tag is on main
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
if ! git merge-base --is-ancestor HEAD origin/main; then
echo "::error::tag '${GITHUB_REF_NAME}' points to a commit that is not on main"
exit 1
fi
- run: just dist
env:
PACKAGE_NAME: ${{ matrix.package_name }}
- name: assert wheel contents
run: |
WHL=$(ls dist/*.whl | head -1)
unzip -l "$WHL" | grep -q 'rsconnect/py.typed' || { echo "::error::py.typed missing from wheel"; exit 1; }
unzip -l "$WHL" | grep -q 'rsconnect/quickstart/templates/' || { echo "::error::quickstart templates missing from wheel"; exit 1; }
if unzip -l "$WHL" | grep -qE ' (tests/|conftest\.py)'; then echo "::error::wheel contains test files"; exit 1; fi
- name: smoke test the built wheel
run: |
WHL=$(ls dist/*.whl | head -1)
uv run --no-project --with "$WHL" rsconnect version
uv run --no-project --with "$WHL" rsconnect --help
- name: create github release
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.package_name == 'rsconnect_python'
with:
files: |
dist/*.whl
token: ${{ secrets.GITHUB_TOKEN }}
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
docs:
needs: test-python-versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
with:
version: ">=0.9.0"
- uses: extractions/setup-just@v3
- name: build docs
run: just docs
- uses: actions/upload-artifact@v5
with:
name: docs
path: site/
- uses: aws-actions/configure-aws-credentials@v4
id: creds
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: just sync-latest-docs-to-s3
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.DOCS_AWS_ROLE }}
aws-region: us-east-1
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: just promote-docs-in-s3
test-connect-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- "preview" # nightly pre-release build of Connect
- "release" # special value that always points to the latest Connect release
- "2025.09.0" # jammy
- "2025.03.0" # jammy
- "2024.09.0" # jammy
- "2024.03.0" # jammy
- "2023.09.0" # jammy
- "2023.03.0" # bionic
- "2022.10.0" # bionic
name: Integration tests against Connect ${{ matrix.version }}
env:
python-version: '3.13'
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v6
with:
version: ">=0.9.0"
# Prepare the environment on the runner BEFORE entering with-connect, so
# no build/resolve/interpreter-fetch happens over the network mid-test.
- run: uv sync --python ${{ env.python-version }} --group test
- run: uv run --no-sync rsconnect version
- name: Run integration tests
uses: posit-dev/with-connect@main
with:
version: ${{ matrix.version }}
# License file valid until 2026-12-05
license: ${{ secrets.CONNECT_LICENSE_FILE }}
command: |
uv run --no-sync --group test ./scripts/runtests