-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (129 loc) · 5.61 KB
/
Copy pathbuild-release.yml
File metadata and controls
156 lines (129 loc) · 5.61 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Build and Release
on:
push:
branches: [main]
jobs:
# ────────────────────────────────────────────────────────────────────────────
build:
name: Build — ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS-arm64
runner: macos-15
# Override the local 26.2 default set in CMakeLists.txt
extra_cmake_flags: -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
artifact: machinetool-macos-arm64
- name: Windows-x86_64
runner: windows-latest
extra_cmake_flags: ""
artifact: machinetool-windows-x86_64
- name: Linux-x86_64
runner: ubuntu-latest
extra_cmake_flags: ""
artifact: machinetool-linux-x86_64
- name: Linux-arm64
runner: ubuntu-24.04-arm
extra_cmake_flags: ""
artifact: machinetool-linux-arm64
steps:
- uses: actions/checkout@v4
# ── Platform-specific tool setup ──────────────────────────────────────
- name: Install Ninja (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends ninja-build
- name: Install Ninja (macOS)
if: runner.os == 'macOS'
run: brew install ninja
- name: Set up MSVC + Ninja (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install Ninja (Windows)
if: runner.os == 'Windows'
run: choco install ninja --no-progress -y
# ── Configure ─────────────────────────────────────────────────────────
- name: Configure
shell: bash
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
${{ matrix.extra_cmake_flags }}
# ── Build & install ───────────────────────────────────────────────────
- name: Build
run: cmake --build build --config Release -j4
- name: Install
run: cmake --install build --config Release
# ── Package ───────────────────────────────────────────────────────────
- name: Stage release layout
shell: bash
run: |
STAGE="${{ github.workspace }}/stage"
mkdir -p "$STAGE"
# Copy installed subdirs that exist (bin/ and/or lib/ depend on OS)
for d in bin lib; do
src="${{ github.workspace }}/install/$d"
[ -d "$src" ] && cp -r "$src" "$STAGE/$d"
done
cp -r models "$STAGE/models"
cp README.md "$STAGE/README.md"
- name: Create zip (Unix)
if: runner.os != 'Windows'
run: |
cd "${{ github.workspace }}/stage"
zip -r "${{ github.workspace }}/${{ matrix.artifact }}.zip" .
- name: Create zip (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "${{ github.workspace }}\stage\*" `
-DestinationPath "${{ github.workspace }}\${{ matrix.artifact }}.zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}.zip
retention-days: 1
# ────────────────────────────────────────────────────────────────────────────
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: false
- name: Compute tag and title
id: meta
run: |
VERSION=$(grep -m1 'project.*VERSION' CMakeLists.txt \
| sed 's/.*VERSION \+\([0-9][0-9.]*\).*/\1/')
SHORT_SHA="${GITHUB_SHA::8}"
echo "tag=v${VERSION}-build.${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
echo "title=v${VERSION} (build #${GITHUB_RUN_NUMBER} · ${SHORT_SHA})" >> "$GITHUB_OUTPUT"
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: ${{ steps.meta.outputs.title }}
body: |
Automated build from [`${{ github.sha }}`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) on branch `${{ github.ref_name }}`.
| Artifact | Platform |
|----------|----------|
| `machinetool-macos-arm64.zip` | macOS arm64 |
| `machinetool-windows-x86_64.zip` | Windows x86_64 |
| `machinetool-linux-x86_64.zip` | Linux x86_64 |
| `machinetool-linux-arm64.zip` | Linux arm64 |
files: artifacts/**/*.zip
fail_on_unmatched_files: true