Repository navigation
165 lines (149 loc) · 5.4 KB
/
Copy pathtest.yml
File metadata and controls
165 lines (149 loc) · 5.4 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
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ci:
name: CI
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check shared action versions
run: |
diff \
<(grep -oE '(actions/checkout|astral-sh/setup-uv)@[^[:space:]]+' .github/workflows/test.yml | sort -u) \
<(grep -oE '(actions/checkout|astral-sh/setup-uv)@[^[:space:]]+' template/.github/workflows/ci.yml | sort -u)
- name: Install uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
cache-suffix: ${{ matrix.python-version }}
- name: Install shell tools
run: sudo apt-get update && sudo apt-get install --yes shellcheck shfmt
- name: Check template shell scripts
run: |
shellcheck template/docker/*.sh
test -z "$(shfmt --list template/docker/*.sh)"
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: latest
- name: Copy Template
run: |
uvx copier copy \
--vcs-ref HEAD \
./ \
/tmp/test-copier \
-d project_name=test-copier \
-d python_version=${{ matrix.python-version }} \
-d package_name=test_copier \
-d description="Test Copier" \
-d author_name=test-copier \
-d author_email=test-copier@example.com \
-d license=MIT
- name: Test Package Installation
working-directory: /tmp/test-copier
run: |
uv sync --locked
- name: Test Ruff Format
working-directory: /tmp/test-copier
run: |
uv run ruff format --check --diff .
- name: Test Ruff Lint
working-directory: /tmp/test-copier
run: |
uv run ruff check --output-format=github .
- name: Test ty Type Check
working-directory: /tmp/test-copier
run: |
uv run --frozen ty check
- name: Test pytest
working-directory: /tmp/test-copier
run: |
uv run --frozen pytest -vs --cov
- name: Test console script
working-directory: /tmp/test-copier
run: |
test -f LICENSE
uv run --frozen test-copier
- name: Test Docker
working-directory: /tmp/test-copier
run: |
./docker/build.sh
./docker/run.sh
- name: Test Docker Compose
working-directory: /tmp/test-copier
run: |
docker compose build
docker compose up -d
docker compose down
- name: Test devcontainer
working-directory: /tmp/test-copier
run: |
npm install -g @devcontainers/cli
git init
devcontainer build --workspace-folder /tmp/test-copier
devcontainer up --workspace-folder /tmp/test-copier
template-lifecycle:
name: Template lifecycle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- name: Copy historical template
run: |
uvx copier copy \
--vcs-ref v1.0.0 \
./ \
/tmp/test-copier-lifecycle \
--defaults \
-d project_name=lifecycle-project \
-d python_version=3.13 \
-d package_name=lifecycle_package \
-d description="Lifecycle test" \
-d author_name="Lifecycle Tester" \
-d author_email=lifecycle@example.com
git -C /tmp/test-copier-lifecycle init
git -C /tmp/test-copier-lifecycle config user.name "Lifecycle Tester"
git -C /tmp/test-copier-lifecycle config user.email lifecycle@example.com
git -C /tmp/test-copier-lifecycle add .
git -C /tmp/test-copier-lifecycle commit -m "chore: initialize generated project"
- name: Update to current template
run: |
# Same flags as .github/workflows/trigger-template-update.yml, so the
# tested update path matches the one used to reach child repositories.
uvx copier update --vcs-ref HEAD -A --defaults --trust /tmp/test-copier-lifecycle
if git -C /tmp/test-copier-lifecycle diff --quiet; then
echo "Copier update produced no changes"
exit 1
fi
if grep -qx "_commit: v1.0.0" /tmp/test-copier-lifecycle/.copier-answers.yml; then
echo "Copier did not update the template revision"
exit 1
fi
- name: Build updated package
working-directory: /tmp/test-copier-lifecycle
run: |
uv build
test -f dist/lifecycle_project-0.0.1.tar.gz
test -f dist/lifecycle_project-0.0.1-py3-none-any.whl
ci-check:
name: CI Status Check
runs-on: ubuntu-latest
needs: [ci, template-lifecycle]
if: always()
steps:
- name: Some checks failed
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')}}
run: exit 1
- name: All checks ok
if: ${{ contains(needs.*.result, 'success') }}
run: exit 0