Skip to content

Commit 28e1803

Browse files
committed
feat: add release pipeline
feat: add binary packages feat: include projectM version in static builds
1 parent 54c481c commit 28e1803

File tree

17 files changed

+3452
-597
lines changed

17 files changed

+3452
-597
lines changed

.github/workflows/build_linux.yml

Lines changed: 980 additions & 58 deletions
Large diffs are not rendered by default.

.github/workflows/build_osx.yml

Lines changed: 160 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,204 @@
1-
name: macOS (x86_64)
1+
name: macOS (arm64)
22

33
on:
44
push:
5-
branches:
6-
- "*"
7-
tags:
8-
- "*"
9-
5+
branches:
6+
- "*"
7+
tags:
8+
- "*"
9+
1010
pull_request:
11-
branches:
12-
- "*"
11+
branches:
12+
- "*"
13+
14+
env:
15+
PROJECTM_REF: master
1316

1417
jobs:
18+
configure:
19+
name: Configure
20+
runs-on: ubuntu-latest
21+
outputs:
22+
projectm_matrix: ${{ steps.set.outputs.projectm_matrix }}
23+
plugin_matrix: ${{ steps.set.outputs.plugin_matrix }}
24+
steps:
25+
- id: set
26+
run: |
27+
if [ "${{ github.event_name }}" = "pull_request" ]; then
28+
echo 'projectm_matrix=[{"variant":"shared","shared":"ON","enable_gles":"OFF","extra_flags":""}]' >> $GITHUB_OUTPUT
29+
echo 'plugin_matrix=[{"variant":"dynamic","projectm_artifact":"projectm-osx-arm64-shared-latest"}]' >> $GITHUB_OUTPUT
30+
else
31+
echo 'projectm_matrix=[{"variant":"static-gl","shared":"OFF","enable_gles":"OFF","extra_flags":"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"},{"variant":"static-gles","shared":"OFF","enable_gles":"ON","extra_flags":"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"},{"variant":"shared","shared":"ON","enable_gles":"OFF","extra_flags":""}]' >> $GITHUB_OUTPUT
32+
echo 'plugin_matrix=[{"variant":"static-gl","projectm_artifact":"projectm-osx-arm64-static-gl-latest"},{"variant":"static-gles","projectm_artifact":"projectm-osx-arm64-static-gles-latest"},{"variant":"dynamic","projectm_artifact":"projectm-osx-arm64-shared-latest"}]' >> $GITHUB_OUTPUT
33+
fi
34+
1535
build-projectm:
16-
name: Build ProjectM
17-
runs-on: macos-latest
18-
36+
name: Build ProjectM (${{ matrix.variant }})
37+
needs: [configure]
38+
runs-on: macos-14
39+
strategy:
40+
matrix:
41+
include: ${{ fromJson(needs.configure.outputs.projectm_matrix) }}
1942
steps:
20-
- name: Checkout ProjectM
21-
uses: actions/checkout@v4
43+
- uses: actions/checkout@v4
2244
with:
2345
repository: 'projectM-visualizer/projectm'
46+
ref: ${{ env.PROJECTM_REF }}
2447
submodules: 'recursive'
2548
fetch-depth: 0
2649

27-
- name: Get ProjectM Git Hash
50+
- name: Get Hash
2851
id: git-hash
29-
run: echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
30-
52+
run: echo "hash=$(git rev-parse HEAD)-${{ matrix.variant }}" >> $GITHUB_OUTPUT
53+
54+
- name: Save ProjectM Version Info (static only)
55+
if: startsWith(matrix.variant, 'static')
56+
run: |
57+
mkdir -p ${{ github.workspace }}/install
58+
echo "PROJECTM_VENDOR_REF=${{ env.PROJECTM_REF }}" > ${{ github.workspace }}/install/projectm-version
59+
echo "PROJECTM_VENDOR_COMMIT=$(git rev-parse --short HEAD)" >> ${{ github.workspace }}/install/projectm-version
60+
echo "PROJECTM_VENDOR_TIMESTAMP=$(git log -1 --format=%cI)" >> ${{ github.workspace }}/install/projectm-version
61+
3162
- name: Cache Install
3263
id: cache-install
3364
uses: actions/cache@v4
3465
with:
35-
path: |
36-
${{ github.workspace }}/install
37-
key: install-${{ runner.os }}-projectm-${{ steps.git-hash.outputs.hash }}
66+
path: ${{ github.workspace }}/install
67+
key: install-${{ runner.os }}-arm64-projectm-${{ steps.git-hash.outputs.hash }}
3868

