Skip to content

Commit be8295d

Browse files
committed
WIP: try to build artifacts
1 parent 3969a95 commit be8295d

File tree

3 files changed

+219
-11
lines changed

3 files changed

+219
-11
lines changed

.github/workflows/cmake-test-on.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ on:
1919

2020
jobs:
2121
cmake-test:
22-
name: ${{ inputs.os }}-${{ inputs.os_version }}-${{ inputs.compiler }}-${{ inputs.variant }}
22+
name: ${{ inputs.os }}-${{ inputs.os_version }}-${{ inputs.compiler }}-${{ matrix.variant }}
2323
runs-on: ${{ inputs.os }}-${{ inputs.os_version }}
2424
strategy:
2525
fail-fast: false
26+
matrix:
27+
variant: [Debug, Release]
2628
env:
2729
CXX: ${{ inputs.compiler }}
2830
VCPKG_DEFAULT_TRIPLET: ${{ inputs.triplet }}
@@ -50,15 +52,23 @@ jobs:
5052
path: |
5153
${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
5254
53-
- run: cmake --preset ${{ inputs.variant }}
55+
- run: cmake --preset ${{ matrix.variant }}
5456

55-
- name: Run cmake --build --parallel --preset ${{ inputs.variant }}
57+
- name: Run cmake --build --parallel --preset ${{ matrix.variant }}
5658
run: |
5759
echo "::add-matcher::.github/cmake-problem-matcher.json"
58-
cmake --build --parallel --preset ${{ inputs.variant }}
60+
cmake --build --parallel --preset ${{ matrix.variant }}
5961
6062
- run: ./firestarr -h
6163

62-
- run: ctest --output-on-failure --preset ${{ inputs.variant }}
64+
- run: ctest --output-on-failure --preset ${{ matrix.variant }}
6365

6466
- run: ./firestarr . 2024-06-03 58.81228184403946 -122.9117103995713 01:00 --ffmc 89.9 --dmc 59.5 --dc 450.9 --apcp_prev 0 -v --wx ./test/input/10N_50651/firestarr_10N_50651_wx.csv --output_date_offsets [1] --tz -5 --raster-root ./test/input/10N_50651/ --perim ./test/input/10N_50651/10N_50651.tif
67+
68+
- uses: .github/workflows/package-binary.yml
69+
if: ${{ matrix.variant == 'Release' }}
70+
with:
71+
os: ${{ inputs.os }}
72+
os_version: ${{ inputs.os_version }}
73+
compiler: ${{ inputs.compiler }}
74+
triplet: ${{ inputs.triplet }}

.github/workflows/cmake-test.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ jobs:
1414
os_version: ${{ matrix.os_version }}
1515
compiler: ${{ matrix.compiler }}
1616
triplet: ${{ matrix.triplet }}
17-
variant: ${{ matrix.variant }}
1817
strategy:
1918
fail-fast: false
2019
matrix:
2120
os: [macos]
2221
os_version: [latest]
2322
compiler: [clang++]
24-
variant: [Debug, Release]
23+
triplet: [arm64-osx]
2524

2625
cmake-test-ubuntu:
2726
uses: ./.github/workflows/cmake-test-on.yml
@@ -30,14 +29,13 @@ jobs:
3029
os_version: ${{ matrix.os_version }}
3130
compiler: ${{ matrix.compiler }}
3231
triplet: ${{ matrix.triplet }}
33-
variant: ${{ matrix.variant }}
3432
strategy:
3533
fail-fast: false
3634
matrix:
3735
os: [ubuntu]
3836
os_version: [22.04, 24.04]
3937
compiler: [clang++, g++]
40-
variant: [Debug, Release]
38+
triplet: [x64-linux]
4139

4240
cmake-test-windows:
4341
uses: ./.github/workflows/cmake-test-on.yml
@@ -46,14 +44,13 @@ jobs:
4644
os_version: ${{ matrix.os_version }}
4745
compiler: ${{ matrix.compiler }}
4846
triplet: ${{ matrix.triplet }}
49-
variant: ${{ matrix.variant }}
5047
strategy:
5148
fail-fast: false
5249
matrix:
5350
os: [windows]
5451
os_version: [latest]
5552
compiler: [cl]
56-
variant: [Debug, Release]
53+
triplet: [x64-windows]
5754

5855
cmake-test:
5956
needs: [cmake-test-ubuntu, cmake-test-macos, cmake-test-windows]
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: package-binary
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
required: true
8+
type: string
9+
os_version:
10+
required: true
11+
type: string
12+
compiler:
13+
required: true
14+
type: string
15+
triplet:
16+
required: true
17+
type: string
18+
variant:
19+
required: true
20+
type: string
21+
22+
jobs:
23+
package-macos:
24+
if: ${{ inputs.os == 'macos' }}
25+
strategy:
26+
fail-fast: false
27+
env:
28+
OUTPUT_BINARY: firestarr-${{ inputs.os }}-${{ inputs.target-cpu}}-${{ inputs.target-compiler }}-${{ inputs.variant }}
29+
steps:
30+
- name: Locate binary
31+
id: locate
32+
run: |
33+
# Find the built executable
34+
BINARY=$(find build -type f -name "firestarr" -perm +111 | head -1)
35+
if [ -z "$BINARY" ]; then
36+
echo "ERROR: Could not find firestarr binary"
37+
find build -type f -perm +111
38+
exit 1
39+
fi
40+
echo "binary=$BINARY" >> $GITHUB_OUTPUT
41+
echo "Found binary at: $BINARY"
42+
43+
- name: Check binary dependencies
44+
run: |
45+
echo "=== Binary info ==="
46+
file ${{ steps.locate.outputs.binary }}
47+
echo ""
48+
echo "=== Dynamic dependencies ==="
49+
otool -L ${{ steps.locate.outputs.binary }} || true
50+
51+
- name: Package artifact
52+
run: |
53+
mkdir -p dist
54+
cp ${{ steps.locate.outputs.binary }} dist/firestarr
55+
56+
# Bundle data files if they exist
57+
[ -f firestarr/fuel.lut ] && cp firestarr/fuel.lut dist/
58+
[ -f firestarr/settings.ini ] && cp firestarr/settings.ini dist/
59+
[ -f firestarr/data/fuel.lut ] && cp firestarr/data/fuel.lut dist/
60+
[ -f firestarr/data/settings.ini ] && cp firestarr/data/settings.ini dist/
61+
62+
# Create version info
63+
cd firestarr && git rev-parse HEAD > ../dist/VERSION && cd ..
64+
65+
# List contents
66+
echo "=== Package contents ==="
67+
ls -la dist/
68+
69+
# Create tarball
70+
tar -czvf ${{ env.OUTPUT_BINARY }}.tar.gz -C dist .
71+
72+
- name: Upload artifact
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: ${{ env.OUTPUT_BINARY }}
76+
path: ${{ env.OUTPUT_BINARY }}.tar.gz
77+
retention-days: 30
78+
79+
package-linux:
80+
if: ${{ inputs.os == 'linux' }}
81+
strategy:
82+
fail-fast: false
83+
env:
84+
OUTPUT_BINARY: firestarr-${{ inputs.os }}-${{ inputs.target-cpu}}-${{ inputs.target-compiler }}-${{ inputs.variant }}
85+
steps:
86+
- name: Locate binary
87+
id: locate
88+
run: |
89+
# Find the built executable
90+
BINARY=$(find build -type f -name "firestarr" -executable | head -1)
91+
if [ -z "$BINARY" ]; then
92+
echo "ERROR: Could not find firestarr binary"
93+
find build -type f -executable
94+
exit 1
95+
fi
96+
echo "binary=$BINARY" >> $GITHUB_OUTPUT
97+
echo "Found binary at: $BINARY"
98+
99+
- name: Check binary dependencies
100+
run: |
101+
echo "=== Binary info ==="
102+
file ${{ steps.locate.outputs.binary }}
103+
echo ""
104+
echo "=== Dynamic dependencies ==="
105+
ldd ${{ steps.locate.outputs.binary }} || true
106+
107+
- name: Package artifact
108+
run: |
109+
mkdir -p dist
110+
cp ${{ steps.locate.outputs.binary }} dist/firestarr
111+
112+
# Bundle data files if they exist
113+
[ -f firestarr/fuel.lut ] && cp firestarr/fuel.lut dist/
114+
[ -f firestarr/settings.ini ] && cp firestarr/settings.ini dist/
115+
[ -f firestarr/data/fuel.lut ] && cp firestarr/data/fuel.lut dist/
116+
[ -f firestarr/data/settings.ini ] && cp firestarr/data/settings.ini dist/
117+
118+
# Create version info
119+
cd firestarr && git rev-parse HEAD > ../dist/VERSION && cd ..
120+
121+
# List contents
122+
echo "=== Package contents ==="
123+
ls -la dist/
124+
125+
# Create tarball
126+
tar -czvf ${{ env.OUTPUT_BINARY }}.tar.gz -C dist .
127+
128+
- name: Upload artifact
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: ${{ env.OUTPUT_BINARY }}
132+
path: ${{ env.OUTPUT_BINARY }}.tar.gz
133+
retention-days: 30
134+
135+
136+
package-windows:
137+
if: ${{ inputs.os == 'windows' }}
138+
strategy:
139+
fail-fast: false
140+
env:
141+
OUTPUT_BINARY: firestarr-${{ inputs.os }}-${{ inputs.target-cpu}}-${{ inputs.target-compiler }}-${{ inputs.variant }}
142+
steps:
143+
- name: Locate binary
144+
id: locate
145+
run: |
146+
$BINARY = Get-ChildItem -Path build -Recurse -Filter "firestarr.exe" | Select-Object -First 1 -ExpandProperty FullName
147+
if (-not $BINARY) {
148+
echo "ERROR: Could not find firestarr.exe"
149+
Get-ChildItem -Path build -Recurse -Filter "*.exe" | Select-Object FullName
150+
exit 1
151+
}
152+
echo "binary=$BINARY" >> $env:GITHUB_OUTPUT
153+
echo "Found binary at: $BINARY"
154+
shell: pwsh
155+
156+
- name: Check binary dependencies
157+
run: |
158+
echo "=== Binary info ==="
159+
Get-Item "${{ steps.locate.outputs.binary }}" | Format-List Name, Length, LastWriteTime
160+
echo ""
161+
echo "=== Binary size ==="
162+
(Get-Item "${{ steps.locate.outputs.binary }}").Length / 1MB | ForEach-Object { "{0:N2} MB" -f $_ }
163+
shell: pwsh
164+
165+
- name: Package artifact
166+
run: |
167+
New-Item -ItemType Directory -Force -Path dist
168+
169+
Copy-Item "${{ steps.locate.outputs.binary }}" dist\firestarr.exe
170+
171+
# Copy required DLLs from vcpkg
172+
$vcpkgBin = "C:\vcpkg\installed\x64-windows\bin"
173+
if (Test-Path $vcpkgBin) {
174+
Get-ChildItem "$vcpkgBin\*.dll" | Copy-Item -Destination dist\
175+
}
176+
177+
# Bundle data files if they exist
178+
if (Test-Path firestarr\fuel.lut) { Copy-Item firestarr\fuel.lut dist\ }
179+
if (Test-Path firestarr\settings.ini) { Copy-Item firestarr\settings.ini dist\ }
180+
if (Test-Path firestarr\data\fuel.lut) { Copy-Item firestarr\data\fuel.lut dist\ }
181+
if (Test-Path firestarr\data\settings.ini) { Copy-Item firestarr\data\settings.ini dist\ }
182+
183+
# Create version info
184+
cd firestarr
185+
git rev-parse HEAD | Out-File -FilePath ..\dist\VERSION -Encoding utf8
186+
cd ..
187+
188+
# List contents
189+
echo "=== Package contents ==="
190+
Get-ChildItem dist
191+
192+
# Create zip
193+
Compress-Archive -Path dist\* -DestinationPath ${{ env.OUTPUT_BINARY }}.zip
194+
shell: pwsh
195+
196+
- name: Upload artifact
197+
uses: actions/upload-artifact@v4
198+
with:
199+
name: ${{ env.OUTPUT_BINARY }}
200+
path: ${{ env.OUTPUT_BINARY }}.tar.gz
201+
retention-days: 30

0 commit comments

Comments
 (0)