-
Notifications
You must be signed in to change notification settings - Fork 18
199 lines (196 loc) · 6.62 KB
/
ci.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
name: CI
on:
push: # test + build + release
branches: [ master ]
pull_request: # test + build
branches: [ master ]
release: # test + build + release
types: [ published ]
env:
DC: ldc-1.29.0
defaults:
run:
shell: bash
jobs:
test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ env.DC }}
- name: Test
run: |
cd source
ldc2 -m64 -g -i main.d -unittest -of=test.exe
./test.exe
build:
name: Build CLI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
EXE: vox
PLATFORM: linux-x64
- os: macos-latest
EXE: vox
PLATFORM: macos-x64
- os: windows-latest
EXE: vox.exe
PLATFORM: windows-x64
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ env.DC }}
- name: Build release
run: |
mkdir -p bin
cd source
ldc2 -d-version=test -m64 -release -fprofile-instr-generate -i main.d -of=vox_instrumented.exe
./vox_instrumented.exe
ldc-profdata merge default.profraw -output vox.profdata
ldc2 -m64 -O3 -mcpu=x86-64-v3 -release -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -d-version=cli -fprofile-instr-use=vox.profdata -of=../bin/${{matrix.EXE}} -i main.d
cd ../bin
7z a -mx9 vox-${{matrix.PLATFORM}}.zip ${{matrix.EXE}}
- uses: actions/upload-artifact@v3
with:
path: ./bin/vox-${{matrix.PLATFORM}}.zip
build-debug:
name: Build CLI debug
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
EXE: vox
PLATFORM: linux-x64
- os: macos-latest
EXE: vox
PLATFORM: macos-x64
- os: windows-latest
EXE: vox.exe
DBG_FILE: vox.pdb
PLATFORM: windows-x64
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ env.DC }}
- name: Build release
run: |
mkdir -p bin
cd source
ldc2 -d-version=test -m64 -release -fprofile-instr-generate -i main.d -of=vox_instrumented.exe
./vox_instrumented.exe
ldc-profdata merge default.profraw -output vox.profdata
ldc2 -m64 -O3 -mcpu=x86-64-v3 --d-debug -g -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -d-version=cli -fprofile-instr-use=vox.profdata -of=../bin/${{matrix.EXE}} -i main.d
cd ../bin
7z a -mx9 vox-${{matrix.PLATFORM}}-dbg.zip ${{matrix.EXE}} ${{matrix.DBG_FILE}}
- uses: actions/upload-artifact@v3
with:
path: ./bin/vox-${{matrix.PLATFORM}}-dbg.zip
build-shared:
name: Build shared
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
DLL: libvox.so
PLATFORM: linux-x64
- os: macos-latest
DLL: libvox.dylib
PLATFORM: macos-x64
- os: windows-latest
DLL: libvox.dll
LIB: libvox.lib
PLATFORM: windows-x64
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ env.DC }}
- name: Build shared lib
run: |
mkdir -p bin
cd source
ldc2 -m64 -shared -O3 -mcpu=x86-64-v3 -release -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -fvisibility=hidden -link-defaultlib-shared=false -i c_api.d -of=../bin/${{matrix.DLL}}
cd ../bin
7z a -mx9 libvox-${{matrix.PLATFORM}}.zip ${{matrix.DLL}} ${{matrix.LIB}}
- uses: actions/upload-artifact@v3
with:
path: ./bin/libvox-${{matrix.PLATFORM}}.zip
build-shared-debug:
name: Build shared debug
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
DLL: libvox.so
PLATFORM: linux-x64
- os: macos-latest
DLL: libvox.dylib
PLATFORM: macos-x64
- os: windows-latest
DLL: libvox.dll
LIB: libvox.lib
DBG_FILE: libvox.pdb
PLATFORM: windows-x64
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ env.DC }}
- name: Build shared lib
run: |
mkdir -p bin
cd source
ldc2 -m64 -shared -O3 -mcpu=x86-64-v3 --d-debug -g -boundscheck=off -enable-inlining -flto=full -linkonce-templates --defaultlib=phobos2-ldc-lto,druntime-ldc-lto -fvisibility=hidden -link-defaultlib-shared=false -i c_api.d -of=../bin/${{matrix.DLL}}
cd ../bin
7z a -mx9 libvox-${{matrix.PLATFORM}}-dbg.zip ${{matrix.DLL}} ${{matrix.LIB}} ${{matrix.DBG_FILE}}
- uses: actions/upload-artifact@v3
with:
path: ./bin/libvox-${{matrix.PLATFORM}}-dbg.zip
upload:
name: Upload build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: [test, build, build-debug, build-shared, build-shared-debug]
steps:
# Cloning is needed for `gh release create` to work. It looks repository up in .git folder
- uses: actions/checkout@v3
# Download build artifacts of other jobs
- uses: actions/download-artifact@v3
with:
name: artifact
path: bin/
# Update tag, so that we get proper date and commit on github
- name: Update CI tag
uses: richardsimko/update-tag@v1
if: github.ref == 'refs/heads/master'
with:
tag_name: CI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create CI release and upload builds
- name: Upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=`basename ${{ github.ref }}`
if [ $tag = 'master' ]; then
tag='CI'
fi
# --clobber Overwrite existing assets of the same name
gh release upload $tag bin/*.zip --clobber