mirror of
https://github.com/Paillat-dev/pycord-reactive-views.git
synced 2026-01-02 01:06:18 +00:00
🏗️ Move from pdm to uv and add pre commit and other useful things
This commit is contained in:
25
.github/workflows/CI.yaml
vendored
Normal file
25
.github/workflows/CI.yaml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "dev" ]
|
||||
# Publish semver tags as releases.
|
||||
tags: [ 'v*.*.*' ]
|
||||
pull_request:
|
||||
branches: ["main", "dev"]
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
uses: ./.github/workflows/quality.yaml
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
publish:
|
||||
needs: quality
|
||||
if: github.event_name == 'release'
|
||||
uses: ./.github/workflows/publish.yaml
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
20
.github/workflows/CI.yml
vendored
20
.github/workflows/CI.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ./.github/workflows/tests.yml
|
||||
|
||||
publish:
|
||||
needs: tests
|
||||
if: github.event_name == 'release'
|
||||
uses: ./.github/workflows/publish.yml
|
||||
permissions:
|
||||
id-token: write
|
||||
31
.github/workflows/publish.yaml
vendored
Normal file
31
.github/workflows/publish.yaml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Quality Checks
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: "Install uv"
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
|
||||
- name: Build
|
||||
run: uv build
|
||||
|
||||
- name: Publish
|
||||
run: uv publish
|
||||
19
.github/workflows/publish.yml
vendored
19
.github/workflows/publish.yml
vendored
@@ -1,19 +0,0 @@
|
||||
name: Publish to PyPI
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
environment: release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup PDM
|
||||
uses: pdm-project/setup-pdm@v4
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Build and publish to PyPI
|
||||
run: pdm publish
|
||||
54
.github/workflows/quality.yaml
vendored
Normal file
54
.github/workflows/quality.yaml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: Quality Checks
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
|
||||
jobs:
|
||||
check-license-header:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Copywrite
|
||||
uses: hashicorp/setup-copywrite@5e3e8a26d7b9f8a508848ad0a069dfd2f7aa5339
|
||||
- name: Check Header Compliance
|
||||
run: copywrite headers --plan --config .copywrite.hcl
|
||||
|
||||
quality:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
check: [format, lint, basedpyright]
|
||||
include:
|
||||
- check: format
|
||||
name: "Format Check"
|
||||
command: "uv run ruff format --check ."
|
||||
- check: lint
|
||||
name: "Lint Check"
|
||||
command: "uv run ruff check ."
|
||||
- check: basedpyright
|
||||
name: "Type Check"
|
||||
command: "uv run basedpyright ."
|
||||
|
||||
name: ${{ matrix.name }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: "Install uv"
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
|
||||
- name: ${{ matrix.name }}
|
||||
run: ${{ matrix.command }}
|
||||
26
.github/workflows/tests.yml
vendored
26
.github/workflows/tests.yml
vendored
@@ -1,26 +0,0 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.11', '3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup PDM
|
||||
uses: pdm-project/setup-pdm@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: true
|
||||
- name: Install dependencies
|
||||
run: pdm install --no-lock --dev
|
||||
- name: Run Ruff linter
|
||||
run: pdm run ruff check . --no-fix
|
||||
- name: Run Ruff formatter
|
||||
run: pdm run ruff format . --check
|
||||
- name: Run Pyright
|
||||
run: pdm run basedpyright
|
||||
Reference in New Issue
Block a user