Skip to content

Commit 8265ce0

Browse files
committed
make build-oceanbase-ce a reusable workflow
1 parent d913b6e commit 8265ce0

File tree

3 files changed

+46
-22
lines changed

3 files changed

+46
-22
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: build oceanbase-ce
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cache_key:
7+
required: true
8+
type: string
9+
image_file:
10+
required: true
11+
type: string
12+
13+
jobs:
14+
build-oceanbase-ce:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out repository code
18+
uses: actions/checkout@v4
19+
20+
- name: Build Docker image
21+
run: ./oceanbase-ce/docker_build.sh
22+
23+
- name: Export Docker image
24+
run: docker save -o ${{ inputs.image_file }} oceanbase-ce
25+
26+
- name: Upload artifact
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: ${{ inputs.cache_key }}
30+
path: ${{ inputs.image_file }}

.github/workflows/java-test-oceanbase-ce.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: java test oceanbase-ce
33
on:
44
workflow_call:
55
inputs:
6+
cache_key:
7+
required: true
8+
type: string
9+
image_file:
10+
required: true
11+
type: string
612
mode:
713
required: true
814
type: string
@@ -41,11 +47,11 @@ jobs:
4147
- name: Download artifact
4248
uses: actions/download-artifact@v4
4349
with:
44-
name: oceanbase-ce
50+
name: ${{ inputs.cache_key }}
4551
path: /tmp
4652

4753
- name: Load Docker image
48-
run: docker load -i /tmp/oceanbase-ce.tar
54+
run: docker load -i /tmp/${{ inputs.image_file }}
4955

5056
- name: Start Docker container
5157
uses: oceanbase/setup-oceanbase-ce@v1

.github/workflows/test-oceanbase-ce.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,27 @@
1-
name: test oceanbase-ce
1+
name: ci oceanbase-ce
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
7-
branches: [ main ]
87
paths:
9-
- '.github/workflows/java-test-oceanbase-ce.yml'
10-
- '.github/workflows/test-oceanbase-ce.yml'
8+
- '.github/workflows/**-oceanbase-ce.yml'
119
- 'oceanbase-ce/**'
1210
- 'test/**'
1311

1412
jobs:
1513
build:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Check out repository code
19-
uses: actions/checkout@v4
20-
21-
- name: Build Docker image
22-
run: ./oceanbase-ce/docker_build.sh
23-
24-
- name: Export Docker image
25-
run: docker save -o oceanbase-ce.tar oceanbase-ce
26-
27-
- name: Upload artifact
28-
uses: actions/upload-artifact@v4
29-
with:
30-
name: oceanbase-ce
31-
path: oceanbase-ce.tar
14+
uses: ./.github/workflows/build-oceanbase-ce.yml
15+
with:
16+
cache_key: oceanbase-ce
17+
image_file: oceanbase-ce.tar
3218

3319
test-slim:
3420
needs: build
3521
uses: ./.github/workflows/java-test-oceanbase-ce.yml
3622
with:
23+
cache_key: oceanbase-ce
24+
image_file: oceanbase-ce.tar
3725
mode: slim
3826
port: 1234
3927
sys_password: ''

0 commit comments

Comments
 (0)