Skip to content

Commit a294485

Browse files
authored
Merge pull request #24 from imchatkit/dev
GitHub Actions config
2 parents 423a19c + a6ebd5d commit a294485

File tree

34 files changed

+467
-139
lines changed

34 files changed

+467
-139
lines changed

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
env:
10+
DOCKER_REGISTRY: ccr.ccs.tencentyun.com
11+
DOCKER_NAMESPACE: your-namespace
12+
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
13+
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v3
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
cache: 'maven'
27+
28+
- name: Build with Maven
29+
run: mvn clean package -DskipTests -Pprod
30+
31+
- name: Upload Artifacts
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: jar-files
35+
path: "**/target/*.jar"
36+
retention-days: 7
37+
38+
docker-build:
39+
needs: build
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v3
43+
44+
- name: Download Artifacts
45+
uses: actions/download-artifact@v3
46+
with:
47+
name: jar-files
48+
path: .
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v2
52+
53+
- name: Login to Tencent Cloud Container Registry
54+
uses: docker/login-action@v2
55+
with:
56+
registry: ${{ env.DOCKER_REGISTRY }}
57+
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
58+
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
59+
60+
- name: Build and push im-gateway
61+
uses: docker/build-push-action@v4
62+
with:
63+
context: ./im-gateway
64+
push: true
65+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/im-gateway:${{ github.sha }}
66+
67+
- name: Build and push ruoyi-auth
68+
uses: docker/build-push-action@v4
69+
with:
70+
context: ./framework/ruoyi-auth
71+
push: true
72+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-auth:${{ github.sha }}
73+
74+
- name: Build and push ruoyi-system
75+
uses: docker/build-push-action@v4
76+
with:
77+
context: ./framework/ruoyi-modules/ruoyi-system
78+
push: true
79+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-system:${{ github.sha }}
80+
81+
- name: Build and push ruoyi-gen
82+
uses: docker/build-push-action@v4
83+
with:
84+
context: ./framework/ruoyi-modules/ruoyi-gen
85+
push: true
86+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-gen:${{ github.sha }}
87+
88+
- name: Build and push ruoyi-job
89+
uses: docker/build-push-action@v4
90+
with:
91+
context: ./framework/ruoyi-modules/ruoyi-job
92+
push: true
93+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-job:${{ github.sha }}
94+
95+
- name: Build and push ruoyi-resource
96+
uses: docker/build-push-action@v4
97+
with:
98+
context: ./framework/ruoyi-modules/ruoyi-resource
99+
push: true
100+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/ruoyi-resource:${{ github.sha }}
101+
102+
- name: Build and push im-core-server
103+
uses: docker/build-push-action@v4
104+
with:
105+
context: ./im-core/im-core-server
106+
push: true
107+
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/im-core-server:${{ github.sha }}
108+
109+
110+
deploy:
111+
needs: docker-build
112+
runs-on: ubuntu-latest
113+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
114+
steps:
115+
- name: Deploy to production
116+
run: echo "Deployment steps would go here"
117+
- name: Manual approval
118+
uses: trstringer/manual-approval@v1
119+
with:
120+
secret: ${{ github.token }}
121+
approvers: your-github-username
122+
minimum-approvals: 1
123+
exclude-authors: github-actions[bot]

