Skip to content

Commit aaad563

Browse files
authored
Rework GitHub workflows (#46)
* Rework docs workflow * Fix docs workflow * Remove uncessary permissions from ruff workflow * rework test workflow * Rework release workflow * merge docs and pypi workflow into build * enable cache and improve naming * split dist in dist and dist-release * seperate publishing action in seperated release workflow
1 parent 8757038 commit aaad563

File tree

6 files changed

+102
-93
lines changed

6 files changed

+102
-93
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: build
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [ opened, reopened, synchronize ]
7+
release:
8+
types: [ published ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
- name: Setup Python 3.10
20+
uses: actions/setup-python@v6
21+
with:
22+
python-version: "3.10"
23+
- name: Setup UV
24+
uses: astral-sh/setup-uv@v6
25+
with:
26+
enable-cache: true
27+
- name: Install dependencies
28+
run: uv sync --extra docs
29+
- name: Build documentation
30+
run: |
31+
cd docs
32+
uv run sphinx-build -b html -j auto -a -n -T -W --keep-going . _build/html
33+
dist:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v5
37+
- name: Setup Python 3.10
38+
uses: actions/setup-python@v6
39+
with:
40+
python-version: "3.10"
41+
- name: Setup UV
42+
uses: astral-sh/setup-uv@v6
43+
with:
44+
enable-cache: true
45+
- name: Install dependencies
46+
run: uv sync
47+
- name: Build distributions
48+
run: uv build

.github/workflows/docs.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ permissions:
1010

1111
jobs:
1212
ruff:
13-
permissions:
14-
contents: read
1513
runs-on: ubuntu-latest
1614
steps:
1715
- uses: actions/checkout@v5
1816

19-
- name: Get Ruff Version
17+
- name: Get Ruff version
2018
id: ruff-version
2119
run: echo "version=$(grep -Po '(?<=ruff==)[0-9]+\.[0-9]+\.[0-9]+' pyproject.toml)" >> $GITHUB_OUTPUT
22-
23-
- uses: astral-sh/ruff-action@v3
20+
21+
- name: Run Ruff linter
22+
uses: astral-sh/ruff-action@v3
2423
with:
2524
version: ${{ steps.ruff-version.outputs.version }}
2625
pyright:

.github/workflows/pypi.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
dist:
13+
if: github.event_name == 'release'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
environment:
18+
name: pypi
19+
url: https://pypi.org/p/fortnite-api
20+
steps:
21+
- uses: actions/checkout@v5
22+
- name: Setup Python 3.10
23+
uses: actions/setup-python@v6
24+
with:
25+
python-version: "3.10"
26+
- name: Setup UV
27+
uses: astral-sh/setup-uv@v6
28+
with:
29+
enable-cache: true
30+
- name: Install dependencies
31+
run: uv sync
32+
- name: Build distributions
33+
run: uv build
34+
- name: Publish distributions
35+
run: uv publish

.github/workflows/test.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will ensure that the pushed contents to the repo
22
# are not majorly breaking.
33

4-
name: Pytests
4+
name: test
55

66
on:
77
push:
@@ -14,27 +14,26 @@ permissions:
1414

1515
jobs:
1616
pytest:
17-
name: Pytest
1817
runs-on: ubuntu-latest
19-
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: [ '3.10', '3.x' ]
22+
name: pytest ${{ matrix.python-version }}
2023
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v5
23-
24-
- name: Setup Python 3.10
24+
- uses: actions/checkout@v5
25+
- name: Setup Python ${{ matrix.python-version }}
2526
uses: actions/setup-python@v6
2627
with:
27-
python-version: "3.10"
28+
python-version: ${{ matrix.python-version }}
2829
cache: "pip" # Cache the pip packages to speed up the workflow
29-
30+
- name: Set up UV
31+
uses: astral-sh/setup-uv@v6
32+
with:
33+
enable-cache: true
3034
- name: Install Dependencies and Package
31-
run: |
32-
python -m pip install -U pip setuptools
33-
pip install -U -r requirements.txt
34-
pip install -e .[tests]
35-
35+
run: uv sync --extra tests
3636
- name: Run Pytest Checks
37-
shell: bash
3837
env:
3938
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
40-
run: python -m pytest --cov=fortnite_api --import-mode=importlib -vs tests/
39+
run: uv run pytest --cov=fortnite_api --import-mode=importlib -vs tests/

0 commit comments

Comments
 (0)