Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5293831165 | |||
| 87606d152a |
@@ -9,24 +9,42 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
lint-and-typecheck:
|
||||||
name: Lint, Typecheck & Test
|
name: Lint & Typecheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: http://gitea:3000/zhou/checkout.git@main
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: http://gitea:3000/zhou/setup-uv.git@v8.1.0
|
- uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
uv-version: "0.5.21" # 或 "0.6.0" 等你需要的版本
|
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
|
||||||
- uses: http://gitea:3000/zhou/setup-python.git@v6
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.13'
|
||||||
|
|
||||||
|
- run: uv sync
|
||||||
|
- run: uv run ruff check src tests
|
||||||
|
- run: uv run pyrefly check .
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test (${{ matrix.os }})
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: astral-sh/setup-uv@v5
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: |
|
python-version: |
|
||||||
3.8
|
3.8
|
||||||
3.13
|
3.13
|
||||||
|
|
||||||
- run: uv sync
|
|
||||||
- run: uv run ruff check src tests
|
|
||||||
- run: uv run pyrefly check .
|
|
||||||
- run: uvx tox run -e py38,py313
|
- run: uvx tox run -e py38,py313
|
||||||
|
|||||||
@@ -6,42 +6,56 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
build:
|
||||||
name: Build, Publish & Release
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- uses: http://gitea:3000/zhou/checkout.git@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: http://gitea:3000/zhou/setup-uv.git@v8.1.0
|
- uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
|
||||||
- uses: http://gitea:3000/zhou/setup-python.git@v6
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.13'
|
python-version: '3.13'
|
||||||
|
|
||||||
- run: uv build
|
- run: uv build
|
||||||
|
|
||||||
- uses: http://gitea:3000/zhou/gh-action-pypi-publish.git@release/v1
|
- id: version
|
||||||
with:
|
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Gitea Release
|
- uses: actions/upload-artifact@v7
|
||||||
run: |
|
with:
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
name: dist
|
||||||
REPO=${GITHUB_REPOSITORY}
|
path: dist/
|
||||||
UPLOAD_URL=$(curl -s -X POST "https://git.gookeryoung.cn/api/v1/repos/${REPO}/releases" \
|
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
publish-pypi:
|
||||||
-H "Content-Type: application/json" \
|
needs: build
|
||||||
-d "{\"tag_name\": \"v${VERSION}\", \"name\": \"v${VERSION}\", \"draft\": false, \"prerelease\": false}" \
|
runs-on: ubuntu-latest
|
||||||
| jq -r '.upload_url')
|
environment: pypi
|
||||||
for file in dist/*; do
|
steps:
|
||||||
curl -s -X POST "${UPLOAD_URL}?name=$(basename $file)" \
|
- uses: actions/download-artifact@v8
|
||||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
with:
|
||||||
-H "Content-Type: application/octet-stream" \
|
name: dist
|
||||||
--data-binary @"$file"
|
path: dist
|
||||||
done
|
|
||||||
env:
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
GITEA_URL: ${{ secrets.GITEA_URL || 'https://git.gookeryoung.cn' }}
|
|
||||||
|
release:
|
||||||
|
needs: [build, publish-pypi]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
- uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: dist/*
|
||||||
|
generate_release_notes: true
|
||||||
|
|||||||
Reference in New Issue
Block a user