.gitlab-ci.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
stages:
2+
- build
3+
- docker-build
4+
- docker-push
5+
- deploy
6+
7+
variables:
8+
DOCKER_REGISTRY: ccr.ccs.tencentyun.com # 腾讯云容器镜像仓库地址
9+
DOCKER_NAMESPACE: your-namespace # 替换为你的命名空间
10+
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
11+
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
12+
13+
# 缓存Maven依赖
14+
cache:
15+
paths:
16+
- .m2/repository/
17+
- target/
18+
19+
# 构建阶段
20+
build:
21+
stage: build
22+
image: maven:3.8.6-openjdk-17
23+
script:
24+
- mvn clean package -DskipTests -Pprod
25+
artifacts:
26+
paths:
27+
- "**/target/*.jar"
28+
expire_in: 1 week
29+
30+
# 构建Docker镜像
31+
docker-build:
32+
stage: docker-build
33+
image: docker:20.10.16
34+
services:
35+
- docker:20.10.16-dind
36+
variables:
37+
DOCKER_HOST: tcp://docker:2376
38+
DOCKER_TLS_CERTDIR: "/certs"
39+
DOCKER_TLS_VERIFY: 1
40+
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
41+
script:
42+
# 登录腾讯云容器镜像仓库
43+
- echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin $DOCKER_REGISTRY
44+
45+
# 构建网关服务镜像
46+
- cd im-gateway
47+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-gateway:$CI_COMMIT_SHORT_SHA .
48+
- cd ..
49+
50+
# 构建认证服务镜像
51+
- cd framework/ruoyi-auth
52+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-auth:$CI_COMMIT_SHORT_SHA .
53+
- cd ../..
54+
55+
# 构建系统服务镜像
56+
- cd framework/ruoyi-modules/ruoyi-system
57+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-system:$CI_COMMIT_SHORT_SHA .
58+
- cd ../../..
59+
60+
# 构建代码生成服务镜像
61+
- cd framework/ruoyi-modules/ruoyi-gen
62+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-gen:$CI_COMMIT_SHORT_SHA .
63+
- cd ../../..
64+
65+
# 构建定时任务服务镜像
66+
- cd framework/ruoyi-modules/ruoyi-job
67+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-job:$CI_COMMIT_SHORT_SHA .
68+
- cd ../../..
69+
70+
# 构建资源服务镜像
71+
- cd framework/ruoyi-modules/ruoyi-resource
72+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-resource:$CI_COMMIT_SHORT_SHA .
73+
- cd ../../..
74+
75+
# 构建工作流服务镜像
76+
- cd framework/ruoyi-modules/ruoyi-workflow
77+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-workflow:$CI_COMMIT_SHORT_SHA .
78+
- cd ../../..
79+
80+
# 构建AI服务镜像
81+
- cd im-core/ai-server
82+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ai-server:$CI_COMMIT_SHORT_SHA .
83+
- cd ../..
84+
85+
# 构建核心服务镜像
86+
- cd im-core/im-core-server
87+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-core-server:$CI_COMMIT_SHORT_SHA .
88+
- cd ../..
89+
90+
# 构建开放API服务镜像
91+
- cd im-core/rest-open-api-server
92+
- docker build -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/rest-open-api-server:$CI_COMMIT_SHORT_SHA .
93+
- cd ../..
94+
95+
# 推送Docker镜像
96+
docker-push:
97+
stage: docker-push
98+
image: docker:20.10.16
99+
services:
100+
- docker:20.10.16-dind
101+
variables:
102+
DOCKER_HOST: tcp://docker:2376
103+
DOCKER_TLS_CERTDIR: "/certs"
104+
DOCKER_TLS_VERIFY: 1
105+
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
106+
script:
107+
# 登录腾讯云容器镜像仓库
108+
- echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin $DOCKER_REGISTRY
109+
110+
# 推送所有服务镜像
111+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-gateway:$CI_COMMIT_SHORT_SHA
112+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-auth:$CI_COMMIT_SHORT_SHA
113+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-system:$CI_COMMIT_SHORT_SHA
114+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-gen:$CI_COMMIT_SHORT_SHA
115+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-job:$CI_COMMIT_SHORT_SHA
116+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-resource:$CI_COMMIT_SHORT_SHA
117+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ruoyi-workflow:$CI_COMMIT_SHORT_SHA
118+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/ai-server:$CI_COMMIT_SHORT_SHA
119+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/im-core-server:$CI_COMMIT_SHORT_SHA
120+
- docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/rest-open-api-server:$CI_COMMIT_SHORT_SHA
121+
122+
# 部署阶段(可选)
123+
deploy:
124+
stage: deploy
125+
image: alpine:latest
126+
script:
127+
- echo "Deployment steps would go here"
128+
when: manual # 手动触发部署
129+
only:
130+
- master # 只在master分支上运行

