Skip to content

Commit 336008f

Browse files
infra: migrate to uv (#84)
* infra: migrate to uv * infra: migrate to uv * ci: remove extra from template * ci: add changelog genny * Update README.md Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * chore: update startcmd * fix: adjust targets * fix: adjust for dep updates * fix: try to make railway happy * fix: try to make railway happy again * Revert "fix: try to make railway happy again" This reverts commit b22d757. * fix: try to make railway happy again 3 * fix: try to make railway happy again 4 * fix: try to make railway happy again 5 * fix: try to make railway happy again 6 * fix: try to make railway happy again 7 * fix: try to make railway happy again 8 * fix: try to make railway happy again 9 * fix: try to make railway happy again 10 * fix: try to make railway happy again 11 * fix: try to make railway happy again 12 * fix: try to make railway happy again 13 * python packaging is so fucking stupid * ci: apply lint --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 268c8e8 commit 336008f

File tree

158 files changed

+3222
-3750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+3222
-3750
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DISCORD_DEV_USER_ID=IDOfYourDevUser
88

99
# --- Project Settings
1010
# No Prefix for Project settings
11-
LITESTAR_APP=src.app:create_app
11+
LITESTAR_APP=byte_bot.app:create_app
1212
WEB_URL=https://byte-bot.app
1313
SECRET_KEY=ThisIsNotAProductionToken
1414
ENVIRONMENT=dev

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
[//]: # "- follow [PSFs's Code of Conduct](https://www.python.org/psf/conduct/)"
33
[//]: # "- follow [Bytes's contribution guidelines](https://github.com/JacobCoffee/byte/blob/main/CONTRIBUTING.rst)"
44

5-
### Pull Request Checklist
6-
7-
- [ ] New code has 100% test coverage
8-
- [ ] (If applicable) The prose documentation has been updated to reflect the changes introduced by this PR
9-
- [ ] (If applicable) The reference documentation has been updated to reflect the changes introduced by this PR
10-
- [ ] Pre-Commit Checks were ran and passed
11-
- [ ] Tests were ran and passed
12-
135
### Description
146
[//]: # "Please describe your pull request for new release changelog purposes"
157

.github/workflows/cd.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Continuous Deployment
2+
3+
on:
4+
workflow_dispatch:
5+
6+
7+
jobs:
8+
generate-changelog:
9+
name: Generate changelog
10+
runs-on: ubuntu-22.04
11+
outputs:
12+
release_body: ${{ steps.git-cliff.outputs.content }}
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Generate a changelog
20+
uses: orhun/git-cliff-action@main
21+
id: git-cliff
22+
with:
23+
config: pyproject.toml
24+
args: -vv --latest --strip header
25+
26+
- name: Commit changelog
27+
run: |
28+
git checkout main
29+
git config user.name 'github-actions[bot]'
30+
git config user.email 'github-actions[bot]@users.noreply.github.com'
31+
set +e
32+
git add docs/changelog.rst
33+
git commit -m "docs: update changelog"
34+
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git main

.github/workflows/ci.yml

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414

15-
- uses: actions/setup-python@v4
16-
with:
17-
python-version: "3.11"
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v3
17+
18+
- name: Set up Python
19+
run: uv python install 3.11
1820

19-
- name: Install Pre-Commit
20-
run: python -m pip install pre-commit && pre-commit install
21+
- name: Create virtual environment
22+
run: uv sync --all-extras --dev
23+
24+
- name: Install Pre-Commit hooks
25+
run: uv run pre-commit install
2126

2227
- name: Load cached Pre-Commit Dependencies
2328
id: cached-pre-commit-dependencies
@@ -27,14 +32,12 @@ jobs:
2732
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
2833

2934
- name: Execute Pre-Commit
30-
run: pre-commit run --show-diff-on-failure --color=always --all-files
35+
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files
3136

3237
test:
3338
runs-on: ubuntu-latest
3439
strategy:
3540
fail-fast: true
36-
matrix:
37-
python-version: ["3.11"]
3841
timeout-minutes: 15
3942
defaults:
4043
run:
@@ -43,18 +46,17 @@ jobs:
4346
- name: Check out repository
4447
uses: actions/checkout@v4
4548

46-
- uses: pdm-project/setup-pdm@v3
47-
name: Set up PDM
48-
with:
49-
python-version: ${{ matrix.python-version }}
50-
allow-python-prereleases: true
51-
cache: true
49+
- name: Install uv
50+
uses: astral-sh/setup-uv@v3
5251

53-
- name: Install dependencies
54-
run: pdm install
52+
- name: Set up Python
53+
run: uv python install 3.11
54+
55+
- name: Create virtual environment
56+
run: uv sync --all-extras --dev
5557

5658
- name: Test
57-
run: pdm run pytest
59+
run: uv run pytest
5860

5961
build-docs:
6062
env:
@@ -70,33 +72,27 @@ jobs:
7072
- name: Check out repository
7173
uses: actions/checkout@v4
7274

73-
- name: Set up Python
74-
uses: actions/setup-python@v4
75-
with:
76-
python-version: "3.11"
75+
- name: Install uv
76+
uses: astral-sh/setup-uv@v3
7777

78-
- uses: pdm-project/setup-pdm@v3
79-
name: Set up PDM
80-
with:
81-
python-version: "3.11"
82-
allow-python-prereleases: true
83-
cache: true
78+
- name: Set up Python
79+
run: uv python install 3.11
8480

85-
- name: Install dependencies
86-
run: pdm install -G:docs
81+
- name: Create virtual environment
82+
run: uv sync --all-extras --dev
8783

8884
- name: Build docs
89-
run: pdm run make docs
85+
run: uv run make docs
9086

9187
- name: Save PR number
92-
env:
93-
PR_NUMBER: ${{ github.event.number }}
94-
run: echo $PR_NUMBER > .pr_number
88+
run: |
89+
echo "${{ github.event.number }}" > .pr_number
9590
9691
- name: Upload artifact
97-
uses: actions/upload-artifact@v3
92+
uses: actions/upload-artifact@v4
9893
with:
9994
name: docs-preview
10095
path: |
10196
docs/_build/html
10297
.pr_number
98+
include-hidden-files: true

.github/workflows/docs-preview.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,33 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Download artifact
26-
uses: dawidd6/action-download-artifact@v2
26+
uses: dawidd6/action-download-artifact@v6
2727
with:
2828
workflow_conclusion: success
2929
run_id: ${{ github.event.workflow_run.id }}
3030
path: docs-preview
3131
name: docs-preview
3232

33-
- name: Set PR number
34-
run: echo "PR_NUMBER=$(cat docs-preview/.pr_number)" >> $GITHUB_ENV
33+
- name: Validate and set PR number
34+
run: |
35+
PR_NUMBER=$(cat docs-preview/.pr_number)
36+
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
37+
echo "Invalid PR number: $PR_NUMBER"
38+
exit 1
39+
fi
40+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
3541
3642
- name: Deploy docs preview
3743
uses: JamesIves/github-pages-deploy-action@v4
3844
with:
3945
folder: docs-preview/docs/_build/html
40-
token: ${{ secrets.DOCS_PREVIEW_DEPLOY_TOKEN }}
46+
token: ${{ secrets.DOCS_PREVIEW_DEPLOY_KEY }}
4147
repository-name: JacobCoffee/byte-docs-preview
4248
clean: false
4349
target-folder: ${{ env.PR_NUMBER }}
4450
branch: gh-pages
4551

46-
- uses: actions/github-script@v6
52+
- uses: actions/github-script@v7
4753
env:
4854
PR_NUMBER: ${{ env.PR_NUMBER }}
4955
with:

.github/workflows/docs.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,24 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23-
- uses: actions/setup-python@v4
24-
with:
25-
python-version: "3.11"
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
2625

27-
- uses: pdm-project/setup-pdm@v3
28-
name: Set up PDM
29-
with:
30-
python-version: "3.11"
31-
allow-python-prereleases: true
32-
cache: true
26+
- name: Set up Python
27+
run: uv python install 3.11
3328

3429
- name: Install dependencies
35-
run: pdm install -G:docs
30+
run: uv sync --all-extras --dev
3631

3732
- name: Fetch gh pages
3833
run: git fetch origin gh-pages --depth=1
3934

4035
- name: Build release docs
41-
run: pdm run python tools/build_docs.py docs-build
36+
run: uv run python tools/build_docs.py docs-build
4237
if: github.event_name == 'release'
4338

4439
- name: Build dev docs
45-
run: pdm run python tools/build_docs.py docs-build
40+
run: uv run python tools/build_docs.py docs-build
4641
if: github.event_name == 'push'
4742

4843
- name: Deploy

0 commit comments

Comments
 (0)