Skip to content

Commit ca7b666

Browse files
pbosettiCopilot
andcommitted
Retry with GH CI action
Co-authored-by: Copilot <copilot@github.com>
1 parent cb6341d commit ca7b666

2 files changed

Lines changed: 168 additions & 0 deletions

File tree

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
# ────────────────────────────────────────────────────────────────────────────
9+
build:
10+
name: Build — ${{ matrix.name }}
11+
runs-on: ${{ matrix.runner }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- name: macOS-arm64
17+
runner: macos-15
18+
plugin_suffix: arm64
19+
# Override the local 26.2 default set in CMakeLists.txt
20+
extra_cmake_flags: -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
21+
artifact: machinetool-macos-arm64
22+
23+
- name: Windows-x86_64
24+
runner: windows-latest
25+
plugin_suffix: x86_64
26+
extra_cmake_flags: ""
27+
artifact: machinetool-windows-x86_64
28+
29+
- name: Linux-x86_64
30+
runner: ubuntu-latest
31+
plugin_suffix: x86_64
32+
extra_cmake_flags: ""
33+
artifact: machinetool-linux-x86_64
34+
35+
- name: Linux-arm64
36+
runner: ubuntu-24.04-arm
37+
plugin_suffix: arm64
38+
extra_cmake_flags: ""
39+
artifact: machinetool-linux-arm64
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
# ── Platform-specific tool setup ──────────────────────────────────────
45+
46+
- name: Install Ninja (Linux)
47+
if: runner.os == 'Linux'
48+
run: |
49+
sudo apt-get update -qq
50+
sudo apt-get install -y --no-install-recommends ninja-build
51+
52+
- name: Install Ninja (macOS)
53+
if: runner.os == 'macOS'
54+
run: brew install ninja
55+
56+
- name: Set up MSVC + Ninja (Windows)
57+
if: runner.os == 'Windows'
58+
uses: ilammy/msvc-dev-cmd@v1
59+
with:
60+
arch: x64
61+
62+
- name: Install Ninja (Windows)
63+
if: runner.os == 'Windows'
64+
run: choco install ninja --no-progress -y
65+
66+
# ── Configure ─────────────────────────────────────────────────────────
67+
68+
- name: Configure
69+
shell: bash
70+
run: |
71+
cmake -B build -G Ninja \
72+
-DCMAKE_BUILD_TYPE=Release \
73+
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
74+
-DPLUGIN_SUFFIX=${{ matrix.plugin_suffix }} \
75+
${{ matrix.extra_cmake_flags }}
76+
77+
# ── Build & install ───────────────────────────────────────────────────
78+
79+
- name: Build
80+
run: cmake --build build --config Release -j4
81+
82+
- name: Install
83+
run: cmake --install build --config Release
84+
85+
# ── Package ───────────────────────────────────────────────────────────
86+
87+
- name: Stage release layout
88+
shell: bash
89+
run: |
90+
STAGE="${{ github.workspace }}/stage"
91+
mkdir -p "$STAGE"
92+
# Copy installed subdirs that exist (bin/ and/or lib/ depend on OS)
93+
for d in bin lib; do
94+
src="${{ github.workspace }}/install/$d"
95+
[ -d "$src" ] && cp -r "$src" "$STAGE/$d"
96+
done
97+
cp -r models "$STAGE/models"
98+
cp README.md "$STAGE/README.md"
99+
100+
- name: Create zip (Unix)
101+
if: runner.os != 'Windows'
102+
run: |
103+
cd "${{ github.workspace }}/stage"
104+
zip -r "${{ github.workspace }}/${{ matrix.artifact }}.zip" .
105+
106+
- name: Create zip (Windows)
107+
if: runner.os == 'Windows'
108+
shell: pwsh
109+
run: |
110+
Compress-Archive -Path "${{ github.workspace }}\stage\*" `
111+
-DestinationPath "${{ github.workspace }}\${{ matrix.artifact }}.zip"
112+
113+
- name: Upload artifact
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: ${{ matrix.artifact }}
117+
path: ${{ matrix.artifact }}.zip
118+
retention-days: 1
119+
120+
# ────────────────────────────────────────────────────────────────────────────
121+
release:
122+
name: Create Release
123+
needs: build
124+
runs-on: ubuntu-latest
125+
permissions:
126+
contents: write
127+
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- name: Download all artifacts
132+
uses: actions/download-artifact@v4
133+
with:
134+
path: artifacts
135+
merge-multiple: false
136+
137+
- name: Compute tag and title
138+
id: meta
139+
run: |
140+
VERSION=$(grep -m1 'project.*VERSION' CMakeLists.txt \
141+
| sed 's/.*VERSION \+\([0-9][0-9.]*\).*/\1/')
142+
SHORT_SHA="${GITHUB_SHA::8}"
143+
echo "tag=v${VERSION}-build.${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
144+
echo "title=v${VERSION} (build #${GITHUB_RUN_NUMBER} · ${SHORT_SHA})" >> "$GITHUB_OUTPUT"
145+
146+
- name: Publish release
147+
uses: softprops/action-gh-release@v2
148+
with:
149+
tag_name: ${{ steps.meta.outputs.tag }}
150+
name: ${{ steps.meta.outputs.title }}
151+
body: |
152+
Automated build from [`${{ github.sha }}`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) on branch `${{ github.ref_name }}`.
153+
154+
| Artifact | Platform |
155+
|----------|----------|
156+
| `machinetool-macos-arm64.zip` | macOS arm64 |
157+
| `machinetool-windows-x86_64.zip` | Windows x86_64 |
158+
| `machinetool-linux-x86_64.zip` | Linux x86_64 |
159+
| `machinetool-linux-arm64.zip` | Linux arm64 |
160+
files: artifacts/**/*.zip
161+
fail_on_unmatched_files: true

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ endif()
3636
# PROJECT SETTINGS #############################################################
3737
set(CMAKE_CXX_STANDARD 20)
3838
set(CMAKE_CXX_STANDARD_REQUIRED ON)
39+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3940
set(SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
4041

4142
if(UNIX AND NOT APPLE)
@@ -174,3 +175,9 @@ else()
174175
COMPONENT MadsApps
175176
)
176177
endif()
178+
179+
# machine_viewer_example is a standalone executable, always installed to bin/
180+
install(TARGETS machine_viewer_example
181+
RUNTIME DESTINATION bin
182+
COMPONENT MadsApps
183+
)

0 commit comments

Comments
 (0)