3969
- name: Install Packages
40-
run: |
41-
brew update
42-
brew install ninja sdl2
4370
if: steps.cache-install.outputs.cache-hit != 'true'
71+
run: brew install ninja sdl2
4472

45-
- name: Configure Build
46-
run: cmake -G "Ninja" -S "${{ github.workspace }}" -B "${{ github.workspace }}/cmake-build" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=ON -DENABLE_PLAYLIST=ON
73+
- name: Build & Install
4774
if: steps.cache-install.outputs.cache-hit != 'true'
48-
49-
- name: Build Release
50-
run: cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --parallel
51-
if: steps.cache-install.outputs.cache-hit != 'true'
52-
53-
- name: Install
5475
run: |
55-
cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --target install
56-
if: steps.cache-install.outputs.cache-hit != 'true'
76+
cmake -G Ninja -S . -B build \
77+
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
78+
-DCMAKE_VERBOSE_MAKEFILE=YES \
79+
-DBUILD_SHARED_LIBS=${{ matrix.shared }} \
80+
-DENABLE_PLAYLIST=ON \
81+
-DENABLE_GLES=${{ matrix.enable_gles }} \
82+
${{ matrix.extra_flags }}
83+
cmake --build build --config Release --parallel
84+
cmake --build build --config Release --target install
5785
58-
- name: Upload Artifact
59-
uses: actions/upload-artifact@v4
86+
- uses: actions/upload-artifact@v4
6087
with:
61-
name: projectm-osx-shared-latest
62-
path: install/*
88+
name: projectm-osx-arm64-${{ matrix.variant }}-latest
89+
path: install/*
6390

6491
build-plugin:
65-
name: Build GST Plugin ProjectM
66-
runs-on: macos-latest
67-
92+
name: Build GST Plugin (${{ matrix.variant }})
93+
needs: [configure, build-projectm]
94+
runs-on: macos-14
95+
strategy:
96+
matrix:
97+
include: ${{ fromJson(needs.configure.outputs.plugin_matrix) }}
6898
steps:
6999
- uses: actions/checkout@v4
70100
with:
71101
submodules: 'recursive'
72102

73-
- name: Wait for ProjectM
74-
uses: yogeshlonkar/wait-for-jobs@v0
75-
with:
76-
interval: '5000'
77-
jobs: Build ProjectM
78-
ttl: '15'
79-
80-
- name: Download Artifact
81-
uses: actions/download-artifact@v4
103+
- uses: actions/download-artifact@v4
82104
with:
83-
name: projectm-osx-shared-latest
105+
name: ${{ matrix.projectm_artifact }}
84106
path: artifacts
85107

108+
- name: Patch projectM4 CMake config (GLES workaround)
109+
run: |
110+
CONFIG_FILE="artifacts/lib/cmake/projectM4/projectM4Config.cmake"
111+
if [ -f "${CONFIG_FILE}" ]; then
112+
sed -i '' '/find_dependency(OpenGL/d' "${CONFIG_FILE}"
113+
echo "Patched: removed find_dependency(OpenGL) from projectM4Config.cmake"
114+
fi
115+
86116
- name: Install Packages
117+
run: ./setup.sh --auto
118+
119+
- name: Determine plugin version
120+
id: plugin-version
87121
run: |
88-
./setup.sh --auto
89-
90-
- name: Configure Build
91-
run: cmake -G "Ninja" -S "${{ github.workspace }}" -B "${{ github.workspace }}/cmake-build" -DCMAKE_VERBOSE_MAKEFILE=YES -DprojectM4_DIR="artifacts/lib/cmake/projectM4"
92-
env:
93-
projectM4Playlist_DIR: "${{ github.workspace }}/artifacts/lib/cmake/projectM4Playlist"
122+
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
123+
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
124+
else
125+
echo "version=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
126+
fi
94127
95-
- name: Build Release
96-
id: build
97-
run: cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --parallel
128+
- name: Build
129+
run: |
130+
VENDOR_FLAGS=""
131+
if [[ "${{ matrix.variant }}" == static-* ]] && [ -f artifacts/projectm-version ]; then
132+
source artifacts/projectm-version
133+
GL_VARIANT="${{ matrix.variant }}"
134+
GL_VARIANT="${GL_VARIANT#static-}"
135+
VENDOR_FLAGS="-DPROJECTM_VENDOR_REF=${PROJECTM_VENDOR_REF} -DPROJECTM_VENDOR_COMMIT=${PROJECTM_VENDOR_COMMIT} -DPROJECTM_VENDOR_TIMESTAMP=${PROJECTM_VENDOR_TIMESTAMP} -DPROJECTM_VENDOR_GL_VARIANT=${GL_VARIANT}"
136+
fi
137+
cmake -G Ninja -S . -B build \
138+
-DCMAKE_VERBOSE_MAKEFILE=YES \
139+
-DprojectM4_DIR="artifacts/lib/cmake/projectM4" \
140+
-DprojectM4Playlist_DIR="artifacts/lib/cmake/projectM4Playlist" \
141+
-DGSTPROJECTM_VERSION="${{ steps.plugin-version.outputs.version }}" \
142+
${VENDOR_FLAGS}
143+
cmake --build build --config Release --parallel
98144
99145
- name: Test
100146
run: |
101-
GST_PLUGIN_PATH="${{ github.workspace }}/cmake-build" gst-inspect-1.0 projectm
102-
if: steps.build.outputs.return-code == 0
147+
if [[ "${{ matrix.variant }}" == static-* ]]; then
148+
GST_PLUGIN_PATH="build" gst-inspect-1.0 projectm
149+
else
150+
DYLD_LIBRARY_PATH="artifacts/lib:$DYLD_LIBRARY_PATH" GST_PLUGIN_PATH="build" gst-inspect-1.0 projectm
151+
fi
152+
continue-on-error: true
153+
154+
- uses: actions/upload-artifact@v4
155+
with:
156+
name: gst-projectm-osx-arm64-${{ matrix.variant }}-latest
157+
path: build/libgstprojectm.so
158+
159+
# ── Package (tag pushes only) ──────────────────────────────────
160+
- name: Create Package
161+
if: startsWith(github.ref, 'refs/tags/')
162+
run: |
163+
VERSION="${GITHUB_REF_NAME#v}"
164+
VERSION="${VERSION//\//.}"
165+
VARIANT="${{ matrix.variant }}"
166+
PKG_NAME="gstprojectm-${VERSION}-macos-arm64-${VARIANT}"
167+
mkdir -p "${PKG_NAME}/lib/gstreamer-1.0"
168+
169+
cp build/libgstprojectm.so "${PKG_NAME}/lib/gstreamer-1.0/"
170+
cp LICENSE "${PKG_NAME}/"
171+
172+
if [ "${VARIANT}" = "static-gl" ]; then
173+
VARIANT_NOTE="projectM is statically linked with desktop OpenGL support. No external projectM libraries required."
174+
elif [ "${VARIANT}" = "static-gles" ]; then
175+
VARIANT_NOTE="projectM is statically linked with OpenGL ES support. No external projectM libraries required."
176+
else
177+
VARIANT_NOTE="This package does NOT include projectM libraries.
178+
You must install projectM (>= 4.1.0) separately and ensure the
179+
shared libraries are available at runtime.
180+
See https://github.com/projectM-visualizer/projectm"
181+
fi
182+
183+
cat > "${PKG_NAME}/README.txt" << EOF
184+
GStreamer projectM Plugin - macOS arm64 (${VARIANT})
185+
====================================================
186+
${VARIANT_NOTE}
187+
188+
Installation (Homebrew GStreamer):
189+
cp lib/gstreamer-1.0/libgstprojectm.so \$(brew --prefix)/lib/gstreamer-1.0/
190+
191+
Installation (GStreamer.framework):
192+
cp lib/gstreamer-1.0/libgstprojectm.so \\
193+
/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0/
194+
195+
Verify: gst-inspect-1.0 projectm
196+
EOF
197+
198+
tar czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
103199
104-
- name: Upload Artifact
105-
uses: actions/upload-artifact@v4
200+
- uses: actions/upload-artifact@v4
201+
if: startsWith(github.ref, 'refs/tags/')
106202
with:
107-
name: gst-projectm-osx-latest
108-
path: ${{ github.workspace }}/cmake-build/libgstprojectm.dylib
203+
name: release-macos-arm64-${{ matrix.variant }}
204+
path: gstprojectm-*-macos-arm64-${{ matrix.variant }}.tar.gz

0 commit comments

Comments
 (0)