-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (59 loc) · 2.31 KB
/
Copy pathbuild-deploy.yml
File metadata and controls
66 lines (59 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# tapdata-it CI:推送代码 → 编译 + 单元测试 → 部署 SNAPSHOT 到 Nexus
#
# 触发时机:任意分支 push(含 PR 合并),忽略文档/docker 变更。
# 运行环境:GitHub 托管 runner(ubuntu-latest),通过 actions/setup-java 安装 JDK 17。
# 依赖仓库:内部依赖(tapdata-pdk-api、tapdata-api)需通过 secrets.MAVEN_SETTINGS
# 提供的 settings.xml 中的 <mirror>/<repository> 指向可达的 Maven 仓库;
# 若默认 Nexus(nexus.tapdata.net)为内网地址,托管 runner 无法访问。
#
# ⚠️ 前置条件
# 1. 仓库的 MAVEN_SETTINGS secret 必须配置 settings.xml,包含 Nexus 镜像/仓库与认证
# 2. Nexus 需有公网入口或托管 runner 能解析/路由(如 GitHub 允许的 IP 白名单)
# 否则 compile/deploy 均会因依赖不可解析而失败
#
name: Build and Deploy
on:
push:
branches: ['main']
paths-ignore:
- 'docs/**'
- 'docker/**'
- '**.md'
- '.gitignore'
concurrency:
group: build-deploy-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Configure Maven settings
shell: bash
env:
MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }}
run: |
if [[ -n "${MAVEN_SETTINGS}" ]]; then
mkdir -p "$HOME/.m2"
echo "${MAVEN_SETTINGS}" > "$HOME/.m2/settings.xml"
fi
# surefire 默认 skipTests=true(集成测试框架用,单元测试需显式取消跳过);
# 当前 tapdata-connector-it 尚未包含 src/test 用例,此步骤仅编译验证;
# 后续添加单元测试后自动生效
- name: Compile and run unit tests
shell: bash
run: |
mvn -B test -DskipTests=false
# 部署 SNAPSHOT 到 Nexus(版本为 1.0-SNAPSHOT,每次覆盖);仅在 settings.xml
# 配置了 nexus-tapdata-net server 认证且托管 runner 可达时生效
- name: Deploy to Nexus
shell: bash
run: |
mvn -B deploy -DskipTests=true