Skip to content

Commit 4bde3ba

Browse files
committed
Add nightly build and release workflow
1 parent 806af71 commit 4bde3ba

File tree

1 file changed

+255
-0
lines changed

1 file changed

+255
-0
lines changed

.github/workflows/nightly.yml

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
name: nightly
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 2 * * *"
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: nightly-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
native:
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
- name: Configure
25+
shell: bash
26+
run: |
27+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
28+
cmake -S native -B native/build
29+
else
30+
cmake -S native -B native/build -DCMAKE_BUILD_TYPE=Release
31+
fi
32+
- name: Build
33+
shell: bash
34+
run: |
35+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
36+
cmake --build native/build --config Release
37+
else
38+
cmake --build native/build
39+
fi
40+
- name: Package
41+
shell: bash
42+
run: |
43+
os="$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')"
44+
mkdir -p dist/native
45+
if [ "$RUNNER_OS" = "Windows" ]; then
46+
cp native/build/Release/epoch_aeron.dll dist/native/
47+
cp native/build/Release/epoch_aeron.lib dist/native/
48+
elif [ "$RUNNER_OS" = "macOS" ]; then
49+
cp native/build/libepoch_aeron.dylib dist/native/
50+
else
51+
cp native/build/libepoch_aeron.so dist/native/
52+
fi
53+
cp native/include/epoch_aeron.h dist/native/
54+
tar -czf "epoch-native-${os}.tar.gz" -C dist/native .
55+
- uses: actions/upload-artifact@v4
56+
with:
57+
name: epoch-native-${{ matrix.os }}
58+
path: epoch-native-*.tar.gz
59+
60+
cpp:
61+
strategy:
62+
matrix:
63+
os: [ubuntu-latest, macos-latest, windows-latest]
64+
runs-on: ${{ matrix.os }}
65+
steps:
66+
- uses: actions/checkout@v4
67+
with:
68+
submodules: recursive
69+
- name: Configure
70+
shell: bash
71+
run: |
72+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
73+
cmake -S cpp -B cppbuild
74+
else
75+
cmake -S cpp -B cppbuild -DCMAKE_BUILD_TYPE=Release
76+
fi
77+
- name: Build
78+
shell: bash
79+
run: |
80+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
81+
cmake --build cppbuild --config Release
82+
else
83+
cmake --build cppbuild
84+
fi
85+
- name: Test
86+
shell: bash
87+
run: |
88+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
89+
ctest --test-dir cppbuild -C Release --output-on-failure
90+
else
91+
ctest --test-dir cppbuild --output-on-failure
92+
fi
93+
- name: Package
94+
shell: bash
95+
run: |
96+
os="$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')"
97+
mkdir -p dist/cpp/include
98+
cp -R cpp/include/epoch dist/cpp/include/
99+
if [ "$RUNNER_OS" = "Windows" ]; then
100+
cp cppbuild/Release/epoch_cpp.lib dist/cpp/
101+
else
102+
cp cppbuild/libepoch_cpp.a dist/cpp/
103+
fi
104+
cp LICENSE dist/cpp/
105+
tar -czf "epoch-cpp-${os}.tar.gz" -C dist/cpp .
106+
- uses: actions/upload-artifact@v4
107+
with:
108+
name: epoch-cpp-${{ matrix.os }}
109+
path: epoch-cpp-*.tar.gz
110+
111+
java:
112+
runs-on: ubuntu-latest
113+
steps:
114+
- uses: actions/checkout@v4
115+
- name: Set up Java
116+
uses: actions/setup-java@v4
117+
with:
118+
distribution: temurin
119+
java-version: "17"
120+
- name: Build and test
121+
shell: bash
122+
run: |
123+
ROOT_DIR="$(pwd)/java"
124+
OUT_DIR="$ROOT_DIR/target/classes"
125+
LIST_FILE="$ROOT_DIR/target/sources.txt"
126+
CLASSPATH="$("$ROOT_DIR/scripts/fetch-aeron.sh")"
127+
mkdir -p "$OUT_DIR"
128+
find "$ROOT_DIR/src/main/java" "$ROOT_DIR/src/test/java" -name "*.java" > "$LIST_FILE"
129+
javac --release 17 -cp "$CLASSPATH" -d "$OUT_DIR" @"$LIST_FILE"
130+
java --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -cp "$OUT_DIR:$CLASSPATH" io.epoch.VectorTestMain
131+
jar --create --file "$ROOT_DIR/target/epoch-java.jar" -C "$OUT_DIR" .
132+
- name: Package
133+
shell: bash
134+
run: |
135+
tar -czf epoch-java.tar.gz -C java/target epoch-java.jar
136+
- uses: actions/upload-artifact@v4
137+
with:
138+
name: epoch-java
139+
path: epoch-java.tar.gz
140+
141+
dotnet:
142+
runs-on: ubuntu-latest
143+
steps:
144+
- uses: actions/checkout@v4
145+
- name: Set up .NET
146+
uses: actions/setup-dotnet@v4
147+
with:
148+
dotnet-version: "8.0.x"
149+
- name: Test
150+
run: dotnet test dotnet/Epoch.Tests/Epoch.Tests.csproj
151+
- name: Pack
152+
run: dotnet pack dotnet/Epoch.csproj -c Release -o dotnet/artifacts
153+
- name: Package
154+
shell: bash
155+
run: |
156+
tar -czf epoch-dotnet.tar.gz -C dotnet/artifacts .
157+
- uses: actions/upload-artifact@v4
158+
with:
159+
name: epoch-dotnet
160+
path: epoch-dotnet.tar.gz
161+
162+
go:
163+
runs-on: ubuntu-latest
164+
steps:
165+
- uses: actions/checkout@v4
166+
with:
167+
submodules: recursive
168+
- name: Set up Go
169+
uses: actions/setup-go@v5
170+
with:
171+
go-version: "1.24.x"
172+
- name: Build native
173+
run: |
174+
cmake -S native -B native/build -DCMAKE_BUILD_TYPE=Release
175+
cmake --build native/build
176+
- name: Build
177+
shell: bash
178+
run: |
179+
cd go
180+
CGO_ENABLED=1 go build -o ../epoch-go-linux-amd64.a
181+
- name: Package
182+
shell: bash
183+
run: |
184+
tar -czf epoch-go.tar.gz epoch-go-linux-amd64.a
185+
- uses: actions/upload-artifact@v4
186+
with:
187+
name: epoch-go
188+
path: epoch-go.tar.gz
189+
190+
node:
191+
runs-on: ubuntu-latest
192+
steps:
193+
- uses: actions/checkout@v4
194+
- name: Set up Node
195+
uses: actions/setup-node@v4
196+
with:
197+
node-version: "22"
198+
- name: Install and build
199+
shell: bash
200+
run: |
201+
corepack enable
202+
pnpm -C node install --no-frozen-lockfile
203+
pnpm -C node run build
204+
pnpm -C node pack --pack-destination node/dist
205+
- name: Package
206+
shell: bash
207+
run: |
208+
tar -czf epoch-node.tar.gz -C node/dist .
209+
- uses: actions/upload-artifact@v4
210+
with:
211+
name: epoch-node
212+
path: epoch-node.tar.gz
213+
214+
python:
215+
runs-on: ubuntu-latest
216+
steps:
217+
- uses: actions/checkout@v4
218+
- name: Set up Python
219+
uses: actions/setup-python@v5
220+
with:
221+
python-version: "3.12"
222+
- name: Build
223+
shell: bash
224+
run: |
225+
python -m venv python/.venv-nightly
226+
source python/.venv-nightly/bin/activate
227+
python -m pip install --upgrade pip build
228+
cd python
229+
python -m build
230+
- name: Package
231+
shell: bash
232+
run: |
233+
tar -czf epoch-python.tar.gz -C python/dist .
234+
- uses: actions/upload-artifact@v4
235+
with:
236+
name: epoch-python
237+
path: epoch-python.tar.gz
238+
239+
release:
240+
runs-on: ubuntu-latest
241+
needs: [native, cpp, java, dotnet, go, node, python]
242+
steps:
243+
- uses: actions/download-artifact@v4
244+
with:
245+
path: dist
246+
- name: Create nightly release
247+
uses: ncipollo/release-action@v1
248+
with:
249+
tag: nightly
250+
name: nightly
251+
prerelease: true
252+
allowUpdates: true
253+
removeArtifacts: true
254+
artifacts: dist/**/*
255+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)