-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better structure for workflows (ci+cd)
Signed-off-by: Henry Schreiner <[email protected]>
- Loading branch information
Showing
7 changed files
with
74 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{%- set compiled = cookiecutter.backend in ["pybind11", "maturin", "skbuild", "mesonpy"] -%} | ||
name: CI | ||
|
||
on: | ||
|
@@ -9,11 +8,6 @@ on: | |
- master | ||
- main | ||
- develop | ||
{%- if not compiled %} | ||
release: | ||
types: | ||
- published | ||
{%- endif %} | ||
|
||
concurrency: | ||
group: {% raw %}${{ github.workflow }}-${{ github.ref }}{% endraw %} | ||
|
@@ -66,9 +60,11 @@ jobs: | |
allow-prereleases: true | ||
|
||
{%- if cookiecutter.backend == "mesonpy" %} | ||
|
||
- name: Activate MSVC for Meson | ||
if: runner.os == 'Windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
{%- endif %} | ||
|
||
- name: Install package | ||
|
@@ -82,56 +78,3 @@ jobs: | |
- name: Upload coverage report | ||
uses: codecov/[email protected] | ||
|
||
{%- if not compiled %} | ||
|
||
dist: | ||
needs: [pre-commit] | ||
name: Distribution build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build sdist and wheel | ||
run: pipx run build | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist | ||
|
||
{%- if cookiecutter.backend != "trampolim" %} | ||
|
||
- name: Check products | ||
run: pipx run twine check dist/* | ||
|
||
{%- endif %} | ||
|
||
publish: | ||
needs: [dist] | ||
name: Publish to PyPI | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
with: | ||
# Remember to tell (test-)pypi about this repo before publishing | ||
# Remove this line to publish to PyPI | ||
repository-url: https://test.pypi.org/legacy/ | ||
{%- if cookiecutter.backend == "trampolim" %} | ||
# Check not supported currently by twine + trampolim | ||
verify-metadata: false | ||
{%- endif %} | ||
|
||
{%- endif %} |
72 changes: 72 additions & 0 deletions
72
...roject_name}}/.github/workflows/{% if cookiecutter.__type!='compiled' %}cd.yml{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: CD | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: {% raw %}${{ github.workflow }}-${{ github.ref }}{% endraw %} | ||
cancel-in-progress: true | ||
|
||
env: | ||
FORCE_COLOR: 3 | ||
|
||
jobs: | ||
dist: | ||
needs: [pre-commit] | ||
name: Distribution build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build sdist and wheel | ||
run: pipx run build | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist | ||
|
||
{%- if cookiecutter.backend != "trampolim" %} | ||
|
||
- name: Check products | ||
run: pipx run twine check dist/* | ||
|
||
{%- endif %} | ||
|
||
publish: | ||
needs: [dist] | ||
name: Publish to PyPI | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
with: | ||
# Remember to tell (test-)pypi about this repo before publishing | ||
# Remove this line to publish to PyPI | ||
repository-url: https://test.pypi.org/legacy/ | ||
{%- if cookiecutter.backend == "trampolim" %} | ||
# Check not supported currently by twine + trampolim | ||
verify-metadata: false | ||
{%- endif %} | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.