Skip to content

Commit 9ddcdcf

Browse files
committed
chore: prepare ci 3.9.5.1
1 parent 8a42099 commit 9ddcdcf

5 files changed

Lines changed: 228 additions & 198 deletions

File tree

.github/Dockerfile.ci

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM eclipse-temurin:21-jdk-jammy
2+
3+
ARG MAVEN_VERSION=3.9.9
4+
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
libcppunit-dev \
7+
libsasl2-dev \
8+
build-essential \
9+
autoconf \
10+
automake \
11+
libtool \
12+
pkg-config \
13+
git \
14+
curl \
15+
&& curl -fsSL https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
16+
| tar -xz -C /opt \
17+
&& ln -s /opt/apache-maven-${MAVEN_VERSION}/bin/mvn /usr/local/bin/mvn \
18+
&& rm -rf /var/lib/apt/lists/* \
19+
&& useradd -m -u 1001 -s /bin/bash builder
20+
21+
USER builder

.github/workflows/ci.yaml

Lines changed: 103 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,74 +15,136 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
# This workflow will build a Java project with Maven
19-
# See also:
20-
# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
21-
2218
name: CI
2319

2420
on:
2521
push:
26-
branches: [ '*' ]
22+
branches: ['develop/**', 'release/**', 'master']
2723
pull_request:
28-
branches: [ '*' ]
24+
branches: ['develop/**', 'release/**', 'master']
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
30+
permissions:
31+
packages: write
32+
33+
env:
34+
IMAGE: ghcr.io/${{ github.repository }}/ci
2935

3036
jobs:
31-
mvn:
32-
strategy:
33-
matrix:
34-
profile:
35-
- name: 'full-build-jdk8'
36-
jdk: 8
37-
args: '-Pfull-build apache-rat:check verify -DskipTests spotbugs:check checkstyle:check'
38-
- name: 'full-build-jdk11'
39-
jdk: 11
40-
args: '-Pfull-build apache-rat:check verify -DskipTests spotbugs:check checkstyle:check'
41-
- name: 'full-build-java-tests'
42-
jdk: 11
43-
args: '-Pfull-build verify -Dsurefire-forkcount=1 -DskipCppUnit -Dsurefire.rerunFailingTestsCount=5'
44-
- name: 'full-build-cppunit-tests'
45-
jdk: 11
46-
args: '-Pfull-build verify -Dtest=_ -DfailIfNoTests=false'
47-
fail-fast: false
48-
timeout-minutes: 360
37+
ci-image:
38+
name: CI Image
4939
runs-on: ubuntu-latest
40+
outputs:
41+
image: ${{ steps.result.outputs.image }}
5042
steps:
5143
- uses: actions/checkout@v4
52-
- name: Set up JDK ${{ matrix.profile.jdk }}
53-
uses: actions/setup-java@v4
44+
45+
- id: tag
46+
name: Compute image tag
47+
run: |
48+
TAG=$(sha256sum .github/Dockerfile.ci | cut -c1-12)
49+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
50+
echo "image=${{ env.IMAGE }}:$TAG" >> "$GITHUB_OUTPUT"
51+
52+
- uses: docker/login-action@v3
5453
with:
55-
java-version: ${{ matrix.profile.jdk }}
56-
distribution: temurin
57-
cache: 'maven'
58-
- name: Show the first log message
59-
run: git log -n1
60-
- name: Install C Dependencies
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Check if image exists
59+
id: check
6160
run: |
62-
sudo apt update
63-
sudo apt install -y libcppunit-dev libsasl2-dev
64-
- name: Build with Maven (${{ matrix.profile.name }})
65-
run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{ matrix.profile.args }}
66-
env:
67-
MAVEN_OPTS: -Djansi.force=true
61+
if docker manifest inspect ${{ steps.tag.outputs.image }} > /dev/null 2>&1; then
62+
echo "exists=true" >> "$GITHUB_OUTPUT"
63+
else
64+
echo "exists=false" >> "$GITHUB_OUTPUT"
65+
fi
66+
67+
- if: steps.check.outputs.exists == 'false'
68+
uses: docker/build-push-action@v6
69+
with:
70+
context: .github
71+
file: .github/Dockerfile.ci
72+
push: true
73+
tags: |
74+
${{ steps.tag.outputs.image }}
75+
${{ env.IMAGE }}:latest
76+
77+
- id: result
78+
run: echo "image=${{ steps.tag.outputs.image }}" >> "$GITHUB_OUTPUT"
79+
80+
compile:
81+
name: Compile + Checkstyle
82+
runs-on: ubuntu-latest
83+
needs: ci-image
84+
container: ${{ needs.ci-image.outputs.image }}
85+
timeout-minutes: 30
86+
steps:
87+
- uses: actions/checkout@v4
88+
- name: Cache Maven repository
89+
uses: actions/cache@v4
90+
with:
91+
path: ~/.m2/repository
92+
key: maven-${{ hashFiles('**/pom.xml') }}
93+
restore-keys: maven-
94+
- name: Compile and check style
95+
run: mvn -B -V -e -ntp -Pfull-build verify -DskipTests checkstyle:check
96+
97+
java-tests:
98+
name: Java Tests
99+
runs-on: ubuntu-latest
100+
needs: [ci-image, compile]
101+
container: ${{ needs.ci-image.outputs.image }}
102+
timeout-minutes: 120
103+
steps:
104+
- uses: actions/checkout@v4
105+
- name: Cache Maven repository
106+
uses: actions/cache@v4
107+
with:
108+
path: ~/.m2/repository
109+
key: maven-${{ hashFiles('**/pom.xml') }}
110+
restore-keys: maven-
111+
- name: Run Java tests
112+
run: mvn -B -V -e -ntp -Pfull-build verify -Dsurefire-forkcount=1 -DskipCppUnit
68113
- name: Upload unit test results
69114
if: ${{ failure() }}
70115
uses: actions/upload-artifact@v4
71116
with:
72-
name: surefire-reports-${{ matrix.profile.name }}
117+
name: surefire-reports
73118
path: ./**/target/surefire-reports/
74119
if-no-files-found: ignore
75120
- name: Upload integration test results
76121
if: ${{ failure() }}
77122
uses: actions/upload-artifact@v4
78123
with:
79-
name: failsafe-reports-${{ matrix.profile.name }}
124+
name: failsafe-reports
80125
path: ./**/target/failsafe-reports/
81126
if-no-files-found: ignore
127+
128+
c-tests:
129+
name: C Tests
130+
runs-on: ubuntu-latest
131+
needs: [ci-image, compile]
132+
container: ${{ needs.ci-image.outputs.image }}
133+
timeout-minutes: 30
134+
steps:
135+
- uses: actions/checkout@v4
136+
- name: Cache Maven repository
137+
uses: actions/cache@v4
138+
with:
139+
path: ~/.m2/repository
140+
key: maven-${{ hashFiles('**/pom.xml') }}
141+
restore-keys: maven-
142+
- name: Run C tests
143+
run: mvn -B -V -e -ntp -Pfull-build verify -Dtest=_ -Dsurefire.failIfNoSpecifiedTests=false
82144
- name: Upload cppunit test logs
83145
if: ${{ failure() }}
84146
uses: actions/upload-artifact@v4
85147
with:
86-
name: cppunit-logs-${{ matrix.profile.name }}
148+
name: cppunit-logs
87149
path: ./zookeeper-client/zookeeper-client-c/target/c/TEST-*.txt
88150
if-no-files-found: ignore

.github/workflows/e2e.yaml

Lines changed: 0 additions & 79 deletions
This file was deleted.

.github/workflows/manual.yaml

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)