Skip to content

Commit a53c2de

Browse files
setup ci/cd
1 parent 558c112 commit a53c2de

3 files changed

Lines changed: 81 additions & 6 deletions

File tree

.github/workflows/deploy-prod.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy to PyPI (Production)
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/tests.yml
11+
12+
deploy:
13+
needs: test
14+
runs-on: ubuntu-latest
15+
environment: prod
16+
permissions:
17+
id-token: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install build tools
28+
run: pip install build
29+
30+
- name: Build package
31+
run: python -m build
32+
33+
- name: Publish to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/deploy-stage.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy to TestPyPI (Staging)
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/tests.yml
11+
12+
deploy:
13+
needs: test
14+
runs-on: ubuntu-latest
15+
environment: stage
16+
permissions:
17+
id-token: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install build tools
28+
run: pip install build
29+
30+
- name: Append dev version suffix
31+
run: |
32+
sed -i "s/^version = \"\(.*\)\"/version = \"\1.dev${{ github.run_number }}\"/" pyproject.toml
33+
34+
- name: Build package
35+
run: python -m build
36+
37+
- name: Publish to TestPyPI
38+
uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
repository-url: https://test.pypi.org/legacy/
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
name: CI
1+
name: Tests
22

33
on:
44
push:
5-
branches: [develop, main]
5+
branches: ["**"]
66
pull_request:
7-
branches: [develop, main]
7+
branches: ["**"]
8+
workflow_call:
89

910
jobs:
1011
test:
1112
runs-on: ubuntu-latest
1213
strategy:
1314
matrix:
14-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1516

1617
steps:
1718
- uses: actions/checkout@v4
@@ -23,8 +24,8 @@ jobs:
2324

2425
- name: Install dependencies
2526
run: |
26-
pip install pyyaml jinja2 pytest pytest-cov
27+
pip install pytest
2728
pip install -e .
2829
2930
- name: Run tests
30-
run: pytest tests/ --cov=tempyenv --cov-report=term-missing
31+
run: pytest tests/

0 commit comments

Comments
 (0)