Skip to content

Commit e57d617

Browse files
authored
ci: reduce repeated setup and nightly rebuild work (#4119)
1 parent 34dad83 commit e57d617

8 files changed

Lines changed: 118 additions & 18 deletions

File tree

.github/workflows/backend-build-test.yml

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ on:
3838
- 'script/**'
3939
- 'material/**'
4040

41+
concurrency:
42+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
43+
cancel-in-progress: true
44+
4145
jobs:
4246
backend-build:
4347
runs-on: ubuntu-latest
@@ -46,7 +50,7 @@ jobs:
4650
- uses: ./script/ci/github-actions/setup-deps
4751

4852
- name: Build with Maven
49-
run: mvnd clean -B package -Prelease -Dmaven.test.skip=false --file pom.xml
53+
run: mvnd clean -B package -pl '!hertzbeat-e2e' -Prelease -Dmaven.test.skip=false --file pom.xml
5054

5155
- name: Upload coverage reports to Codecov
5256
uses: codecov/codecov-action@v4.0.1
@@ -55,6 +59,47 @@ jobs:
5559
fail_ci_if_error: false
5660
verbose: true
5761

62+
- name: Upload backend distribution
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: backend-dist-${{ github.run_id }}
66+
path: dist/
67+
retention-days: 1
68+
compression-level: 0
69+
70+
backend-maven-e2e:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- uses: actions/checkout@v4
74+
- uses: ./script/ci/github-actions/setup-deps
75+
76+
- name: Build backend Maven E2E modules
77+
run: |
78+
mvnd clean -B package \
79+
-pl hertzbeat-e2e/hertzbeat-collector-common-e2e,hertzbeat-e2e/hertzbeat-collector-kafka-e2e,hertzbeat-e2e/hertzbeat-collector-basic-e2e,hertzbeat-e2e/hertzbeat-collector-mysql-r2dbc-e2e,hertzbeat-e2e/hertzbeat-log-e2e \
80+
-am \
81+
-Dmaven.test.skip=false \
82+
--file pom.xml
83+
84+
- name: Upload Maven E2E coverage reports to Codecov
85+
uses: codecov/codecov-action@v4.0.1
86+
with:
87+
token: ${{ secrets.CODECOV_TOKEN }}
88+
fail_ci_if_error: false
89+
verbose: true
90+
91+
backend-image-e2e:
92+
needs: backend-build
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- name: Download backend distribution
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: backend-dist-${{ github.run_id }}
101+
path: dist/
102+
58103
- name: Build Image
59104
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
60105
with:
@@ -65,12 +110,9 @@ jobs:
65110

66111
- name: Run E2E
67112
run: |
68-
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
69-
sudo chmod u+x /usr/local/bin/docker-compose
70-
71113
cd e2e
72-
sudo docker-compose version
73-
sudo docker-compose up --exit-code-from testing --remove-orphans
114+
docker compose version
115+
docker compose up --exit-code-from testing --remove-orphans
74116
75117
# upload application logs
76118
- name: Upload logs & API test reports
@@ -81,4 +123,3 @@ jobs:
81123
path: |
82124
e2e/logs/
83125
e2e/report/
84-

.github/workflows/doc-build-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
paths:
2828
- 'home/**'
2929

30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
32+
cancel-in-progress: true
33+
3034
jobs:
3135
docs-build:
3236
runs-on: ubuntu-latest
@@ -37,6 +41,11 @@ jobs:
3741
- uses: pnpm/action-setup@v4
3842
with:
3943
version: 10
44+
- uses: actions/setup-node@v4
45+
with:
46+
node-version: '20'
47+
cache: pnpm
48+
cache-dependency-path: home/pnpm-lock.yaml
4049
- uses: actions/setup-python@v4
4150
with:
4251
python-version: '3.8'

.github/workflows/doc-deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
# Allow manual workflow trigger
2828
workflow_dispatch:
2929

30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.ref }}
32+
cancel-in-progress: true
33+
3034
# Set permissions for deployment
3135
permissions:
3236
contents: write
@@ -48,6 +52,8 @@ jobs:
4852
uses: actions/setup-node@v4
4953
with:
5054
node-version: '20'
55+
cache: pnpm
56+
cache-dependency-path: home/pnpm-lock.yaml
5157

5258
# Setup pnpm
5359
- name: Setup pnpm

.github/workflows/frontend-build-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ on:
3030
paths:
3131
- 'web-app/**'
3232

33+
concurrency:
34+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
35+
cancel-in-progress: true
36+
3337
jobs:
3438
build:
3539
runs-on: ubuntu-latest
@@ -38,6 +42,11 @@ jobs:
3842
- uses: pnpm/action-setup@v4
3943
with:
4044
version: 10
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: '20'
48+
cache: pnpm
49+
cache-dependency-path: web-app/pnpm-lock.yaml
4150
- name: Install
4251
working-directory: web-app
4352
run: pnpm install

