-
Notifications
You must be signed in to change notification settings - Fork 33
217 lines (199 loc) · 7.08 KB
/
binaries.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
on:
push:
tags:
- 'v*' # "v1.2.3"
branches:
- master
paths-ignore: ['media/**', 'docs/**', '**/*.md']
pull_request:
paths-ignore: ['media/**', 'docs/**', '**/*.md']
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: true
matrix:
target:
- os: linux
triple: x86_64-linux-musl
name: linux
cpu: amd64
nim_cpu: amd64
nimble_cpu: amd64
archive_format: tgz
- os: linux
triple: i686-linux-musl
name: linux
cpu: i686
nim_cpu: i386
nimble_cpu: amd64
archive_format: tgz
- os: linux
triple: aarch64-linux-musl
name: linux
cpu: arm64
nim_cpu: arm64
nimble_cpu: amd64
archive_format: tgz
- os: macos
triple: x86_64-apple-darwin14
name: macos
cpu: amd64
nim_cpu: amd64
nimble_cpu: amd64
archive_format: zip
- os: macos
triple: aarch64-apple-darwin14
name: macos
cpu: arm64
nim_cpu: arm64
nimble_cpu: amd64
archive_format: zip
- os: windows
triple: x86_64-w64-mingw32
name: windows
cpu: amd64
nim_cpu: amd64
nimble_cpu: amd64
archive_format: zip
- os: windows
triple: i686-w32-mingw32
name: windows
cpu: i686
nim_cpu: i386
nimble_cpu: amd64
archive_format: zip
include:
- target:
os: linux
builder: ubuntu-20.04
- target:
os: macos
builder: macos-12
- target:
os: windows
builder: windows-2019
defaults:
run:
shell: bash
name: '${{ matrix.target.triple }}'
runs-on: ${{ matrix.builder }}
steps:
- name: Setup Build
if: matrix.builder == 'ubuntu-20.04'
run: |
sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu \
gcc-i686-linux-gnu binutils-i686-linux-gnu \
mingw-w64
- name: Setup mingw32
if: matrix.target.triple == 'i686-w32-mingw32'
run: |
curl -LSsO https://github.com/brechtsanders/winlibs_mingw/releases/download/11.1.0-12.0.0-8.0.2-r1/winlibs-i686-posix-dwarf-gcc-11.1.0-mingw-w64-8.0.2-r1.7z
echo "588794e11be36389501610cf78de777e52a920e03db256ee8bd1a7c2c45e39a4 winlibs-i686-posix-dwarf-gcc-11.1.0-mingw-w64-8.0.2-r1.7z" | sha256sum -c
7z x winlibs-i686-posix-dwarf-gcc-11.1.0-mingw-w64-8.0.2-r1.7z C:\\
echo "C:\\mingw32\\bin" >> $GITHUB_PATH
- name: Checkout
uses: actions/checkout@v4
- name: Setup Nimble
uses: nim-lang/setup-nimble-action@v1
with:
nimble-version: "0.16.3"
- name: Restore nimble dependencies from cache
id: nimble_deps
uses: actions/cache@v4
with:
path: ~/.nimble/
key: ${{ matrix.target.os }}-${{ env.cache_nonce }}
- name: build nimlangserver
run: |
echo i386.linux.gcc.exe = \"i686-linux-gnu-gcc\" >> nimlangserver.nim.cfg
echo i386.linux.gcc.linkerexe = \"i686-linux-gnu-gcc\" >> nimlangserver.nim.cfg
echo i386.windows.gcc.exe = \"i686-w64-mingw32-gcc.exe\" >> nimlangserver.nim.cfg
echo i386.windows.gcc.linkerexe = \"i686-w64-mingw32-gcc.exe\" >> nimlangserver.nim.cfg
if [ ${{ matrix.target.triple }} = 'aarch64-apple-darwin14' ]; then
echo "--passC:\"-target arm64-apple-macos11\"" >> nimlangserver.nim.cfg
echo "--passL:\"-target arm64-apple-macos11\"" >> nimlangserver.nim.cfg
cat nimlangserver.nim.cfg
nimble build -d:release --cpu:arm64 --os:macosx
else
nimble build -d:release --cpu:${{ matrix.target.nim_cpu }}
fi
- name: Compress the Nim Language Server binaries
run: |
if [ ${{matrix.target.name}} = 'windows' ]; then
EXEEXT=.exe
else
EXEEXT=
fi
if [ ${{ matrix.target.archive_format }} = 'zip' ]; then
7z a -tzip nimlangserver-${{ matrix.target.name }}-${{ matrix.target.cpu }}.zip nimlangserver${EXEEXT}
else
tar -czvf nimlangserver-${{ matrix.target.name }}-${{ matrix.target.cpu }}.tar.gz nimlangserver${EXEEXT}
fi
- name: Upload the Nim Language Server Binaries (.zip)
if: matrix.target.archive_format == 'zip'
uses: actions/upload-artifact@v4
with:
name: nimlangserver-${{ matrix.target.name }}-${{ matrix.target.cpu }}.zip
path: nimlangserver-${{ matrix.target.name }}-${{ matrix.target.cpu }}.zip
- name: Upload the Nim Language Server Binaries (.tar.gz)
if: matrix.target.archive_format == 'tgz'
uses: actions/upload-artifact@v4
with:
name: nimlangserver-${{ matrix.target.name }}-${{ matrix.target.cpu }}.tar.gz
path: nimlangserver-${{ matrix.target.name }}-${{ matrix.target.cpu }}.tar.gz
create-macos-universal-binary:
name: Create a Universal macOS binary
needs: [build]
runs-on: macos-12
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: nimlangserver-macos-*.zip
- name: Extract binaries for amd64-macos
shell: bash
run: |
7z x nimlangserver-macos-amd64.zip/nimlangserver-macos-amd64.zip
mv nimlangserver nimlangserver-amd64
- name: Extract binaries for arm64-macos
shell: bash
run: |
7z x nimlangserver-macos-arm64.zip/nimlangserver-macos-arm64.zip
mv nimlangserver nimlangserver-arm64
- name: Build Universal binary
shell: bash
run: |
lipo -create -output nimlangserver nimlangserver-amd64 nimlangserver-arm64
- name: Compress the Nim Language Server binaries
shell: bash
run: |
7z a -tzip nimlangserver-macos-universal.zip nimlangserver
- name: Upload the Nim Language Server Binaries
uses: actions/upload-artifact@v4
with:
name: nimlangserver-macos-universal.zip
path: nimlangserver-macos-universal.zip
create-github-release:
name: Create Github Release
needs: [build, create-macos-universal-binary]
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Download artefacts
uses: actions/download-artifact@v4
- uses: ncipollo/release-action@v1
with:
name: Latest Nimlangserver Binaries
artifacts: "*/*"
allowUpdates: true
makeLatest: true
prerelease: true
tag: latest
- name: Delete artefacts
uses: geekyeggo/delete-artifact@v5
with:
failOnError: false
name: "nimlangserver-*"