Skip to content

Commit e82bc9c

Browse files
committed
Add build GitHub Action
1 parent f22f5ae commit e82bc9c

2 files changed

Lines changed: 281 additions & 1 deletion

File tree

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
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+
54+
- name: Build and stage artifacts
55+
run: |
56+
docker run -t \
57+
-v ~/.m2:/root/.m2:Z \
58+
-v ~/local-staging:/root/local-staging:Z \
59+
-v $(pwd):/code:Z \
60+
-w /code \
61+
--entrypoint="" \
62+
netty-centos6 \
63+
bash -ic "./mvnw -B clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true ; ls -Fla /root/local-staging"
64+
65+
- name: Upload local staging directory
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: linux-x86_64-local-staging
69+
path: ~/local-staging
70+
if-no-files-found: error
71+
include-hidden-files: true
72+
73+
# Stage 2: Build macOS Intel x86_64 native libraries
74+
build-macos-intel:
75+
runs-on: macos-15-intel
76+
name: Build macOS x86_64 (Native Libraries)
77+
needs: [build-linux-x64]
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- name: Set up JDK 8
83+
uses: actions/setup-java@v4
84+
with:
85+
distribution: 'zulu'
86+
java-version: '8'
87+
88+
# Cache .m2/repository
89+
- name: Cache local Maven repository
90+
uses: actions/cache@v4
91+
continue-on-error: true
92+
with:
93+
path: ~/.m2/repository
94+
key: cache-maven-macos-intel-${{ hashFiles('**/pom.xml') }}
95+
restore-keys: |
96+
cache-maven-macos-intel-${{ hashFiles('**/pom.xml') }}
97+
cache-maven-
98+
99+
- name: Install tools via brew
100+
run: brew bundle
101+
continue-on-error: true
102+
103+
- name: Create local staging directory
104+
run: mkdir -p ~/local-staging
105+
106+
- name: Build and stage native libraries
107+
run: |
108+
./mvnw -B -U \
109+
-pl resolver-dns-native-macos,transport-native-unix-common,transport-native-kqueue \
110+
deploy \
111+
-DskipTests \
112+
-DserverId=github \
113+
-DaltDeploymentRepository="artifactory::default::https://maven.pkg.github.com/riptano/netty"
114+
115+
- name: Upload local staging directory
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: macos-x86_64-local-staging
119+
path: ~/local-staging
120+
if-no-files-found: error
121+
include-hidden-files: true
122+
123+
# Stage 3: Build macOS ARM aarch64 native libraries
124+
build-macos-arm:
125+
runs-on: macos-15
126+
name: Build macOS aarch64 (Native Libraries)
127+
needs: [build-linux-x64]
128+
129+
steps:
130+
- uses: actions/checkout@v4
131+
132+
- name: Set up JDK 8
133+
uses: actions/setup-java@v4
134+
with:
135+
distribution: 'zulu'
136+
java-version: '8'
137+
138+
# Cache .m2/repository
139+
- name: Cache local Maven repository
140+
uses: actions/cache@v4
141+
continue-on-error: true
142+
with:
143+
path: ~/.m2/repository
144+
key: cache-maven-macos-arm-${{ hashFiles('**/pom.xml') }}
145+
restore-keys: |
146+
cache-maven-macos-arm-${{ hashFiles('**/pom.xml') }}
147+
cache-maven-
148+
149+
- name: Install tools via brew
150+
run: brew bundle
151+
continue-on-error: true
152+
153+
- name: Create local staging directory
154+
run: mkdir -p ~/local-staging
155+
156+
- name: Build and stage native libraries
157+
run: |
158+
./mvnw -B -ntp clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy \
159+
-pl resolver-dns-native-macos,transport-native-unix-common,transport-native-kqueue \
160+
-DserverId=github \
161+
-DaltStagingDirectory=$HOME/local-staging \
162+
-DskipRemoteStaging=true \
163+
-DskipTests=true
164+
165+
- name: Upload local staging directory
166+
uses: actions/upload-artifact@v4
167+
with:
168+
name: macos-aarch64-local-staging
169+
path: ~/local-staging
170+
if-no-files-found: error
171+
include-hidden-files: true
172+
173+
# Stage 4: Merge artifacts and publish to GitHub Packages
174+
publish-to-github-packages:
175+
runs-on: ubuntu-latest
176+
name: Merge and Publish to GitHub Packages
177+
needs: [build-linux-x64, build-macos-intel, build-macos-arm]
178+
179+
steps:
180+
- uses: actions/checkout@v4
181+
182+
- name: Set up JDK 8
183+
uses: actions/setup-java@v4
184+
with:
185+
distribution: 'zulu'
186+
java-version: '8'
187+
188+
# Cache .m2/repository
189+
- name: Cache local Maven repository
190+
uses: actions/cache@v4
191+
continue-on-error: true
192+
with:
193+
path: ~/.m2/repository
194+
key: cache-maven-${{ hashFiles('**/pom.xml') }}
195+
restore-keys: |
196+
cache-maven-${{ hashFiles('**/pom.xml') }}
197+
cache-maven-
198+
199+
# Configure Maven settings for GitHub Packages
200+
- name: Configure Maven settings
201+
uses: s4u/maven-settings-action@v3.0.0
202+
with:
203+
servers: |
204+
[{
205+
"id": "github",
206+
"username": "${{ github.actor }}",
207+
"password": "${{ secrets.GITHUB_TOKEN }}"
208+
}]
209+
210+
# Setup environment variables
211+
- name: Prepare environment variables
212+
run: |
213+
echo "LOCAL_STAGING_DIR=$HOME/local-staging" >> $GITHUB_ENV
214+
215+
# Download all staging artifacts
216+
- name: Download Linux x86_64 staging directory
217+
uses: actions/download-artifact@v4
218+
with:
219+
name: linux-x86_64-local-staging
220+
path: ~/linux-x86_64-local-staging
221+
222+
- name: Download macOS x86_64 staging directory
223+
uses: actions/download-artifact@v4
224+
with:
225+
name: macos-x86_64-local-staging
226+
path: ~/macos-x86_64-local-staging
227+
228+
- name: Download macOS aarch64 staging directory
229+
uses: actions/download-artifact@v4
230+
with:
231+
name: macos-aarch64-local-staging
232+
path: ~/macos-aarch64-local-staging
233+
234+
# Install artifacts to local Maven repository
235+
- name: Copy build artifacts to local maven repository
236+
run: |
237+
bash ./.github/scripts/local_staging_install_release.sh \
238+
~/.m2/repository \
239+
~/linux-x86_64-local-staging \
240+
~/macos-x86_64-local-staging \
241+
~/macos-aarch64-local-staging
242+
243+
# Generate netty-all and deploy to local staging
244+
- name: Generate netty-all and deploy to local staging
245+
run: |
246+
mkdir -p ~/all-local-staging
247+
./mvnw -B --file pom.xml -Pnative-dependencies -pl all \
248+
clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy \
249+
-DaltStagingDirectory=$HOME/all-local-staging \
250+
-DskipRemoteStaging=true \
251+
-DskipTests=true
252+
253+
# Merge all staging repositories
254+
- name: Merge staging repositories
255+
run: |
256+
bash ./.github/scripts/local_staging_install_release.sh \
257+
~/local-staging \
258+
~/linux-x86_64-local-staging \
259+
~/macos-x86_64-local-staging \
260+
~/macos-aarch64-local-staging \
261+
~/all-local-staging
262+
263+
# Deploy to GitHub Packages
264+
- name: Deploy to GitHub Packages
265+
run: |
266+
./mvnw -B --file pom.xml \
267+
org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged \
268+
-DaltStagingDirectory=$HOME/local-staging \
269+
-DserverId=github \
270+
-DnexusUrl=https://maven.pkg.github.com/${{ github.repository }} \
271+
-DrepositoryId=github
272+
273+
- name: Upload merged staging directory (for debugging)
274+
uses: actions/upload-artifact@v4
275+
if: always()
276+
with:
277+
name: merged-local-staging
278+
path: ~/local-staging
279+
if-no-files-found: warn
280+
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)