Skip to content

Commit 0732ea6

Browse files
authored
Merge pull request #4 from render-engine/add-workflows
add tests for publish workflow
2 parents 2730efc + 193b610 commit 0732ea6

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build distribution
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
test:
9+
uses: ./.github/workflows/test.yml
10+
deploy:
11+
needs: test
12+
name: Deploy to PyPI
13+
permissions:
14+
id-token: write
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout source
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: 3.11
24+
cache: "pip" # caching pip dependencies
25+
- name: Install build dependencies
26+
run: python -m pip install build twine
27+
28+
- name: Build distributions
29+
run: python -m build
30+
31+
- name: Publish package to PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: PyTest
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
paths:
10+
- ".github/workflows/test.yml"
11+
- "src/**"
12+
- "tests/**"
13+
- "pyproject.toml"
14+
- "requirements.txt"
15+
16+
jobs:
17+
test-against-python-matrix:
18+
# Only test all the supported versions when a pull request is made or the workflow is called
19+
if: ${{github.event_name == 'workflow_call'}} || ${{github.event_name == 'pull_request'}}
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
python-version: ["3.10", "3.11", "3.12", "3.13"]
24+
fail-fast: true
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
cache: "pip" # caching pip dependencies
31+
- name: Install requirements
32+
run: |
33+
python -m pip install -e .[dev]
34+
- name: Run tests
35+
run: |
36+
python -m pytest
37+
38+
test-against-latest-os:
39+
# Always run against the latest version on both Windows, Linux, MacOS
40+
if: github.event.pull_request.user.login != 'dependabot[bot]'
41+
strategy:
42+
matrix:
43+
os: [windows-latest, macos-latest]
44+
fail-fast: true
45+
runs-on: ${{ matrix.os }}
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: "3.12"
51+
cache: "pip" # caching pip dependencies
52+
- name: Install requirements
53+
run: |
54+
python -m pip install -e .[dev]
55+
- name: Run tests
56+
run: |
57+
python -m pytest
58+
- name: coverage
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: code-coverage-report-${{ matrix.os }}
62+
path: .coverage
63+
overwrite: true

0 commit comments

Comments
 (0)