Skip to content

Commit 26e454e

Browse files
committed
Add workflows
1 parent 0edc862 commit 26e454e

3 files changed

Lines changed: 139 additions & 0 deletions

File tree

.github/workflows/cibuildwheel.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags:
6+
# ** matches 'zero or more of any character'
7+
- 'release-v[0-9]+.[0-9]+.[0-9]+**'
8+
- 'prerelease-v[0-9]+.[0-9]+.[0-9]+**'
9+
workflow_dispatch: # allows you to trigger manually
10+
11+
jobs:
12+
build_wheels:
13+
uses: explosion/gha-cibuildwheel/.github/workflows/cibuildwheel.yml@main
14+
permissions:
15+
contents: write
16+
actions: read
17+
with:
18+
wheel-name-pattern: "fastapi_explosion_extras-*.whl"
19+
pure-python: true
20+
create-release: ${{ startsWith(github.ref, 'refs/tags/release-') || startsWith(github.ref, 'refs/tags/prerelease-') }}
21+
secrets:
22+
gh-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish_pypi.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# The cibuildwheel action triggers on all pushes and PRs;
2+
# this action triggers on release publication.
3+
# The expected workflow is to create a draft release and let the wheels
4+
# upload, and then hit 'publish', which uploads to PyPi.
5+
6+
on:
7+
release:
8+
types:
9+
- published
10+
11+
jobs:
12+
upload_pypi:
13+
runs-on: ubuntu-latest
14+
environment:
15+
name: pypi
16+
url: https://pypi.org/p/fastapi-explosion-extras
17+
permissions:
18+
id-token: write
19+
contents: read
20+
if: github.event_name == 'release' && github.event.action == 'published'
21+
steps:
22+
- uses: robinraju/release-downloader@v1
23+
with:
24+
tag: ${{ github.event.release.tag_name }}
25+
fileName: '*'
26+
out-file-path: 'dist'
27+
- uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: ["*"]
8+
workflow_dispatch: # allows you to trigger manually
9+
10+
# When this workflow is queued, automatically cancel any previous running
11+
# or pending jobs from the same branch
12+
concurrency:
13+
group: tests-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
validate:
18+
name: Validate
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out repo
22+
uses: actions/checkout@v6
23+
24+
- name: Configure Python version
25+
uses: actions/setup-python@v6
26+
with:
27+
python-version: "3.13"
28+
29+
- name: black
30+
run: |
31+
python -m pip install black -c requirements.txt
32+
python -m black fastapi_explosion_extras --check
33+
- name: isort
34+
run: |
35+
python -m pip install isort -c requirements.txt
36+
python -m isort fastapi_explosion_extras --check
37+
- name: flake8
38+
run: |
39+
python -m pip install flake8 -c requirements.txt
40+
python -m flake8 fastapi_explosion_extras --show-source --statistics
41+
tests:
42+
name: Test
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: [ubuntu-latest, windows-latest, macos-latest]
47+
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
48+
49+
runs-on: ${{ matrix.os }}
50+
51+
steps:
52+
- name: Check out repo
53+
uses: actions/checkout@v6
54+
55+
- name: Configure Python version
56+
uses: actions/setup-python@v6
57+
with:
58+
python-version: ${{ matrix.python_version }}
59+
60+
- name: Build sdist
61+
run: |
62+
python -m pip install -U build pip setuptools
63+
python -m pip install -U -r requirements.txt
64+
python -m build --sdist
65+
66+
- name: Delete source directory
67+
run: rm -rf fastapi_explosion_extras
68+
shell: bash
69+
70+
- name: Uninstall all packages
71+
run: |
72+
python -m pip freeze > installed.txt
73+
python -m pip uninstall -y -r installed.txt
74+
75+
- name: Install from sdist
76+
run: |
77+
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
78+
python -m pip install dist/$SDIST
79+
shell: bash
80+
81+
- name: Test import
82+
run: python -c "import fastapi_explosion_extras" -Werror
83+
84+
- name: Install test requirements
85+
run: |
86+
python -m pip install -U -r requirements.txt
87+
88+
- name: Run tests
89+
run: |
90+
python -m pytest --pyargs fastapi_explosion_extras -Werror

0 commit comments

Comments
 (0)