-
Notifications
You must be signed in to change notification settings - Fork 0
203 lines (175 loc) · 6.75 KB
/
compile-and-artifacts.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
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
name: Build and upload artifacts
on: [push, pull_request]
env:
PD_VERSION: 0.54-1
PDINCLUDEDIR: ./pure-data/src
PDLIBDIR: ./build
LIBNAME: simplex~
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64]
precision: [32, 64]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Clone Pd
run: git clone --branch=${{ env.PD_VERSION }} --depth=1 https://github.com/pure-data/pure-data.git
- name: Compile external
run: make install floatsize=${{ matrix.precision }} extension=linux-${{ matrix.arch }}-${{ matrix.precision }}.so
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-linux-${{ matrix.arch }}-pd${{ matrix.precision }}
path: build/${{env.LIBNAME}}
build-macos:
runs-on: macos-latest
strategy:
matrix:
arch: [fat]
precision: [32, 64]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Clone Pd
run: git clone --branch=${{ env.PD_VERSION }} --depth=1 https://github.com/pure-data/pure-data.git
- name: Set up environment
run: brew install make
- name: Compile external
run: |
if [ ${{ matrix.precision }} -eq 32 ]; then
make install floatsize=32 extension=d_fat arch="x86_64 arm64"
else
make install floatsize=64 extension=darwin-${{ matrix.arch }}-${{ matrix.precision }}.so arch="x86_64 arm64"
fi
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-macos-${{ matrix.arch }}-pd${{ matrix.precision }}
path: build/${{env.LIBNAME}}
build-windows:
runs-on: windows-latest
strategy:
matrix:
arch: [amd64]
precision: [32]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download Pure-Data Binaries
run: |
Invoke-WebRequest -Uri "http://msp.ucsd.edu/Software/pd-${{env.PD_VERSION}}.msw.zip" -OutFile "pd-${{env.PD_VERSION}}.msw.zip"
Expand-Archive -Path "pd-${{env.PD_VERSION}}.msw.zip" -DestinationPath .
- name: Set up compiler environment
run: |
echo "C:\\msys64\\usr\\bin" >> $GITHUB_PATH # Ensure make and GCC are in PATH
- name: Compile external
shell: bash
run: |
export PATH="/c/msys64/mingw64/bin:$PATH" # Ensure MinGW GCC is preferred if needed
make install CC=gcc PDINCLUDEDIR="pd-${{env.PD_VERSION}}/src" PDDIR="pd-${{env.PD_VERSION}}" PDBINDIR="pd-${{env.PD_VERSION}}/bin" extension=dll
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}-windows-${{ matrix.arch }}-pd${{ matrix.precision }}
path: build/${{env.LIBNAME}}
download-artifacts:
runs-on: ubuntu-latest
needs: [ build-linux, build-macos, build-windows ]
strategy:
matrix:
os: [linux, macos, windows]
arch: [amd64, arm64, fat]
precision: [32, 64]
exclude:
- { os: windows, precision: 64 }
- { os: windows, arch: arm64 }
- { os: windows, arch: fat }
- { os: linux, arch: fat }
- { os: linux, arch: arm64 }
- { os: macos, arch: arm64 }
- { os: macos, arch: amd64 }
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: ${{env.LIBNAME}}-${{ matrix.os }}-${{ matrix.arch }}-pd${{ matrix.precision }}
path: artifacts/${{ matrix.os }}
package-release:
needs: download-artifacts
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- name: Setup directories
run: |
mkdir -p ${{env.LIBNAME}}
mkdir -p artifacts/linux
mkdir -p artifacts/macos
mkdir -p artifacts/windows
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Merge Artifacts
run: |
cp -rn artifacts/*/* ${{env.LIBNAME}}/
- name: Rezip
run: |
SHORT=${GITHUB_REF:11} # Removes 'refs/tags/' prefix
SLUG=${SHORT//\//_} # Replaces '/' with '_'
zip -r ${{env.LIBNAME}}-${SLUG}.zip ${{env.LIBNAME}}
- name: Upload release content as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.LIBNAME}}
path: ${{env.LIBNAME}}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: simplex*.zip
upload_to_deken:
runs-on: ubuntu-latest
needs: [package-release]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
with:
path: ${{env.LIBNAME}}-src
- uses: actions/download-artifact@v4
with:
name: ${{env.LIBNAME}}
path: ${{env.LIBNAME}}
- name: Create Deken Package and upload
shell: bash
env:
DEKEN_USERNAME: ${{ secrets.DEKEN_USERNAME }}
DEKEN_PASSWORD: ${{ secrets.DEKEN_PASSWORD }}
run: |
SHORT=${GITHUB_REF:11} # remove the 'refs/tags/' prefix
SLUG=${SHORT//\//_} # replace '/' with '_'
if [[ "${GITHUB_REF}" == *"test"* ]]; then
echo "Dry-run: Preparing to package for test tag ${GITHUB_REF}"
mkdir -p ${PWD}/package
docker run --rm --user $(id -u) --volume ${PWD}/${{env.LIBNAME}}:/${{env.LIBNAME}} --volume ${PWD}/package:/package registry.git.iem.at/pd/deken \
deken package --output-dir /package -v "${SLUG}" /${{env.LIBNAME}}
echo "Listing generated Deken files for potential release:"
ls -l ${PWD}/package
echo "Listing contents of the .dek file:"
dek_files=$(ls ${PWD}/package/*.dek)
for dek_file in $dek_files; do
unzip -l "$dek_file"
done
else
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD --volume ${PWD}/${{env.LIBNAME}}-src:/${{env.LIBNAME}} registry.git.iem.at/pd/deken \
deken upload --name ${{env.LIBNAME}} /${{env.LIBNAME}}
docker run --rm -e DEKEN_USERNAME -e DEKEN_PASSWORD --volume ${PWD}/${{env.LIBNAME}}:/${{env.LIBNAME}} registry.git.iem.at/pd/deken \
deken upload --name ${{env.LIBNAME}} --no-source-error /${{env.LIBNAME}}
fi