.github/workflows/license-checker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ on:
2626
pull_request:
2727
branches: [ master, dev ]
2828

29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
31+
cancel-in-progress: true
32+
2933
jobs:
3034
check-license-header:
3135
name: check-license-header

.github/workflows/monitor-e2e-test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ on:
2727
- cron: '0 1 * * *'
2828
push:
2929
branches: [ action* ]
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.ref }}
33+
cancel-in-progress: true
34+
3035
jobs:
3136
check-license-header:
3237
name: Monitor E2E Test
@@ -36,7 +41,7 @@ jobs:
3641
- uses: actions/checkout@v4
3742
- uses: ./script/ci/github-actions/setup-deps
3843
- name: Build with Maven
39-
run: mvn clean -B package -Prelease -Dmaven.test.skip=true --file pom.xml
44+
run: mvnd -B clean package -Prelease -Dmaven.test.skip=true --file pom.xml
4045
- name: Build Image
4146
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
4247
with:
@@ -46,8 +51,6 @@ jobs:
4651
tags: apache/hertzbeat:test
4752
- name: Run K8s Monitor E2E Test
4853
run: |
49-
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
50-
sudo chmod u+x /usr/local/bin/docker-compose
5154
cd e2e/k8s
52-
sudo docker-compose version
53-
sudo docker-compose up --exit-code-from testing --remove-orphans
55+
docker compose version
56+
docker compose up --exit-code-from testing --remove-orphans

.github/workflows/nightly-build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ on:
2424
push:
2525
branches: [ action* ]
2626

27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.ref }}
29+
cancel-in-progress: true
30+
2731
jobs:
2832
build:
2933
runs-on: ubuntu-latest
@@ -34,6 +38,11 @@ jobs:
3438
- uses: pnpm/action-setup@v4
3539
with:
3640
version: 10
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: '20'
44+
cache: pnpm
45+
cache-dependency-path: web-app/pnpm-lock.yaml
3746

3847
- name: Build the Frontend
3948
run: |
@@ -43,10 +52,7 @@ jobs:
4352
4453
- name: Build the Backend
4554
run: |
46-
mvn clean install
47-
mvn clean package -Prelease -DskipTests
48-
cd hertzbeat-collector
49-
mvn clean package -Pcluster -DskipTests
55+
mvnd -B clean package -Prelease,Pcluster -Dmaven.test.skip=false --file pom.xml
5056
5157
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a
5258
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd

script/ci/github-actions/setup-deps/action.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,37 @@ runs:
2626
with:
2727
distribution: "zulu"
2828
java-version: 25
29+
cache: maven
30+
31+
- name: Validate mvnd runner support
32+
shell: bash
33+
run: |
34+
if [ "${RUNNER_OS}" != "Linux" ] || [ "${RUNNER_ARCH}" != "X64" ]; then
35+
echo "setup-deps currently supports mvnd only on Linux/X64 runners; got ${RUNNER_OS}/${RUNNER_ARCH}" >&2
36+
exit 1
37+
fi
38+
39+
- name: Cache mvnd
40+
id: mvnd-cache
41+
uses: actions/cache@v4
42+
with:
43+
path: ~/.local/mvnd
44+
key: mvnd-2.0.0-rc-3-linux-amd64
2945

3046
- name: Install mvnd
47+
if: steps.mvnd-cache.outputs.cache-hit != 'true'
3148
shell: bash
3249
run: |
3350
MVND_VERSION=2.0.0-rc-3
34-
curl -sL https://dlcdn.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-linux-amd64.zip -o mvnd.zip
51+
MVND_PLATFORM=linux-amd64
52+
curl -sL https://dlcdn.apache.org/maven/mvnd/${MVND_VERSION}/maven-mvnd-${MVND_VERSION}-${MVND_PLATFORM}.zip -o mvnd.zip
3553
unzip -q mvnd.zip
3654
mkdir -p $HOME/.local
37-
mv maven-mvnd-${MVND_VERSION}-linux-amd64 $HOME/.local/mvnd
55+
mv maven-mvnd-${MVND_VERSION}-${MVND_PLATFORM} $HOME/.local/mvnd
56+
57+
- name: Export mvnd environment
58+
shell: bash
59+
run: |
3860
echo "$HOME/.local/mvnd/bin" >> $GITHUB_PATH
3961
echo "MVND_HOME=$HOME/.local/mvnd" >> $GITHUB_ENV
4062

0 commit comments

Comments
 (0)