Compare commits
4 Commits
main
...
0205baeab6
| Author | SHA1 | Date | |
|---|---|---|---|
| 0205baeab6 | |||
| bbcf80e0ca | |||
| 5293831165 | |||
| 87606d152a |
@@ -9,34 +9,12 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-and-typecheck:
|
ci:
|
||||||
name: Lint & Typecheck
|
name: Lint, Typecheck & Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
|
|
||||||
- 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
|
- uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
@@ -47,4 +25,7 @@ jobs:
|
|||||||
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,13 +6,11 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
id-token: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release:
|
||||||
|
name: Build, Publish & Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -26,36 +24,24 @@ jobs:
|
|||||||
|
|
||||||
- run: uv build
|
- run: uv build
|
||||||
|
|
||||||
- id: version
|
|
||||||
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
|
|
||||||
publish-pypi:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: pypi
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v8
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
|
||||||
release:
|
|
||||||
needs: [build, publish-pypi]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v8
|
|
||||||
with:
|
with:
|
||||||
name: dist
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
path: dist
|
|
||||||
|
|
||||||
- uses: softprops/action-gh-release@v2
|
- name: Create Gitea Release
|
||||||
with:
|
run: |
|
||||||
files: dist/*
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
generate_release_notes: true
|
REPO=${GITHUB_REPOSITORY}
|
||||||
|
UPLOAD_URL=$(curl -s -X POST "https://git.gookeryoung.cn/api/v1/repos/${REPO}/releases" \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"v${VERSION}\", \"name\": \"v${VERSION}\", \"draft\": false, \"prerelease\": false}" \
|
||||||
|
| jq -r '.upload_url')
|
||||||
|
for file in dist/*; do
|
||||||
|
curl -s -X POST "${UPLOAD_URL}?name=$(basename $file)" \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary @"$file"
|
||||||
|
done
|
||||||
|
env:
|
||||||
|
GITEA_URL: ${{ secrets.GITEA_URL || 'https://git.gookeryoung.cn' }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import getpass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Literal, get_args
|
from typing import Literal, get_args
|
||||||
|
|
||||||
@@ -254,6 +255,31 @@ def main() -> None:
|
|||||||
allow_upstream_skip=True,
|
allow_upstream_skip=True,
|
||||||
verbose=True,
|
verbose=True,
|
||||||
),
|
),
|
||||||
|
# 安装 Docker
|
||||||
|
px.TaskSpec(
|
||||||
|
"install_docker",
|
||||||
|
cmd=["sudo", "apt", "install", "-y", "docker-compose-v2"],
|
||||||
|
conditions=(BuiltinConditions.IS_LINUX(),),
|
||||||
|
depends_on=("install_mirror",),
|
||||||
|
allow_upstream_skip=True,
|
||||||
|
verbose=True,
|
||||||
|
),
|
||||||
|
px.TaskSpec(
|
||||||
|
"add_docker_group",
|
||||||
|
cmd=["sudo", "usermod", "-aG", "docker", getpass.getuser()],
|
||||||
|
conditions=(BuiltinConditions.IS_LINUX(),),
|
||||||
|
depends_on=("install_docker",),
|
||||||
|
allow_upstream_skip=True,
|
||||||
|
verbose=True,
|
||||||
|
),
|
||||||
|
px.TaskSpec(
|
||||||
|
"refresh_docker_group",
|
||||||
|
cmd=["newgrp", "docker"],
|
||||||
|
conditions=(BuiltinConditions.IS_LINUX(),),
|
||||||
|
depends_on=("add_docker_group",),
|
||||||
|
allow_upstream_skip=True,
|
||||||
|
verbose=True,
|
||||||
|
),
|
||||||
# 设置 Python 环境变量
|
# 设置 Python 环境变量
|
||||||
*setenv_group({
|
*setenv_group({
|
||||||
"PIP_INDEX_URL": PIP_INDEX_URLS[python_mirror],
|
"PIP_INDEX_URL": PIP_INDEX_URLS[python_mirror],
|
||||||
|
|||||||
Reference in New Issue
Block a user