-
Notifications
You must be signed in to change notification settings - Fork 3
117 lines (99 loc) · 3.29 KB
/
build.yml
File metadata and controls
117 lines (99 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Build and Release
on:
push:
paths:
- 'apps/**'
- 'lib/**'
workflow_dispatch:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
platform: Linux
extension: tar.gz
- os: windows-latest
platform: Windows
extension: zip
- os: macos-latest
platform: macOS
extension: tar.gz
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up CMake
uses: jwlawson/actions-setup-cmake@v2
- name: Install Flex (Windows)
if: runner.os == 'Windows'
run: choco install winflexbison --no-progress
- name: Configure CMake (Windows MinGW)
if: runner.os == 'Windows'
run: cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
- name: Configure CMake (Linux/macOS)
if: runner.os != 'Windows'
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Package
shell: bash
run: |
mkdir -p staging
APPS=("analyser" "cpropep" "gba" "grainanalysis" "lrd" "mcp" "profiler" "prop" "rocket" "rockflight" "simulator")
for app in "${APPS[@]}"; do
APP_DIR="staging/$app"
mkdir -p "$APP_DIR"
# Copy binary
if [ "${{ runner.os }}" == "Windows" ]; then
if [ -f "build/bin/$app.exe" ]; then
cp "build/bin/$app.exe" "$APP_DIR/"
fi
else
if [ -f "build/bin/$app" ]; then
cp "build/bin/$app" "$APP_DIR/"
fi
fi
# Apps that need thermo/propellant data
if [[ "$app" =~ ^(cpropep|prop|lrd|mcp)$ ]]; then
if [ -d "data" ]; then
cp -r data "$APP_DIR/"
fi
fi
# App specific config
if [ "$app" == "cpropep" ] && [ -f "apps/cpropep/cpropep.conf" ]; then
cp apps/cpropep/cpropep.conf "$APP_DIR/"
fi
# Create archive
ARCHIVE_NAME="rocketworkbench-${app}-${{ matrix.platform }}"
if [ "${{ runner.os }}" == "Windows" ]; then
cd "$APP_DIR" && 7z a "../../${ARCHIVE_NAME}.zip" * && cd ../..
else
tar -czvf "${ARCHIVE_NAME}.tar.gz" -C "$APP_DIR" .
fi
done
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.platform }}
path: rocketworkbench-*-${{ matrix.platform }}.${{ matrix.extension }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: rocketworkbench-*
generate_release_notes: true