-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (132 loc) · 5.37 KB
/
build.yml
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
157
158
159
name: Build and release
on:
release:
types: [created]
defaults:
run:
# This otherwise gets run under dash which does not support brace expansion
shell: bash
env:
binary_name: dm_whammy
plugin_name: dm-Whammy
mod_package_name: dm-whammy
jobs:
package-nih-plug:
name: Package nih-plug binaries
strategy:
matrix:
include:
- { name: ubuntu, os: ubuntu-latest, cross-target: "" }
- { name: macos, os: macos-latest, cross-target: x86_64-apple-darwin }
- { name: windows, os: windows-latest, cross-target: "" }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Fetch all git history
run: git fetch --force --prune --tags --unshallow
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libgl-dev libjack-dev libx11-xcb-dev libxcb1-dev libxcb-dri2-0-dev libxcb-icccm4-dev libxcursor-dev libxkbcommon-dev libxcb-shape0-dev libxcb-xfixes0-dev
- uses: actions/cache@v4
# FIXME: Caching `target/` causes the Windows runner to blow up after some time
if: startsWith(matrix.os, 'windows')
with:
path: |
~/nih-plug/.cargo/registry/index/
~/nih-plug/.cargo/registry/cache/
~/nih-plug/.cargo/git/db/
key: ${{ matrix.name }}-${{ matrix.cross-target }}
- uses: actions/cache@v4
if: startsWith(matrix.os, 'windows') != true
with:
path: |
~/nih-plug/.cargo/registry/index/
~/nih-plug/.cargo/registry/cache/
~/nih-plug/.cargo/git/db/
target/
key: ${{ matrix.name }}-${{ matrix.cross-target }}
- name: Set up Rust toolchain
# Needed for SIMD
uses: dtolnay/rust-toolchain@nightly
with:
# The macOS x86_64 build is done from an AArch64 macOS CI runner, so
# it needs to be cross compiled
targets: ${{ matrix.cross-target }}
- name: Build nih-plug
working-directory: ./nih-plug
run: |
runner_name=${{ matrix.name }}
if [[ $runner_name = 'macos' ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.13
cargo xtask bundle-universal $binary_name --release
else
cross_target=${{ matrix.cross-target }}
if [[ -n $cross_target ]]; then
cargo xtask bundle $binary_name --release --target $cross_target
else
cargo xtask bundle $binary_name --release
fi
fi
- name: Determine build archive name
run: |
# Windows (usually) doesn't like colons in file names
echo "ARCHIVE_NAME=$plugin_name-vst-and-clap-${{ matrix.name }}" >> "$GITHUB_ENV"
- name: Move all packaged plugin into a directory
run: |
mkdir -p $ARCHIVE_NAME
mv ./nih-plug/target/bundled/* $ARCHIVE_NAME
- name: Rename plugins
run: |
for file_name in $ARCHIVE_NAME/$binary_name.*;
do mv $file_name "${file_name/$binary_name/$plugin_name}";
done
- name: Add an OS-specific readme file with installation instructions
run: cp ".github/workflows/readme-${{ runner.os }}.txt" "$ARCHIVE_NAME/README.txt"
- name: Zip files
run: tar -cf $ARCHIVE_NAME.zip $ARCHIVE_NAME
- name: Add zip to release
uses: softprops/action-gh-release@v2
with:
name: ${{github.ref_name}}
files: ${{ env.ARCHIVE_NAME }}.zip
package-mod-plugin:
name: Package mod plugins
strategy:
matrix:
platform: [modduo-new, modduox-new, moddwarf-new]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Docker image from GHCR
run: docker pull ghcr.io/davemollen/${{ matrix.platform }}-plugin-builder:latest
- name: Run Docker container
run: docker run -t -d --name mpb ghcr.io/davemollen/${{ matrix.platform }}-plugin-builder:latest
- name: Update commit sha in build script
run: sed -i 's/<SHA>/${{ github.sha }}/' .github/workflows/$mod_package_name.mk
- name: Add local build script to Docker container
run: |
docker exec -w /root/mod-plugin-builder/plugins/package mpb mkdir -p $mod_package_name
docker cp .github/workflows/$mod_package_name.mk mpb:/root/mod-plugin-builder/plugins/package/$mod_package_name
- name: Build for modaudio
run: docker exec mpb ./build ${{ matrix.platform }} $mod_package_name
- name: Determine build archive name
run: echo "ARCHIVE_NAME=$plugin_name-${{ matrix.platform }}" >> "$GITHUB_ENV"
- name: Zip files
run: |
mkdir -p $ARCHIVE_NAME
docker cp mpb:/root/mod-workdir/${{ matrix.platform }}/plugins/$plugin_name.lv2 $ARCHIVE_NAME
cp .github/workflows/readme-Mod.txt "$ARCHIVE_NAME/README.txt"
tar -cf $ARCHIVE_NAME.zip $ARCHIVE_NAME
- name: Add zip to release
uses: softprops/action-gh-release@v2
with:
name: ${{github.ref_name}}
files: ${{ env.ARCHIVE_NAME }}.zip