-
Notifications
You must be signed in to change notification settings - Fork 14
96 lines (92 loc) · 2.6 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Tests for the template
test:
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
# - windows-latest
- macOS-latest
runs-on: ${{ matrix.os }}
name: "Template: ${{ matrix.python-version }} - ${{ matrix.os }}"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: snok/install-poetry@v1.3.4
- name: Install Dependencies
run: poetry install
shell: bash
- name: Test with Pytest
run: poetry run pytest
shell: bash
# Generate package, run test, run linting and build docs
copier:
strategy:
fail-fast: false
matrix:
script:
- run: "poetry run pytest"
dir: ""
name: "pytest"
- run: "git init && git add . && pipx run pre-commit run -a"
dir: ""
name: "pre-commit"
- run: "poetry run make html"
dir: "docs"
name: "docs"
extra_options:
- label: "no extra options"
value: ""
- label: "with CLI"
value: "--data 'has_cli=yes' --data 'cli_name=mycli'"
runs-on: ubuntu-latest
name: "Generated: ${{ matrix.script.name }} ${{ matrix.extra_options.label }}"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: snok/install-poetry@v1
- run: poetry install
- run: |
poetry run copier copy \
. \
my-project \
--UNSAFE \
--data 'full_name=Bruno Alla' \
--data 'email=test@example.com' \
--data 'github_username=dummy' \
--data 'project_name=My Amazing Project' \
--data 'project_short_description=Just a great project' \
--data 'open_source_license=MIT' \
${{ matrix.extra_options.value }} \
--defaults
shell: bash
- run: cat pyproject.toml
working-directory: my-project
shell: bash
- run: poetry install --with docs
working-directory: my-project
shell: bash
- run: ${{ matrix.script.run }}
working-directory: my-project/${{ matrix.script.dir }}
shell: bash