Skip to content

Commit 5096587

Browse files
authored
build plugin with Rack Docker Toolchain for win linux, use MacOS VM for mac (#4)
1 parent 020c7b1 commit 5096587

2 files changed

Lines changed: 61 additions & 35 deletions

File tree

.github/workflows/build-plugin.yml

Lines changed: 60 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,99 @@ name: Build VCV Rack Plugin
22
on: [push, pull_request]
33

44
env:
5-
rack-sdk-version: 2.1.0
5+
rack-sdk-version: 2.0.6
6+
rack-plugin-toolchain-dir: /home/build/rack-plugin-toolchain
67

78
defaults:
89
run:
910
shell: bash
1011

1112
jobs:
13+
14+
modify-plugin-version:
15+
name: Modify plugin version
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions/cache@v2
20+
id: plugin-version-cache
21+
with:
22+
path: plugin.json
23+
key: ${{ github.sha }}
24+
- run: |
25+
gitrev=`git rev-parse --short HEAD`
26+
pluginversion=`jq -r '.version' plugin.json`
27+
echo "Set plugin version from $pluginversion to $pluginversion-$gitrev"
28+
cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json
29+
# only modify plugin version if no tag was created
30+
if: "! startsWith(github.ref, 'refs/tags/v')"
31+
1232
build:
13-
name: ${{ matrix.config.name }}
14-
runs-on: ${{ matrix.config.os }}
33+
name: ${{ matrix.platform }}
34+
needs: modify-plugin-version
35+
runs-on: ubuntu-latest
36+
container:
37+
image: ghcr.io/qno/rack-plugin-toolchain-win-linux:v2
38+
options: --user root
1539
strategy:
1640
matrix:
17-
config:
18-
- {
19-
name: Linux,
20-
sdk-platform: lin,
21-
os: ubuntu-latest,
22-
prepare-os: sudo apt update && sudo apt install -y libglu-dev
23-
}
24-
- {
25-
name: MacOS,
26-
sdk-platform: mac,
27-
os: macos-latest,
28-
prepare-os: ""
29-
}
30-
- {
31-
name: Windows,
32-
sdk-platform: win,
33-
os: windows-latest,
34-
prepare-os: export CC=gcc
35-
}
41+
platform: [win, linux]
42+
steps:
43+
- uses: actions/checkout@v3
44+
with:
45+
submodules: recursive
46+
- uses: actions/cache@v2
47+
id: plugin-version-cache
48+
with:
49+
path: plugin.json
50+
key: ${{ github.sha }}
51+
- name: Build plugin
52+
run: |
53+
export PLUGIN_DIR=$GITHUB_WORKSPACE
54+
pushd ${{ env.rack-plugin-toolchain-dir }}
55+
make plugin-build-${{ matrix.platform }}
56+
- name: Upload artifact
57+
uses: actions/upload-artifact@v2
58+
with:
59+
path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build
60+
name: ${{ matrix.platform }}
61+
62+
build-mac:
63+
name: mac
64+
needs: modify-plugin-version
65+
runs-on: macos-10.15
3666
steps:
3767
- uses: actions/checkout@v3
3868
with:
3969
submodules: recursive
70+
- uses: actions/cache@v2
71+
id: plugin-version-cache
72+
with:
73+
path: plugin.json
74+
key: ${{ github.sha }}
4075
- name: Get Rack-SDK
4176
run: |
4277
pushd $HOME
43-
curl -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-${{ matrix.config.sdk-platform }}.zip
78+
curl -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac.zip
4479
unzip Rack-SDK.zip
45-
- name: Modify plugin version
46-
# only modify plugin version if no tag was created
47-
if: "! startsWith(github.ref, 'refs/tags/v')"
48-
run: |
49-
gitrev=`git rev-parse --short HEAD`
50-
pluginversion=`jq -r '.version' plugin.json`
51-
echo "Set plugin version from $pluginversion to $pluginversion-$gitrev"
52-
cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json
5380
- name: Build plugin
5481
run: |
55-
${{ matrix.config.prepare-os }}
5682
export RACK_DIR=$HOME/Rack-SDK
5783
make -j dep
5884
make -j dist
5985
- name: Upload artifact
6086
uses: actions/upload-artifact@v2
6187
with:
6288
path: dist
63-
name: ${{ matrix.config.name }}
89+
name: mac
6490

6591
publish:
6692
name: Publish plugin
6793
# only create a release if a tag was created that is called e.g. v1.2.3
6894
# see also https://vcvrack.com/manual/Manifest#version
6995
if: startsWith(github.ref, 'refs/tags/v')
7096
runs-on: ubuntu-latest
71-
needs: build
97+
needs: [build, build-mac]
7298
steps:
7399
- uses: actions/checkout@v3
74100
- uses: FranzDiebold/github-env-vars-action@v1.2.1

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"slug": "MyPlugin",
33
"name": "MyPlugin",
4-
"version": "2.1.0",
4+
"version": "2.0.8",
55
"license": "GPL-3.0-or-later",
66
"brand": "MyBrand",
77
"author": "Me",

0 commit comments

Comments
 (0)