diff --git a/.woodpecker/README.md b/.woodpecker/README.md new file mode 100644 index 0000000..e735a0f --- /dev/null +++ b/.woodpecker/README.md @@ -0,0 +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. diff --git a/.woodpecker/docker.yml b/.woodpecker/docker.yml new file mode 100644 index 0000000..db0ebb2 --- /dev/null +++ b/.woodpecker/docker.yml @@ -0,0 +1,65 @@ +when: + - event: push + - event: pull_request + +variables: + - &docker_config + DOCKER_CACHE: /woodpecker/cache/docker + - &minio_config + MINIO_HOST: https://s3.kclab.cloud + MINIO_ACCESS_KEY: + from_secret: minio_access_key + MINIO_SECRET_KEY: + from_secret: minio_secret_key + MINIO_BUCKET: cache-53030 + +clone: + git: + image: woodpeckerci/plugin-git:2.6 + settings: + tags: true + partial: false + +steps: + - name: open cache + image: minio/mc:latest + environment: + <<: [*docker_config, *minio_config] + commands: + - mkdir --parents $${DOCKER_CACHE} + - touch $${DOCKER_CACHE}/.keep + - mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY} + - mc cp --recursive minio/$${MINIO_BUCKET}/${CI_REPO}/docker/ $${DOCKER_CACHE}/ + failure: ignore + + - name: tagging + image: mcp/git:latest + commands: + - git describe --tags | tee .tag + + - name: docker + image: woodpeckerci/plugin-docker-buildx:6-insecure + settings: + repo: git.kclab.cloud/hzhangxyz/qmb + username: hzhangxyz + password: + from_secret: gitea_package + registry: git.kclab.cloud + tags_file: .tag + cache-to: type=local,dest=/woodpecker/cache/docker + cache-from: + - type=local\\,src=/woodpecker/cache/docker + buildkit_config: | + [registry."docker.io"] + mirrors = ["https://docker.mirrors.kclab.cloud/"] + build_args: + PYPI_MIRROR: https://mirrors.ustc.edu.cn/pypi/simple + + - name: save cache + image: minio/mc:latest + environment: + <<: [*docker_config, *minio_config] + commands: + - mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY} + - mc cp --recursive $${DOCKER_CACHE}/ minio/$${MINIO_BUCKET}/${CI_REPO}/docker/ + failure: ignore diff --git a/.woodpecker/pre-commit.yml b/.woodpecker/pre-commit.yml new file mode 100644 index 0000000..9449c8f --- /dev/null +++ b/.woodpecker/pre-commit.yml @@ -0,0 +1,45 @@ +when: + - event: push + - event: pull_request + +variables: + - &pip_config + PIP_INDEX_URL: https://mirrors.ustc.edu.cn/pypi/simple + - &pre_commit_config + PRE_COMMIT_HOME: /woodpecker/cache/pre-commit + - &minio_config + MINIO_HOST: https://s3.kclab.cloud + MINIO_ACCESS_KEY: + from_secret: minio_access_key + MINIO_SECRET_KEY: + from_secret: minio_secret_key + MINIO_BUCKET: cache-53030 + +steps: + - name: open cache + image: minio/mc:latest + environment: + <<: [*pre_commit_config, *minio_config] + commands: + - mkdir --parents $${PRE_COMMIT_HOME} + - touch $${PRE_COMMIT_HOME}/.keep + - mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY} + - mc cp --recursive minio/$${MINIO_BUCKET}/${CI_REPO}/pre-commit/ $${PRE_COMMIT_HOME}/ + failure: ignore + + - name: pre-commit + image: python:3.12 + environment: + <<: [*pre_commit_config, *pip_config] + commands: + - pip install pre-commit + - pip install '.[dev]' + - pre-commit run --all-files + + - name: save cache + image: minio/mc:latest + environment: + <<: [*pre_commit_config, *minio_config] + commands: + - mc alias set minio $${MINIO_HOST} $${MINIO_ACCESS_KEY} $${MINIO_SECRET_KEY} + - mc cp --recursive $${PRE_COMMIT_HOME}/ minio/$${MINIO_BUCKET}/${CI_REPO}/pre-commit/ diff --git a/.woodpecker/wheels.yml b/.woodpecker/wheels.yml new file mode 100644 index 0000000..9d1ef58 --- /dev/null +++ b/.woodpecker/wheels.yml @@ -0,0 +1,36 @@ +when: + - event: push + - event: pull_request + +variables: + - &pip_config + PIP_INDEX_URL: https://mirrors.ustc.edu.cn/pypi/simple + - &repo_config + TWINE_REPOSITORY_URL: https://git.kclab.cloud/api/packages/hzhangxyz/pypi + TWINE_USERNAME: hzhangxyz + TWINE_PASSWORD: + from_secret: gitea_package + +clone: + git: + image: woodpeckerci/plugin-git:2.6 + settings: + tags: true + partial: false + +steps: + - name: build + image: python:3.12 + environment: + <<: *pip_config + commands: + - pip install pipx + - pipx run build + + - name: upload + image: python:3.12 + environment: + <<: [*pip_config, *repo_config] + commands: + - pip install pipx + - pipx run twine upload dist/* --verbose