-
-
Notifications
You must be signed in to change notification settings - Fork 19
222 lines (176 loc) · 6.36 KB
/
build-core.yml
File metadata and controls
222 lines (176 loc) · 6.36 KB
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
name: Build Core
on:
push:
branches: [ main ]
tags:
- "v*"
- "*.*.*"
pull_request:
branches: [ main ]
env:
CGO_CXXFLAGS: "-D__RTMIDI_DEBUG__=0 -D__RTMIDI_QUIET__"
defaults:
run:
working-directory: core
jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- name: Install rtmidi dependencies
run: |
brew update
brew install pkg-config
brew install rtmidi
brew install sox
- uses: actions/setup-go@v6
with:
go-version: "stable"
- name: Set up environment variables
run: echo "CGO_ENABLED=1" >> $GITHUB_ENV
# - name: Test
# run: go test -v ./...
- name: Build Go project (ectocore)
run: go build -v -ldflags "-X main.Version=${{ github.ref_name }} -X main.EctocoreDefault=yes" -o core
- name: Verify binary (ectocore)
run: ./core --help
- name: Zip binary (ectocore macOS)
run: zip -9 ezeptocore_tool_macos.zip core
- name: Build Go project (zeptocore)
run: go build -v -ldflags "-X main.Version=${{ github.ref_name }} -X main.ZeptocoreDefault=yes" -o core
- name: Verify binary (zeptocore)
run: ./core --help
- name: Zip binary (zeptocore macOS)
run: zip -9 zeptocore_tool_macos.zip core
- name: Upload artifact (ectocore macOS)
uses: actions/upload-artifact@v4
with:
name: ezeptocore_tool_macos.zip
path: core/ezeptocore_tool_macos.zip
if-no-files-found: error
- name: Upload artifact (zeptocore macOS)
uses: actions/upload-artifact@v4
with:
name: zeptocore_tool_macos.zip
path: core/zeptocore_tool_macos.zip
if-no-files-found: error
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev sox zip
- uses: actions/setup-go@v6
with:
go-version: "stable"
# - name: Test
# run: go test -v ./...
- name: Build Go project (ectocore)
run: go build -v -ldflags "-X main.Version=${{ github.ref_name }} -X main.EctocoreDefault=yes" -o core
- name: Verify binary (ectocore)
run: ./core --help
- name: Zip binary (ectocore Linux)
run: zip -9 ezeptocore_tool_linux.zip core
- name: Build Go project (zeptocore)
run: go build -v -ldflags "-X main.Version=${{ github.ref_name }} -X main.ZeptocoreDefault=yes" -o core
- name: Verify binary (zeptocore)
run: ./core --help
- name: Zip binary (zeptocore Linux)
run: zip -9 zeptocore_tool_linux.zip core
- name: Upload artifact (ectocore Linux)
uses: actions/upload-artifact@v4
with:
name: ezeptocore_tool_linux.zip
path: core/ezeptocore_tool_linux.zip
if-no-files-found: error
- name: Upload artifact (zeptocore Linux)
uses: actions/upload-artifact@v4
with:
name: zeptocore_tool_linux.zip
path: core/zeptocore_tool_linux.zip
if-no-files-found: error
windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
- name: Install required packages
shell: msys2 {0}
run: |
pacman -S --noconfirm mingw-w64-x86_64-rtmidi mingw-w64-x86_64-toolchain
- name: Set up environment variables for Go
shell: pwsh
run: |
$env:Path += ";C:\msys64\mingw64\bin"
echo "CGO_ENABLED=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CC=x86_64-w64-mingw32-gcc" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CGO_LDFLAGS=-static" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CGO_CXXFLAGS=-D__RTMIDI_DEBUG__=0 -D__RTMIDI_QUIET__" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/setup-go@v6
with:
go-version: "stable"
# - name: Test
# run: go test -v ./...
- name: Build Go project (ectocore)
run: go build -v -ldflags "-X main.Version=${{ github.ref_name }} -X main.EctocoreDefault=yes" -o core.exe
- name: Verify binary (ectocore)
run: .\core.exe --help
- name: Zip binary (ectocore Windows)
shell: pwsh
run: Compress-Archive -Path core.exe -DestinationPath ezeptocore_tool_windows.zip -Force
- name: Build Go project (zeptocore)
run: go build -v -ldflags "-X main.Version=${{ github.ref_name }} -X main.ZeptocoreDefault=yes" -o core.exe
- name: Verify binary (zeptocore)
run: .\core.exe --help
- name: Zip binary (zeptocore Windows)
shell: pwsh
run: Compress-Archive -Path core.exe -DestinationPath zeptocore_tool_windows.zip -Force
- name: Upload artifact (ectocore Windows)
uses: actions/upload-artifact@v4
with:
name: ezeptocore_tool_windows.zip
path: core/ezeptocore_tool_windows.zip
if-no-files-found: error
- name: Upload artifact (zeptocore Windows)
uses: actions/upload-artifact@v4
with:
name: zeptocore_tool_windows.zip
path: core/zeptocore_tool_windows.zip
if-no-files-found: error
release:
name: Create GitHub Release (on tags)
runs-on: ubuntu-latest
needs: [macos, linux, windows]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
defaults:
run:
working-directory: .
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
merge-multiple: true
- name: List artifacts
run: ls -l ./dist
- name: Create Release and upload assets
uses: softprops/action-gh-release@v2
with:
files: |
dist/ezeptocore_tool_macos.zip
dist/ezeptocore_tool_linux.zip
dist/ezeptocore_tool_windows.zip
dist/zeptocore_tool_macos.zip
dist/zeptocore_tool_linux.zip
dist/zeptocore_tool_windows.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}