Skip to content

Commit 0bbcc0f

Browse files
committed
ci(coverage.yml): Update workflow trigger to run on release event with type published
ci(pre_release.yml): Add workflow to publish package to test PyPI on push to tags matching '*.*.*' ci(release.yml): Update workflow trigger to run on release event with type published ci(tests.yml): Update workflow trigger to run on workflow_call and pull_request events docs(README.md): Update Tests badge URL to point to the correct workflow file for status display
1 parent 2292cbb commit 0bbcc0f

File tree

5 files changed

+73
-43
lines changed

5 files changed

+73
-43
lines changed

.github/workflows/coverage.yml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
# name: Coverage
2-
# on:
3-
# push:
4-
# branches:
5-
# - master
1+
name: Coverage
2+
on:
3+
release:
4+
types: [published]
65

7-
# jobs:
8-
# coverage:
9-
# runs-on: ubuntu-22.04
10-
# steps:
11-
# - uses: actions/checkout@v4
12-
# - uses: actions/setup-python@v4
13-
# with:
14-
# python-version: "3.12"
15-
# - name: Install Poetry
16-
# uses: abatilo/actions-poetry@v2
17-
# - name: Setup a local virtual environment
18-
# run: |
19-
# poetry config virtualenvs.create true --local
20-
# poetry config virtualenvs.in-project true --local
21-
# - uses: actions/cache@v3
22-
# name: Define a cache for the virtual environment based on the dependencies lock file
23-
# with:
24-
# path: ./.venv
25-
# key: venv-${{ hashFiles('poetry.lock') }}
26-
# - name: Install dependencies
27-
# run: poetry install
28-
# - name: Run tests and collect coverage
29-
# run: poetry run pytest --cov --cov-report=xml
30-
# - name: Upload coverage raports to Codecov
31-
# uses: codecov/codecov-action@v4.0.1
32-
# with:
33-
# token: ${{ secrets.CODECOV_TOKEN }}
6+
jobs:
7+
coverage:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v4
12+
with:
13+
python-version: "3.12"
14+
- name: Install Poetry
15+
uses: abatilo/actions-poetry@v2
16+
- name: Setup a local virtual environment
17+
run: |
18+
poetry config virtualenvs.create true --local
19+
poetry config virtualenvs.in-project true --local
20+
- uses: actions/cache@v3
21+
name: Define a cache for the virtual environment based on the dependencies lock file
22+
with:
23+
path: ./.venv
24+
key: venv-${{ hashFiles('poetry.lock') }}
25+
- name: Install dependencies
26+
run: poetry install
27+
- name: Run tests and collect coverage
28+
run: poetry run pytest --cov --cov-report=xml
29+
- name: Upload coverage raports to Codecov
30+
uses: codecov/codecov-action@v4.0.1
31+
with:
32+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pre_release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to test PyPI
2+
on:
3+
push:
4+
tags:
5+
- '*.*.*'
6+
7+
jobs:
8+
tests:
9+
uses: ./.github/workflows/tests.yml
10+
release:
11+
runs-on: ubuntu-22.04
12+
needs: tests
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.12"
18+
- name: Install Poetry
19+
uses: abatilo/actions-poetry@v2
20+
- name: Setup a local virtual environment
21+
run: |
22+
poetry config virtualenvs.create true --local
23+
poetry config virtualenvs.in-project true --local
24+
- uses: actions/cache@v3
25+
name: Define a cache for the virtual environment based on the dependencies lock file
26+
with:
27+
path: ./.venv
28+
key: venv-${{ hashFiles('poetry.lock') }}
29+
- name: Install dependencies
30+
run: poetry install
31+
- name: Configure poetry for publishing to test PyPI
32+
run: |
33+
poetry config repositories.testpypi https://test.pypi.org/legacy/
34+
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
35+
- name: Publish package to test PyPI
36+
run: poetry publish --build -r testpypi

.github/workflows/release.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: Publish to PyPI
22
on:
3-
# release:
4-
# types: [published]
5-
push:
6-
branches:
7-
- master
3+
release:
4+
types: [published]
85

96
jobs:
107
tests:
@@ -30,8 +27,7 @@ jobs:
3027
key: venv-${{ hashFiles('poetry.lock') }}
3128
- name: Install dependencies
3229
run: poetry install
33-
- name: Configure poetry for publishing
30+
- name: Configure poetry for publishing to PyPI
3431
run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
3532
- name: Publish package to PyPI
36-
# run: poetry publish --build
37-
run: echo "Published"
33+
run: poetry publish --build

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Tests
2-
on:
3-
workflow_call:
2+
on: [workflow_call, pull_request]
43

54
jobs:
65
tests:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
44
![GitHub License](https://img.shields.io/github/license/SpaceShaman/pypi-workflow)
5-
![Tests](https://img.shields.io/github/actions/workflow/status/SpaceShaman/pypi-workflow/tests.yml?label=tests)
5+
![Tests](https://img.shields.io/github/actions/workflow/status/SpaceShaman/pypi-workflow/release.yml?label=tests)
66
![Codecov](https://img.shields.io/codecov/c/github/SpaceShaman/pypi-workflow)
77
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pypi-workflow)
88
[![PyPI - Version](https://img.shields.io/pypi/v/pypi-workflow)](https://pypi.org/project/pypi-workflow)

0 commit comments

Comments
 (0)