-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 配置流水线与单测 * 添加Pyd兼容性检查 * 添加pytest * 兼容PydV2 * 兼容PydV2 * poetry update
- Loading branch information
Showing
15 changed files
with
1,093 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
template: | | ||
## What’s Changed | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,33 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python package | ||
name: PR Check | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main", "release" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
test-api-only: | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
os: [ macos-latest, windows-latest, ubuntu-latest ] | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
pydantic: ["pydantic>=2.0.0", "pydantic<2.0.0"] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
#---------------------------------------------- | ||
# check-out repo and set-up python | ||
#---------------------------------------------- | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
- name: Set up python | ||
id: setup-python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
#---------------------------------------------- | ||
# ----- install & configure poetry ----- | ||
#---------------------------------------------- | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
#---------------------------------------------- | ||
# install dependencies if cache does not exist | ||
#---------------------------------------------- | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
#---------------------------------------------- | ||
# lint & test | ||
#---------------------------------------------- | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
poetry run pytest | ||
#---------------------------------------------- | ||
# build & upload | ||
#---------------------------------------------- | ||
- name: Build package | ||
run: poetry build | ||
- name: Upload distribution | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: distribution | ||
path: dist/* | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install requirements | ||
run: | | ||
pip install poetry | ||
poetry export --with=dev --without-hashes -o requirements.txt | ||
pip install -r requirements.txt | ||
pip install "${{ matrix.pydantic }}" | ||
- name: Test with pytest | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,54 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Upload Python Package | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
permissions: | ||
contents: read | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
upload: | ||
publish-pypi-github: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: release | ||
url: https://pypi.org/p/nonebot-plugin-pixivbot | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
# write permission is required to create a github release | ||
contents: write | ||
# write permission is required for autolabeler | ||
# otherwise, read permission is required at least | ||
pull-requests: write | ||
|
||
steps: | ||
#---------------------------------------------- | ||
# check-out repo and set-up python | ||
#---------------------------------------------- | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
- name: Set up python | ||
id: setup-python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
#---------------------------------------------- | ||
# ----- install & configure poetry ----- | ||
#---------------------------------------------- | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
#---------------------------------------------- | ||
# install dependencies if cache does not exist | ||
#---------------------------------------------- | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
#---------------------------------------------- | ||
# build & publish | ||
#---------------------------------------------- | ||
- name: Build package | ||
run: poetry build | ||
- name: Upload distribution | ||
uses: actions/upload-artifact@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python environment | ||
uses: actions/setup-python@v3 | ||
with: | ||
name: distribution | ||
path: dist/* | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
python-version: "3.11" | ||
|
||
- name: Setup Poetry | ||
run: | | ||
pip install poetry | ||
- run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- uses: release-drafter/release-drafter@v5 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
name: Release ${{ env.TAG_NAME }} | ||
tag: ${{ env.TAG_NAME }} | ||
publish: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish PyPI and Github | ||
run: | | ||
poetry build | ||
ls dist/ | ||
gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish pypi | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.