Skip to content

Commit 367d57f

Browse files
author
Antoine
committed
Add On Release workflow and setup scripts for multiple packages; update pyproject.toml to use dynamic versioning
1 parent 081a102 commit 367d57f

File tree

12 files changed

+136
-6
lines changed

12 files changed

+136
-6
lines changed

.github/workflows/OnRelease.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: On Release Workflow
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
python-version: ["3.10", "3.11", "3.12", "3.13"]
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pytest coverage
28+
29+
- name: Install make
30+
run: sudo apt-get install make
31+
32+
- name: Run tests
33+
run: make tests -k
34+
35+
- name: Upload test reports
36+
if: success() || failure()
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: test-reports-${{ matrix.python-version }}
40+
path: tests_reports/
41+
42+
- name: publish test report
43+
if: success() || failure()
44+
uses: mikepenz/action-junit-report@v5
45+
with:
46+
report_paths: tests_reports/**/report.xml
47+
include_passed: true
48+
check_name: Pytest Test Report (${{ matrix.python-version }})
49+
50+
build:
51+
runs-on: ubuntu-latest
52+
needs: test
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v4
56+
57+
- name: Set up Python 3.10
58+
uses: actions/setup-python@v5
59+
with:
60+
python-version: 3.10
61+
62+
- name: Install dependencies
63+
run: |
64+
python -m pip install --upgrade pip
65+
pip install build
66+
67+
- name: Build package
68+
run: make VERSION=${{ github.event.release.tag_name }}
69+
70+
- name: Upload package artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: package-artifacts-${{ github.event.release.tag_name }}
74+
path: |
75+
dist/*.tar.gz
76+
dist/*.whl
77+
78+
- name: Publish release assets
79+
uses: AButler/upload-release-assets@v3.0
80+
with:
81+
files: "dist/*"
82+
repo-token: ${{ secrets.GITHUB_TOKEN }}

build_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
check=True, stderr=sys.stderr, stdout=sys.stdout)
2323
except subprocess.CalledProcessError as e:
2424
print(f"Build failed with error code {e.returncode}")
25-
sys.exit(e.returncode)
25+
sys.exit(e.returncode)

cache/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
15
[project]
26
name = "cache"
3-
version = "0.1.0"
7+
dynamic = ["version"]
48
description = "A simple cache manager"
59
authors = [
610
{ name = "Antoine BUIREY", email = "antoine.buirey@gmail.com" }
File renamed without changes.

colors/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "colors"
3-
version = "0.1.0"
3+
dynamic = ["version"]
44
description = "A color class allowing to manipulate colors"
55
authors = [
66
{ name = "Antoine BUIREY", email = "antoine.buirey@gmail.com" }

colors/setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Setup script for the package, used by setuptools to build and install the package.
3+
"""
4+
5+
import os
6+
7+
from setuptools import setup
8+
9+
setup(
10+
version=os.environ.get("PACKAGE_VERSION", "0.0.0-dev")
11+
)

config/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "config"
3-
version = "0.1.0"
3+
dynamic = ["version"]
44
description = "A library to manage configuration files"
55
authors = [
66
{ name = "Antoine BUIREY", email = "antoine.buirey@gmail.com" }

config/setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Setup script for the package, used by setuptools to build and install the package.
3+
"""
4+
5+
import os
6+
7+
from setuptools import setup
8+
9+
setup(
10+
version=os.environ.get("PACKAGE_VERSION", "0.0.0-dev")
11+
)

http_code/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "http_code"
3-
version = "0.1.0"
3+
dynamic = ["version"]
44
description = "A list of HTTP status codes"
55
authors = [
66
{ name = "Antoine BUIREY", email = "antoine.buirey@gmail.com" }

http_code/setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Setup script for the package, used by setuptools to build and install the package.
3+
"""
4+
5+
import os
6+
7+
from setuptools import setup
8+
9+
setup(
10+
version=os.environ.get("PACKAGE_VERSION", "0.0.0-dev")
11+
)

0 commit comments

Comments
 (0)