Skip to content

Commit 82f2f92

Browse files
authored
fix: better structure for workflows (ci+cd) (#224)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 63decc6 commit 82f2f92

7 files changed

+73
-60
lines changed
Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{%- set compiled = cookiecutter.backend in ["pybind11", "maturin", "skbuild", "mesonpy"] -%}
21
name: CI
32

43
on:
@@ -9,11 +8,6 @@ on:
98
- master
109
- main
1110
- develop
12-
{%- if not compiled %}
13-
release:
14-
types:
15-
- published
16-
{%- endif %}
1711

1812
concurrency:
1913
group: {% raw %}${{ github.workflow }}-${{ github.ref }}{% endraw %}
@@ -66,9 +60,11 @@ jobs:
6660
allow-prereleases: true
6761

6862
{%- if cookiecutter.backend == "mesonpy" %}
63+
6964
- name: Activate MSVC for Meson
7065
if: runner.os == 'Windows'
7166
uses: ilammy/msvc-dev-cmd@v1
67+
7268
{%- endif %}
7369

7470
- name: Install package
@@ -81,57 +77,3 @@ jobs:
8177
8278
- name: Upload coverage report
8379
uses: codecov/[email protected]
84-
85-
{%- if not compiled %}
86-
87-
dist:
88-
needs: [pre-commit]
89-
name: Distribution build
90-
runs-on: ubuntu-latest
91-
92-
steps:
93-
- uses: actions/checkout@v3
94-
with:
95-
fetch-depth: 0
96-
97-
- name: Build sdist and wheel
98-
run: pipx run build
99-
100-
- uses: actions/upload-artifact@v3
101-
with:
102-
path: dist
103-
104-
{%- if cookiecutter.backend != "trampolim" %}
105-
106-
- name: Check products
107-
run: pipx run twine check dist/*
108-
109-
{%- endif %}
110-
111-
publish:
112-
needs: [dist]
113-
name: Publish to PyPI
114-
environment: pypi
115-
permissions:
116-
id-token: write
117-
runs-on: ubuntu-latest
118-
if: github.event_name == 'release' && github.event.action == 'published'
119-
120-
steps:
121-
- uses: actions/download-artifact@v3
122-
with:
123-
name: artifact
124-
path: dist
125-
126-
- uses: pypa/gh-action-pypi-publish@release/v1
127-
if: github.event_name == 'release' && github.event.action == 'published'
128-
with:
129-
# Remember to tell (test-)pypi about this repo before publishing
130-
# Remove this line to publish to PyPI
131-
repository-url: https://test.pypi.org/legacy/
132-
{%- if cookiecutter.backend == "trampolim" %}
133-
# Check not supported currently by twine + trampolim
134-
verify-metadata: false
135-
{%- endif %}
136-
137-
{%- endif %}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
- main
10+
- develop
11+
release:
12+
types:
13+
- published
14+
15+
concurrency:
16+
group: {% raw %}${{ github.workflow }}-${{ github.ref }}{% endraw %}
17+
cancel-in-progress: true
18+
19+
env:
20+
FORCE_COLOR: 3
21+
22+
jobs:
23+
dist:
24+
needs: [pre-commit]
25+
name: Distribution build
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Build sdist and wheel
34+
run: pipx run build
35+
36+
- uses: actions/upload-artifact@v3
37+
with:
38+
path: dist
39+
40+
{%- if cookiecutter.backend != "trampolim" %}
41+
42+
- name: Check products
43+
run: pipx run twine check dist/*
44+
45+
{%- endif %}
46+
47+
publish:
48+
needs: [dist]
49+
name: Publish to PyPI
50+
environment: pypi
51+
permissions:
52+
id-token: write
53+
runs-on: ubuntu-latest
54+
if: github.event_name == 'release' && github.event.action == 'published'
55+
56+
steps:
57+
- uses: actions/download-artifact@v3
58+
with:
59+
name: artifact
60+
path: dist
61+
62+
- uses: pypa/gh-action-pypi-publish@release/v1
63+
if: github.event_name == 'release' && github.event.action == 'published'
64+
with:
65+
# Remember to tell (test-)pypi about this repo before publishing
66+
# Remove this line to publish to PyPI
67+
repository-url: https://test.pypi.org/legacy/
68+
{%- if cookiecutter.backend == "trampolim" %}
69+
# Check not supported currently by twine + trampolim
70+
verify-metadata: false
71+
{%- endif %}

{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type == 'compiled' %}wheels.yml{% endif %} renamed to {{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %}

File renamed without changes.

{{cookiecutter.project_name}}/{% if cookiecutter.__ci == 'gitlab' %}.gitlab-ci.yml{% endif %} renamed to {{cookiecutter.project_name}}/{% if cookiecutter.__ci=='gitlab' %}.gitlab-ci.yml{% endif %}

File renamed without changes.

{{cookiecutter.project_name}}/{% if cookiecutter.license == 'Apache' %}LICENSE{% endif %} renamed to {{cookiecutter.project_name}}/{% if cookiecutter.license=='Apache' %}LICENSE{% endif %}

File renamed without changes.

{{cookiecutter.project_name}}/{% if cookiecutter.license == 'BSD' %}LICENSE{% endif %} renamed to {{cookiecutter.project_name}}/{% if cookiecutter.license=='BSD' %}LICENSE{% endif %}

File renamed without changes.

{{cookiecutter.project_name}}/{% if cookiecutter.license == 'MIT' %}LICENSE{% endif %} renamed to {{cookiecutter.project_name}}/{% if cookiecutter.license=='MIT' %}LICENSE{% endif %}

File renamed without changes.

0 commit comments

Comments
 (0)