mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 11:26:43 +08:00
152 lines
4.0 KiB
YAML
152 lines
4.0 KiB
YAML
version: 2.1
|
|
|
|
orbs:
|
|
# The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files
|
|
# Orb commands and jobs help you with common scripting around a language/tool
|
|
# so you dont have to copy and paste it everywhere.
|
|
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
|
|
python: circleci/python@1.4
|
|
node: circleci/node@4.7.0
|
|
# poetry: frameio/poetry@0.21.0
|
|
swissknife: roopakv/swissknife@0.59.0
|
|
docker: circleci/docker@1.7.0
|
|
|
|
workflows:
|
|
build-test-publish:
|
|
jobs:
|
|
- build-frontend:
|
|
filters:
|
|
tags:
|
|
only: /.*/
|
|
- test:
|
|
requires:
|
|
- build-frontend
|
|
filters:
|
|
tags:
|
|
only: /.*/
|
|
- build:
|
|
requires:
|
|
- test
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /^v.*/
|
|
- publish-pypi:
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /^v.*/
|
|
- publish-github-release:
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /^v.*/
|
|
- docker/publish: &docker-push
|
|
name: "Docker release version"
|
|
requires:
|
|
- test
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /^v.*/
|
|
context:
|
|
- docker
|
|
image: $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
|
|
tag: latest,${CIRCLE_TAG}
|
|
update-description: true
|
|
docker-username: DOCKERHUB_USERNAME
|
|
docker-password: DOCKERHUB_PASSWORD
|
|
- docker/publish:
|
|
<<: *docker-push
|
|
name: "Docker debug version"
|
|
filters:
|
|
tags:
|
|
ignore: /.*/
|
|
tag: ${CIRCLE_BRANCH}
|
|
|
|
jobs:
|
|
build-frontend:
|
|
docker:
|
|
- image: cimg/node:16.13.0
|
|
steps:
|
|
- checkout
|
|
- node/install-packages:
|
|
app-dir: ./admin-frontend
|
|
pkg-manager: yarn
|
|
- run:
|
|
name: yarn build
|
|
working_directory: ./admin-frontend
|
|
command: yarn build
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- "src/plugins/nonebot_bison/admin_page/dist/"
|
|
test:
|
|
docker:
|
|
- image: cimg/python:3.9
|
|
- image: browserless/chrome
|
|
environment:
|
|
BISON_BROWSER: ws://localhost:3000
|
|
steps:
|
|
- checkout
|
|
# - run: sed -e '41,45d' -i pyproject.toml
|
|
- python/install-packages:
|
|
pkg-manager: poetry
|
|
- run:
|
|
name: Coverage test
|
|
command: poetry run coverage run -m pytest --junitxml=test-results/junit.xml -k 'not compare'
|
|
- store_test_results:
|
|
path: test-results
|
|
- run:
|
|
name: Collect coverage
|
|
command: poetry run coverage html --include='src/*'
|
|
- store_artifacts:
|
|
path: htmlcov
|
|
build:
|
|
docker:
|
|
- image: cimg/python:3.9
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: .src/plugins/nonebot_bison/admin_page/dist/
|
|
- run: poetry build
|
|
- store_artifacts:
|
|
path: "dist"
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- "dist"
|
|
publish-pypi:
|
|
docker:
|
|
- image: cimg/python3.9
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ./dist
|
|
- run:
|
|
command: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
|
|
name: Publish to Pypi
|
|
|
|
publish-github-release:
|
|
docker:
|
|
- image: circleci/golang:1.8
|
|
steps:
|
|
- attach_workspace:
|
|
at: ./dist
|
|
- run:
|
|
name: Publish to Github Release
|
|
command: |
|
|
go get github.com/tcnksm/ghr
|
|
VERSION=$(cat pyproject.toml | grep version | sed 's/version = "\([0-9\.]*\)"/\1/')
|
|
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./dist
|
|
|
|
|