Skip to content

Commit 9c8bd02

Browse files
committed
ci: test that package works
1 parent 10f348c commit 9c8bd02

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: test-cookiecutter-template
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
PYTHON_VERSION: "3.13"
17+
# Matches the default in the cookiecutter.json.
18+
DEFAULT_PACKAGE_NAME: "package_name"
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ env.PYTHON_VERSION }}
27+
28+
- name: Create cookiecutter package
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install cookiecutter
32+
cookiecutter . --no-input
33+
34+
- name: Test cookiecutter package
35+
run: |
36+
cd ${{ env.DEFAULT_PACKAGE_NAME }}
37+
python -m venv .venv
38+
source .venv/bin/activate
39+
pip install -e ".[dev]"
40+
# Make sure unit tests pass.
41+
pytest
42+
# Check the CLI works.
43+
${{ env.DEFAULT_PACKAGE_NAME }} --help

0 commit comments

Comments
 (0)