From 9a7858d9fd03f7ef6a3a74a7960f70c6ecdf357e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=9B=E8=82=AF=E6=99=AE=E9=80=9A?= Date: Sat, 6 Dec 2025 12:02:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20.drone.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..897a9a8 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,72 @@ +kind: pipeline +type: docker +name: multi-lang-ci + +trigger: + event: + - pull_request + branch: + - main # <<< 确保分支名称与您的主分支一致 + +clone: + depth: 0 + image: drone/git:latest + pull: false + +steps: + # 自动检测是否存在 Java (pom.xml) + - name: java-build + image: maven:3.9-eclipse-temurin + pull: false + environment: + MAVEN_OPTS: -Dmaven.repo.local=.m2/repository + commands: + # 在当前工作目录而非 ~ 下创建 .m2 目录,避免权限问题 + - mkdir -p .m2/repository + # 动态生成 settings.xml + - | + cat > settings.xml << 'EOF' + + + + + aliyun + * + Aliyun Maven + https://maven.aliyun.com/repository/public + + + + EOF + # 使用自定义 settings.xml + - mvn -s settings.xml clean verify + when: + path: + include: + - pom.xml # 仅当存在 pom.xml 文件时运行 + + # 自动检测是否存在 Python (requirements.txt) + - name: python-test + image: python:3.12.0-slim + pull: false + commands: + # 临时设置 pip 源 + - pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ + - pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn + - pip install -r requirements.txt + - python -m pytest test_example.py -v + when: + path: + include: + - requirements.txt # 仅当存在 requirements.txt 文件时运行 + + # 最终报告(无论成功失败都运行) + - name: summary + image: alpine + pull: false + commands: + - echo "✅ CI completed at $(date)" + when: + status: [ success, failure ] \ No newline at end of file