Skip to content

Commit 91f80f3

Browse files
committed
feat: add woodpecker
1 parent 2979f70 commit 91f80f3

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .pre-commit-config.yaml
2+
repos:
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
rev: v0.6.8
5+
hooks:
6+
- id: ruff
7+
args: [--fix]
8+
- id: ruff-format
9+
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.6.0
12+
hooks:
13+
- id: trailing-whitespace
14+
- id: end-of-file-fixer
15+
- id: check-yaml
16+
17+
- repo: https://github.com/pre-commit/mirrors-mypy
18+
rev: v1.13.0
19+
hooks:
20+
- id: mypy

.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/pre-commit.yml

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

0 commit comments

Comments
 (0)