summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: abab8912fb517a724ccd94aaa59874b222b140fe (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
name: build

on:
  push:
    branches:
      - '*'
  pull_request:
    branches:
      - '*'
env:
  CACHE_VERSION: 1
  DEBIAN_FRONTEND: noninteractive
  HOMEBREW_NO_AUTO_UPDATE: 1
  PAWPAW_VERSION: f82379fcbf4623112ef497b118a96c1d94b7112e

jobs:
  # macOS native intel build
  macos:
    runs-on: macos-10.15
    steps:
    - uses: actions/checkout@v2
      with:
        submodules: recursive
    - name: Set up cache
      uses: actions/cache@v2
      with:
        path: |
          ~/PawPawBuilds
        key: macos-v${{ env.CACHE_VERSION }}
    - name: Set up dependencies
      run: |
        brew install cmake jq meson
    - name: Bootstrap macOS intel
      shell: bash
      run: |
        if [ ! -d PawPaw ]; then
          git clone https://github.com/DISTRHO/PawPaw.git
          git -C PawPaw checkout ${PAWPAW_VERSION}
        fi
        ./PawPaw/bootstrap-jack2.sh macos && ./PawPaw/.cleanup.sh macos
    - name: Build jack2
      shell: bash
      run: |
        pushd PawPaw && source local.env macos && popd
        python ./waf configure --platform=darwin --prefix=/usr/local
        python ./waf build -j $(sysctl -n hw.logicalcpu)
        python ./waf install --destdir=$(pwd)/destdir
    - name: Set sha8
      id: slug
      run: echo "::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)"
    - name: Generate macOS package
      shell: bash
      run: |
        ./macosx/generate-pkg.sh $(pwd)/destdir/usr/local ${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
    - uses: actions/upload-artifact@v2
      with:
        name: jack2-macOS-intel-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
        path: macosx/jack2-osx-*.pkg

  # macOS native universal build
  macos_universal:
    runs-on: macos-10.15
    steps:
    - uses: actions/checkout@v2
      with:
        submodules: recursive
    - name: Set up cache
      uses: actions/cache@v2
      with:
        path: |
          ~/PawPawBuilds
        key: macos-universal-v${{ env.CACHE_VERSION }}
    - name: Set up dependencies
      run: |
        brew install cmake jq meson
    - name: Fix up Xcode
      run: |
        sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
        sudo xcode-select -s /Applications/Xcode_12.3.app
    - name: Bootstrap macOS universal
      shell: bash
      run: |
        if [ ! -d PawPaw ]; then
          git clone https://github.com/DISTRHO/PawPaw.git
          git -C PawPaw checkout ${PAWPAW_VERSION}
        fi
        ./PawPaw/bootstrap-jack2.sh macos-universal && ./PawPaw/.cleanup.sh macos-universal
    - name: Build jack2
      shell: bash
      run: |
        pushd PawPaw && source local.env macos-universal && popd
        python ./waf configure --platform=darwin --prefix=/usr/local
        python ./waf build -j $(sysctl -n hw.logicalcpu)
        python ./waf install --destdir=$(pwd)/destdir
    - name: Set sha8
      id: slug
      run: echo "::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)"
    - name: Generate macOS package
      shell: bash
      run: |
        ./macosx/generate-pkg.sh $(pwd)/destdir/usr/local ${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
    - uses: actions/upload-artifact@v2
      with:
        name: jack2-macOS-universal-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
        path: macosx/jack2-osx-*.pkg

  # linux with win32 cross-compilation
  win32:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2
      with:
        submodules: recursive
    - name: Set up cache
      uses: actions/cache@v2
      with:
        path: |
          ~/PawPawBuilds
        key: win32-v${{ env.CACHE_VERSION }}
    - name: Restore debian packages cache
      run: |
        if [ -d ~/PawPawBuilds/debs ] && [ "$(ls ~/PawPawBuilds/debs | wc -l)" -ne 0 ]; then \
          sudo cp ~/PawPawBuilds/debs/*.deb /var/cache/apt/archives/; \
        fi
    - name: Fix GitHub mess
      run: |
        sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
        sudo apt-get update -qq
        sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
    - name: Set up dependencies
      run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -qq
        sudo apt-get install -y autopoint build-essential curl cmake jq llvm mingw-w64 qttools5-dev-tools xvfb \
          binutils-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64 wine-stable:i386
    - name: Cache debian packages
      run: |
        mkdir -p ~/PawPawBuilds/debs && \
        sudo mv /var/cache/apt/archives/*.deb ~/PawPawBuilds/debs/
    - name: Bootstrap win32 cross-compiled
      shell: bash
      run: |
        if [ ! -d PawPaw ]; then
          git clone https://github.com/DISTRHO/PawPaw.git
          git -C PawPaw checkout ${PAWPAW_VERSION}
        fi
        ./PawPaw/bootstrap-jack2.sh win32 && ./PawPaw/.cleanup.sh win32
    - name: Build jack2
      shell: bash
      run: |
        pushd PawPaw && source local.env win32 && popd
        ./waf configure --platform=win32 --prefix=$(pwd)/destdir --static
        ./waf build -j $(nproc)
        ./waf install
    - name: Generate MSVC lib files
      shell: bash
      run: |
        pushd $(pwd)/destdir/lib
        llvm-dlltool -m i386 -D libjack.dll -d libjack.def -l libjack.lib
        llvm-dlltool -m i386 -D libjacknet.dll -d libjacknet.def -l libjacknet.lib
        llvm-dlltool -m i386 -D libjackserver.dll -d libjackserver.def -l libjackserver.lib
        popd
    - name: Set sha8
      id: slug
      run: echo "::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)"
    - name: Generate Windows installer
      shell: bash
      run: |
        # Setup wine
        export WINEPREFIX=$(pwd)/innosetup
        wineboot -u
        # Download and install innosetup
        curl -L https://jrsoftware.org/download.php/is.exe?site=2 -o is.exe
        xvfb-run wine is.exe /allusers /dir=C:\\InnoSeup /nocancel /norestart /verysilent
        # create installer
        ln -sf $(pwd)/destdir windows/inno/win32
        pushd windows/inno
        echo "#define VERSION \"${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}\"" > version.iss
        xvfb-run wine ${WINEPREFIX}/drive_c/InnoSeup/ISCC.exe win32-mini.iss
        popd
    - uses: actions/upload-artifact@v2
      with:
        name: jack2-win32-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
        path: windows/inno/jack2-*.exe

  # linux with win64 cross-compilation
  win64:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2
      with:
        submodules: recursive
    - name: Set up cache
      uses: actions/cache@v2
      with:
        path: |
          ~/PawPawBuilds
        key: win64-v${{ env.CACHE_VERSION }}
    - name: Restore debian packages cache
      run: |
        if [ -d ~/PawPawBuilds/debs ] && [ "$(ls ~/PawPawBuilds/debs | wc -l)" -ne 0 ]; then \
          sudo cp ~/PawPawBuilds/debs/*.deb /var/cache/apt/archives/; \
        fi
    - name: Fix GitHub's mess
      run: |
        sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
        sudo apt-get update -qq
        sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
    - name: Set up dependencies
      run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -qq
        sudo apt-get install -y autopoint build-essential curl cmake jq llvm mingw-w64 qttools5-dev-tools xvfb \
          binutils-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64 wine-stable
    - name: Cache debian packages
      run: |
        mkdir -p ~/PawPawBuilds/debs && \
        sudo mv /var/cache/apt/archives/*.deb ~/PawPawBuilds/debs/
    - name: Bootstrap win64 cross-compiled
      shell: bash
      run: |
        if [ ! -d PawPaw ]; then
          git clone https://github.com/DISTRHO/PawPaw.git
          git -C PawPaw checkout ${PAWPAW_VERSION}
        fi
        ./PawPaw/bootstrap-jack2.sh win64 && ./PawPaw/.cleanup.sh win64
    - name: Build jack2
      shell: bash
      run: |
        pushd PawPaw && source local.env win64 && popd
        export PATH+=":/usr/i686-w64-mingw32/bin"
        export LDFLAGS+="-L~/PawPawBuilds/targets/win64/lib32"
        ./waf configure --platform=win32 --prefix=$(pwd)/destdir --static --mixed
        ./waf build -j $(nproc)
        ./waf install
    - name: Generate MSVC lib files
      shell: bash
      run: |
        # 32bit
        pushd $(pwd)/destdir/lib32
        llvm-dlltool -m i386 -D libjack.dll -d libjack.def -l libjack.lib
        popd
        # 64bit
        pushd $(pwd)/destdir/lib
        llvm-dlltool -m i386:x86-64 -D libjack64.dll -d libjack64.def -l libjack64.lib
        llvm-dlltool -m i386:x86-64 -D libjacknet64.dll -d libjacknet64.def -l libjacknet64.lib
        llvm-dlltool -m i386:x86-64 -D libjackserver64.dll -d libjackserver64.def -l libjackserver64.lib
        popd
    - name: Set sha8
      id: slug
      run: echo "::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)"
    - name: Generate Windows installer
      shell: bash
      run: |
        # Setup wine
        export WINEPREFIX=$(pwd)/innosetup
        wineboot -u
        # Download and install innosetup
        curl -L https://jrsoftware.org/download.php/is.exe?site=2 -o is.exe
        xvfb-run wine64 is.exe /allusers /dir=C:\\InnoSeup /nocancel /norestart /verysilent
        # create installer
        ln -sf $(pwd)/destdir windows/inno/win64
        pushd windows/inno
        echo "#define VERSION \"${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}\"" > version.iss
        xvfb-run wine64 ${WINEPREFIX}/drive_c/InnoSeup/ISCC.exe win64-mini.iss
        popd
    - uses: actions/upload-artifact@v2
      with:
        name: jack2-win64-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
        path: windows/inno/jack2-*.exe

  # ubuntu-20.04
  ubuntu_20_04:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v2
      with:
        submodules: recursive
    - name: Set up cache
      uses: actions/cache@v2
      with:
        path: |
          ~/debs
        key: ubuntu-20.04-v${{ env.CACHE_VERSION }}
    - name: Restore debian packages cache
      run: |
        if [ -d ~/debs ] && [ "$(ls ~/debs | wc -l)" -ne 0 ]; then \
          sudo cp ~/debs/*.deb /var/cache/apt/archives/; \
        fi
    - name: Set up dependencies
      run: |
        sudo add-apt-repository -y ppa:ubuntustudio-ppa/backports
        sudo sed -i "s/# deb-src/deb-src/" /etc/apt/sources.list /etc/apt/sources.list.d/*.list
        sudo apt-get update -qq
        sudo apt-get build-dep jackd2
        sudo apt-get install devscripts
    - name: Cache debian packages
      run: |
        mkdir -p ~/debs && \
        sudo mv /var/cache/apt/archives/*.deb ~/debs/
    - name: Set sha8
      id: slug
      run: echo "::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)"
    - name: Build jack2 packages
      shell: bash
      run: |
        apt-get source -d jackd2
        tar xf *.debian.tar.xz
        rm -rf debian/source
        dch -M -b -v "$(cat wscript | awk 'sub("VERSION=","")' | tr -d "'")~$(date +"%Y%m%d")git${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}" -D focal "automated build"
        debuild -rfakeroot --no-lintian || true
    - uses: actions/upload-artifact@v2
      with:
        name: jack2-ubuntu-20.04-${{ github.event.pull_request.number || steps.slug.outputs.sha8 }}
        path: ~/work/jack2/*.deb