framework/ruoyi-auth/src/main/java/org/dromara/auth/RuoYiAuthApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public static void main(String[] args) {
1818
SpringApplication application = new SpringApplication(RuoYiAuthApplication.class);
1919
application.setApplicationStartup(new BufferingApplicationStartup(2048));
2020
application.run(args);
21-
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ ");
21+
System.out.println("认证授权中心启动成功");
2222
}
2323
}

framework/ruoyi-example/ruoyi-demo/src/main/java/org/dromara/demo/RuoYiDemoApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public static void main(String[] args) {
1515
SpringApplication application = new SpringApplication(RuoYiDemoApplication.class);
1616
application.setApplicationStartup(new BufferingApplicationStartup(2048));
1717
application.run(args);
18-
System.out.println("(♥◠‿◠)ノ゙ 演示模块启动成功 ლ(´ڡ`ლ)゙ ");
18+
System.out.println("演示模块启动成功");
1919
}
2020
}

framework/ruoyi-example/ruoyi-test-mq/src/main/java/org/dromara/stream/RuoYiTestMqApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static void main(String[] args) {
1515
SpringApplication application = new SpringApplication(RuoYiTestMqApplication.class);
1616
application.setApplicationStartup(new BufferingApplicationStartup(2048));
1717
application.run(args);
18-
System.out.println("(♥◠‿◠)ノ゙ MQ案例模块启动成功 ლ(´ڡ`ლ)゙ ");
18+
System.out.println("MQ案例模块启动成功");
1919
}
2020

2121
}

framework/ruoyi-modules/ruoyi-gen/src/main/java/org/dromara/gen/RuoYiGenApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public static void main(String[] args) {
1717
SpringApplication application = new SpringApplication(RuoYiGenApplication.class);
1818
application.setApplicationStartup(new BufferingApplicationStartup(2048));
1919
application.run(args);
20-
System.out.println("(♥◠‿◠)ノ゙ 代码生成模块启动成功 ლ(´ڡ`ლ)゙ ");
20+
System.out.println("代码生成模块启动成功");
2121
}
2222
}

framework/ruoyi-modules/ruoyi-job/src/main/java/org/dromara/job/RuoYiJobApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static void main(String[] args) {
1818
SpringApplication application = new SpringApplication(RuoYiJobApplication.class);
1919
application.setApplicationStartup(new BufferingApplicationStartup(2048));
2020
application.run(args);
21-
System.out.println("(♥◠‿◠)ノ゙ 任务调度模块启动成功 ლ(´ڡ`ლ)゙ ");
21+
System.out.println("任务调度模块启动成功");
2222
}
2323

2424
}

framework/ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/RuoYiResourceApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public static void main(String[] args) {
1818
SpringApplication application = new SpringApplication(RuoYiResourceApplication.class);
1919
application.setApplicationStartup(new BufferingApplicationStartup(2048));
2020
application.run(args);
21-
System.out.println("(♥◠‿◠)ノ゙ 资源服务模块启动成功 ლ(´ڡ`ლ)゙ ");
21+
System.out.println("资源服务模块启动成功");
2222
}
2323
}

framework/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/RuoYiSystemApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public static void main(String[] args) {
1717
SpringApplication application = new SpringApplication(RuoYiSystemApplication.class);
1818
application.setApplicationStartup(new BufferingApplicationStartup(2048));
1919
application.run(args);
20-
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ ");
20+
System.out.println("系统模块启动成功");
2121
}
2222
}

framework/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/RuoYiWorkflowApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public static void main(String[] args) {
1717
SpringApplication application = new SpringApplication(RuoYiWorkflowApplication.class);
1818
application.setApplicationStartup(new BufferingApplicationStartup(2048));
1919
application.run(args);
20-
System.out.println("(♥◠‿◠)ノ゙ 工作流模块启动成功 ლ(´ڡ`ლ)゙ ");
20+
System.out.println("工作流模块启动成功");
2121
}
2222
}

0 commit comments

Comments
 (0)