Skip to content

Commit 1483ac3

Browse files
committed
Add build GitHub Action
1 parent f22f5ae commit 1483ac3

2 files changed

Lines changed: 280 additions & 1 deletion

File tree

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
name: Build and Publish DataStax Netty to GitHub Packages
2+
3+
on:
4+
# Allows manual trigger from the Actions tab
5+
workflow_dispatch:
6+
7+
# Trigger on version tags
8+
push:
9+
branches:
10+
- dse-netty-4.1.132
11+
tags:
12+
- '*.dse'
13+
- 'dse-netty-*'
14+
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
env:
20+
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryhandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=240
21+
22+
# Cancel running jobs when a new push happens to the same branch/tag
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
# Stage 1: Build full Netty library on Linux x64
29+
build-linux-x64:
30+
runs-on: ubuntu-latest
31+
name: Build Linux x86_64 (Full)
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
# Cache .m2/repository
37+
- name: Cache local Maven repository
38+
uses: actions/cache@v4
39+
continue-on-error: true
40+
with:
41+
path: ~/.m2/repository
42+
key: cache-maven-${{ hashFiles('**/pom.xml') }}
43+
restore-keys: |
44+
cache-maven-${{ hashFiles('**/pom.xml') }}
45+
cache-maven-
46+
47+
- name: Create local staging directory
48+
run: mkdir -p ~/local-staging
49+
50+
- name: Build docker image
51+
run: docker build -f docker/Dockerfile-netty-centos6 -t netty-centos6 .
52+
53+
- name: Build and stage artifacts
54+
run: |
55+
docker run -t \
56+
-v ~/.m2:/root/.m2:Z \
57+
-v ~/local-staging:/root/local-staging:Z \
58+
-v $(pwd):/code:Z \
59+
-w /code \
60+
--entrypoint="" \
61+
netty-centos6 \
62+
bash -ic "./mvnw -B clean install -DskipTests ; find . -name '*.jar' ; ./mvnw -B deploy -DskipTests -Pgithub"
63+
64+
- name: Upload local staging directory
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: linux-x86_64-local-staging
68+
path: ~/local-staging
69+
if-no-files-found: error
70+
include-hidden-files: true
71+
72+
# Stage 2: Build macOS Intel x86_64 native libraries
73+
build-macos-intel:
74+
runs-on: macos-15-intel
75+
name: Build macOS x86_64 (Native Libraries)
76+
needs: [build-linux-x64]
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- name: Set up JDK 8
82+
uses: actions/setup-java@v4
83+
with:
84+
distribution: 'zulu'
85+
java-version: '8'
86+
87+
# Cache .m2/repository
88+
- name: Cache local Maven repository
89+
uses: actions/cache@v4
90+
continue-on-error: true
91+
with:
92+
path: ~/.m2/repository
93+
key: cache-maven-macos-intel-${{ hashFiles('**/pom.xml') }}
94+
restore-keys: |
95+
cache-maven-macos-intel-${{ hashFiles('**/pom.xml') }}
96+
cache-maven-
97+
98+
- name: Install tools via brew
99+
run: brew bundle
100+
continue-on-error: true
101+
102+
- name: Create local staging directory
103+
run: mkdir -p ~/local-staging
104+
105+
- name: Build and stage native libraries
106+
run: |
107+
./mvnw -B -U \
108+
-pl resolver-dns-native-macos,transport-native-unix-common,transport-native-kqueue \
109+
deploy \
110+
-DskipTests \
111+
-DserverId=github \
112+
-DaltDeploymentRepository="artifactory::default::https://maven.pkg.github.com/riptano/netty"
113+
114+
- name: Upload local staging directory
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: macos-x86_64-local-staging
118+
path: ~/local-staging
119+
if-no-files-found: error
120+
include-hidden-files: true
121+
122+
# Stage 3: Build macOS ARM aarch64 native libraries
123+
build-macos-arm:
124+
runs-on: macos-15
125+
name: Build macOS aarch64 (Native Libraries)
126+
needs: [build-linux-x64]
127+
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- name: Set up JDK 8
132+
uses: actions/setup-java@v4
133+
with:
134+
distribution: 'zulu'
135+
java-version: '8'
136+
137+
# Cache .m2/repository
138+
- name: Cache local Maven repository
139+
uses: actions/cache@v4
140+
continue-on-error: true
141+
with:
142+
path: ~/.m2/repository
143+
key: cache-maven-macos-arm-${{ hashFiles('**/pom.xml') }}
144+
restore-keys: |
145+
cache-maven-macos-arm-${{ hashFiles('**/pom.xml') }}
146+
cache-maven-
147+
148+
- name: Install tools via brew
149+
run: brew bundle
150+
continue-on-error: true
151+
152+
- name: Create local staging directory
153+
run: mkdir -p ~/local-staging
154+
155+
- name: Build and stage native libraries
156+
run: |
157+
./mvnw -B -ntp clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy \
158+
-pl resolver-dns-native-macos,transport-native-unix-common,transport-native-kqueue \
159+
-DserverId=github \
160+
-DaltStagingDirectory=$HOME/local-staging \
161+
-DskipRemoteStaging=true \
162+
-DskipTests=true
163+
164+
- name: Upload local staging directory
165+
uses: actions/upload-artifact@v4
166+
with:
167+
name: macos-aarch64-local-staging
168+
path: ~/local-staging
169+
if-no-files-found: error
170+
include-hidden-files: true
171+
172+
# Stage 4: Merge artifacts and publish to GitHub Packages
173+
publish-to-github-packages:
174+
runs-on: ubuntu-latest
175+
name: Merge and Publish to GitHub Packages
176+
needs: [build-linux-x64, build-macos-intel, build-macos-arm]
177+
178+
steps:
179+
- uses: actions/checkout@v4
180+
181+
- name: Set up JDK 8
182+
uses: actions/setup-java@v4
183+
with:
184+
distribution: 'zulu'
185+
java-version: '8'
186+
187+
# Cache .m2/repository
188+
- name: Cache local Maven repository
189+
uses: actions/cache@v4
190+
continue-on-error: true
191+
with:
192+
path: ~/.m2/repository
193+
key: cache-maven-${{ hashFiles('**/pom.xml') }}
194+
restore-keys: |
195+
cache-maven-${{ hashFiles('**/pom.xml') }}
196+
cache-maven-
197+
198+
# Configure Maven settings for GitHub Packages
199+
- name: Configure Maven settings
200+
uses: s4u/maven-settings-action@v3.0.0
201+
with:
202+
servers: |
203+
[{
204+
"id": "github",
205+
"username": "${{ github.actor }}",
206+
"password": "${{ secrets.GITHUB_TOKEN }}"
207+
}]
208+
209+
# Setup environment variables
210+
- name: Prepare environment variables
211+
run: |
212+
echo "LOCAL_STAGING_DIR=$HOME/local-staging" >> $GITHUB_ENV
213+
214+
# Download all staging artifacts
215+
- name: Download Linux x86_64 staging directory
216+
uses: actions/download-artifact@v4
217+
with:
218+
name: linux-x86_64-local-staging
219+
path: ~/linux-x86_64-local-staging
220+
221+
- name: Download macOS x86_64 staging directory
222+
uses: actions/download-artifact@v4
223+
with:
224+
name: macos-x86_64-local-staging
225+
path: ~/macos-x86_64-local-staging
226+
227+
- name: Download macOS aarch64 staging directory
228+
uses: actions/download-artifact@v4
229+
with:
230+
name: macos-aarch64-local-staging
231+
path: ~/macos-aarch64-local-staging
232+
233+
# Install artifacts to local Maven repository
234+
- name: Copy build artifacts to local maven repository
235+
run: |
236+
bash ./.github/scripts/local_staging_install_release.sh \
237+
~/.m2/repository \
238+
~/linux-x86_64-local-staging \
239+
~/macos-x86_64-local-staging \
240+
~/macos-aarch64-local-staging
241+
242+
# Generate netty-all and deploy to local staging
243+
- name: Generate netty-all and deploy to local staging
244+
run: |
245+
mkdir -p ~/all-local-staging
246+
./mvnw -B --file pom.xml -Pnative-dependencies -pl all \
247+
clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy \
248+
-DaltStagingDirectory=$HOME/all-local-staging \
249+
-DskipRemoteStaging=true \
250+
-DskipTests=true
251+
252+
# Merge all staging repositories
253+
- name: Merge staging repositories
254+
run: |
255+
bash ./.github/scripts/local_staging_install_release.sh \
256+
~/local-staging \
257+
~/linux-x86_64-local-staging \
258+
~/macos-x86_64-local-staging \
259+
~/macos-aarch64-local-staging \
260+
~/all-local-staging
261+
262+
# Deploy to GitHub Packages
263+
- name: Deploy to GitHub Packages
264+
run: |
265+
./mvnw -B --file pom.xml \
266+
org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged \
267+
-DaltStagingDirectory=$HOME/local-staging \
268+
-DserverId=github \
269+
-DnexusUrl=https://maven.pkg.github.com/${{ github.repository }} \
270+
-DrepositoryId=github
271+
272+
- name: Upload merged staging directory (for debugging)
273+
uses: actions/upload-artifact@v4
274+
if: always()
275+
with:
276+
name: merged-local-staging
277+
path: ~/local-staging
278+
if-no-files-found: warn
279+
include-hidden-files: true

docker-datastax-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ if ! which docker > /dev/null ; then
1212
fi
1313

1414
sudo docker build -f docker/Dockerfile-netty-centos6 -t netty-centos6 .
15-
sudo docker run -t --network host -v ~/.m2:/root/.m2:Z -v ~/.ssh:/root/.ssh:Z -v ~/.gnupg:/root/.gnupg:Z -v `pwd`:/code:Z -w /code --entrypoint="" netty-centos6 bash -ic "./mvnw -B clean deploy -Partifactory -DskipTests -DaltDeploymentRepository=\"artifactory::default::https://repo.aws.dsinternal.org/artifactory/datastax-releases-local\""
15+
sudo docker run -t --network host -v ~/.m2:/root/.m2:Z -v ~/.ssh:/root/.ssh:Z -v ~/.gnupg:/root/.gnupg:Z -v `pwd`:/code:Z -w /code --entrypoint="" netty-centos6 bash -ic "./mvnw -B clean deploy -Partifactory -DskipTests -DaltDeploymentRepository=\"artifactory::default::https://maven.pkg.github.com/riptano/netty\""

0 commit comments

Comments
 (0)