-
Notifications
You must be signed in to change notification settings - Fork 2
/
.drone.yml
235 lines (218 loc) · 6.28 KB
/
.drone.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
---
kind: pipeline
name: linux-build
steps:
- name: build-lucky
image: clux/muslrust:nightly-2019-11-24
commands:
# Set Lucky version for build
- |
if [ "${DRONE_TAG}" != "" ]; then
export LUCKY_VERSION=${DRONE_TAG}
else
export LUCKY_VERSION=pre-release-$$(echo ${DRONE_COMMIT} | awk '{print substr($$0, 0, 8)}')
fi
# Generate CLI docs
- cargo run --release --features doc-gen docs/book/src/
# Build Lucky CLI
- cargo build --release
- mkdir -p build
- mv target/x86_64-unknown-linux-musl/release/lucky build
- cd build/
- tar -czf lucky-linux-x86_64.tgz lucky
- name: build-book
image: hrektts/mdbook
depends_on:
- build-lucky
commands:
- cd docs/book
- mdbook build
- name: publish-book
image: plugins/gh-pages
depends_on:
- build-book
settings:
pages_directory: docs/book/build
username:
from_secret: github_username
password:
from_secret: github_access_key
when:
event:
- push
branch:
- master
# Publish pre-release to GitHub releases
- name: publish-pre-release
image: plugins/github-release
depends_on:
- build-lucky
settings:
title: pre-release
api_key:
from_secret: github_access_key
files:
- build/lucky-linux-x86_64.tgz
when:
ref:
- refs/tags/pre-release
# Publish release to GitHub releases
- name: publish-release
image: plugins/github-release
depends_on:
- build-lucky
settings:
api_key:
from_secret: github_access_key
files:
- build/lucky-linux-x86_64.tgz
when:
ref:
- refs/tags/v*
trigger:
branch:
exclude:
- feature/*
---
kind: pipeline
name: windows-build
steps:
- name: build
image: rust:latest
commands:
# Set Lucky version for build
- |
if [ "${DRONE_TAG}" != "" ]; then
export LUCKY_VERSION=${DRONE_TAG}
else
export LUCKY_VERSION=pre-release-$$(echo ${DRONE_COMMIT} | awk '{print substr($$0, 0, 8)}')
fi
- apt-get update
- apt-get install -y gcc-mingw-w64-x86-64 zip
- rustup default nightly-2019-11-24
- rustup target install x86_64-pc-windows-gnu
# Patch Some MingW Libs. See https://github.com/rust-lang/rust/issues/47048#issuecomment-474118132
- cp -f /usr/x86_64-w64-mingw32/lib/dllcrt2.o /usr/local/rustup/toolchains/nightly-2019-11-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/dllcrt2.o
- cp -f /usr/x86_64-w64-mingw32/lib/crt2.o /usr/local/rustup/toolchains/nightly-2019-11-24-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/crt2.o
- mkdir -p .cargo
- |
echo '[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"' >> .cargo/config
- cargo build --target x86_64-pc-windows-gnu --release --no-default-features --features default_devkit
- mkdir -p build
- mv target/x86_64-pc-windows-gnu/release/lucky.exe build
- cd build/
- zip -r lucky-windows-x86_64.zip lucky.exe
# Publish pre-release to GitHub releases
- name: publish-pre-release
image: plugins/github-release
depends_on:
- build
settings:
title: pre-release
api_key:
from_secret: github_access_key
files:
- build/lucky-windows-x86_64.zip
when:
ref:
- refs/tags/pre-release
# Publish release to GitHub releases
- name: publish-release
image: plugins/github-release
depends_on:
- build
settings:
api_key:
from_secret: github_access_key
files:
- build/lucky-windows-x86_64.zip
when:
ref:
- refs/tags/v*
trigger:
branch:
exclude:
- feature/*
---
kind: pipeline
name: macos-build
steps:
- name: build
image: katharostech/rust-osxcross:rust-latest_v0.1.0
commands:
# Set Lucky version for build
- |
if [ "${DRONE_TAG}" != "" ]; then
export LUCKY_VERSION=${DRONE_TAG}
else
export LUCKY_VERSION=pre-release-$$(echo ${DRONE_COMMIT} | awk '{print substr($$0, 0, 8)}')
fi
- PATH="$PATH:/build/osxcross/target/bin"
# Configure build to use Mac linker and libraries
- mkdir -p /drone/src/.cargo
- |
echo '[target.x86_64-apple-darwin]
linker = "x86_64-apple-darwin15-clang"' >> /drone/src/.cargo/config
- cd /drone/src
- export COREAUDIO_FRAMEWORKS_PATH='/System/Library/Frameworks'
- export CC=x86_64-apple-darwin15-clang
- cargo build --target x86_64-apple-darwin --release --no-default-features --features default_devkit
- mkdir -p build
- mv target/x86_64-apple-darwin/release/lucky build
- cd build/
- tar -czf lucky-mac-x86_64.tgz lucky
- sha256sum lucky-mac-x86_64.tgz | awk -F ' ' '{print $1}' > sha256.txt
# Publish pre-release to GitHub releases
- name: publish-pre-release
image: plugins/github-release
depends_on:
- build
settings:
title: pre-release
api_key:
from_secret: github_access_key
files:
- build/lucky-mac-x86_64.tgz
when:
ref:
- refs/tags/pre-release
# Update the Homebrew cask
- name: publish-pre-release-cask
image: alpine/git
depends_on:
- publish-pre-release
environment:
USER:
from_secret: github_username
PASSWORD:
from_secret: github_access_key
commands:
- git config --global user.email "zicklag@katharostech.com"
- git config --global user.name "Zicklag"
- git clone https://$${USER}:$${PASSWORD}@github.com/katharostech/homebrew-tap.git
- sed -i "/\w*sha256/s/\'[a-z0-9]*\'/\'$(cat build/sha256.txt)\'/" homebrew-tap/Casks/lucky-pre-release.rb
- cd homebrew-tap
- git add .
- git commit -m 'Update Lucky Pre-Release'
- git push
when:
ref:
- refs/tags/pre-release
# Publish release to GitHub releases
- name: publish-release
image: plugins/github-release
depends_on:
- build
settings:
api_key:
from_secret: github_access_key
files:
- build/lucky-mac-x86_64.tgz
when:
ref:
- refs/tags/v*
trigger:
branch:
exclude:
- feature/*