Skip to content

Commit baa30dc

Browse files
committed
Add Woodpecker CI scripts.
PR: USTC-KnowledgeComputingLab/qmb#50 Signed-off-by: Hao Zhang <[email protected]>
2 parents 522af85 + ce81031 commit baa30dc

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed

.woodpecker/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder contains scripts for testing in our own CI/CD platform based on Woodpecker CI, located in the USTC Knowledge Computing Laboratory. These scripts may contain many hard-coded absolute URLs, so they should not be used elsewhere.

.woodpecker/docker.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
when:
2+
- event: push
3+
- event: pull_request
4+
5+
variables:
6+
- &docker_config
7+
DOCKER_CACHE: /woodpecker/cache/docker
8+
- &minio_config
9+
MINIO_HOST: https://s3.kclab.cloud
10+
MINIO_ACCESS_KEY:
11+
from_secret: minio_access_key
12+
MINIO_SECRET_KEY:
13+
from_secret: minio_secret_key
14+
MINIO_BUCKET: cache-53030
15+
16+
clone:
17+
git:
18+
image: woodpeckerci/plugin-git:2.6
19+
settings:
20+
tags: true
21+
partial: false
22+
23+
steps:
24+
- name: open cache
25+
image: minio/mc:latest
26+
environment:
27+
<<: [*docker_config, *minio_config]
28+
commands:
29+
- mkdir --parents $${DOCKER_CACHE}
30+
- touch $${DOCKER_CACHE}/.keep
31+
- mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY}
32+
- mc cp --recursive minio/$${MINIO_BUCKET}/${CI_REPO}/docker/ $${DOCKER_CACHE}/
33+
failure: ignore
34+
35+
- name: tagging
36+
image: mcp/git:latest
37+
commands:
38+
- git describe --tags | tee .tag
39+
40+
- name: docker
41+
image: woodpeckerci/plugin-docker-buildx:6-insecure
42+
settings:
43+
repo: git.kclab.cloud/hzhangxyz/qmb
44+
username: hzhangxyz
45+
password:
46+
from_secret: gitea_package
47+
registry: git.kclab.cloud
48+
tags_file: .tag
49+
cache-to: type=local,dest=/woodpecker/cache/docker
50+
cache-from:
51+
- type=local\\,src=/woodpecker/cache/docker
52+
buildkit_config: |
53+
[registry."docker.io"]
54+
mirrors = ["https://docker.mirrors.kclab.cloud/"]
55+
build_args:
56+
PYPI_MIRROR: https://mirrors.ustc.edu.cn/pypi/simple
57+
58+
- name: save cache
59+
image: minio/mc:latest
60+
environment:
61+
<<: [*docker_config, *minio_config]
62+
commands:
63+
- mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY}
64+
- mc cp --recursive $${DOCKER_CACHE}/ minio/$${MINIO_BUCKET}/${CI_REPO}/docker/
65+
failure: ignore

.woodpecker/pre-commit.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
when:
2+
- event: push
3+
- event: pull_request
4+
5+
variables:
6+
- &pip_config
7+
PIP_INDEX_URL: https://mirrors.ustc.edu.cn/pypi/simple
8+
- &pre_commit_config
9+
PRE_COMMIT_HOME: /woodpecker/cache/pre-commit
10+
- &minio_config
11+
MINIO_HOST: https://s3.kclab.cloud
12+
MINIO_ACCESS_KEY:
13+
from_secret: minio_access_key
14+
MINIO_SECRET_KEY:
15+
from_secret: minio_secret_key
16+
MINIO_BUCKET: cache-53030
17+
18+
steps:
19+
- name: open cache
20+
image: minio/mc:latest
21+
environment:
22+
<<: [*pre_commit_config, *minio_config]
23+
commands:
24+
- mkdir --parents $${PRE_COMMIT_HOME}
25+
- touch $${PRE_COMMIT_HOME}/.keep
26+
- mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY}
27+
- mc cp --recursive minio/$${MINIO_BUCKET}/${CI_REPO}/pre-commit/ $${PRE_COMMIT_HOME}/
28+
failure: ignore
29+
30+
- name: pre-commit
31+
image: python:3.12
32+
environment:
33+
<<: [*pre_commit_config, *pip_config]
34+
commands:
35+
- pip install pre-commit
36+
- pip install '.[dev]'
37+
- pre-commit run --all-files
38+
39+
- name: save cache
40+
image: minio/mc:latest
41+
environment:
42+
<<: [*pre_commit_config, *minio_config]
43+
commands:
44+
- mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY}
45+
- mc cp --recursive $${PRE_COMMIT_HOME}/ minio/$${MINIO_BUCKET}/${CI_REPO}/pre-commit/

.woodpecker/wheels.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
when:
2+
- event: push
3+
- event: pull_request
4+
5+
variables:
6+
- &pip_config
7+
PIP_INDEX_URL: https://mirrors.ustc.edu.cn/pypi/simple
8+
- &repo_config
9+
TWINE_REPOSITORY_URL: https://git.kclab.cloud/api/packages/hzhangxyz/pypi
10+
TWINE_USERNAME: hzhangxyz
11+
TWINE_PASSWORD:
12+
from_secret: gitea_package
13+
14+
clone:
15+
git:
16+
image: woodpeckerci/plugin-git:2.6
17+
settings:
18+
tags: true
19+
partial: false
20+
21+
steps:
22+
- name: build
23+
image: python:3.12
24+
environment:
25+
<<: *pip_config
26+
commands:
27+
- pip install pipx
28+
- pipx run build
29+
30+
- name: upload
31+
image: python:3.12
32+
environment:
33+
<<: [*pip_config, *repo_config]
34+
commands:
35+
- pip install pipx
36+
- pipx run twine upload dist/* --verbose

0 commit comments

Comments
 (0)