-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
config.yml
725 lines (679 loc) · 21.3 KB
/
config.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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
defaults:
environment: &env
TRAVIS_BRANCH: $CIRCLE_BRANCH
TRAVIS_PULL_REQUEST: $CI_PULL_REQUEST || "false"
steps: &ci_steps
- checkout
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci build
- run:
when: always
command: |
mkdir -p ~/test-results/spec
cp .junit/*.xml ~/test-results/spec/
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/spec
version: 2
jobs:
test_linux:
machine: true
environment:
<<: *env
TRAVIS_OS_NAME: linux
ARCH: x86_64
ARCH_CMD: linux64
steps:
- checkout
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci build
- run:
when: always
command: |
mkdir -p ~/test-results/spec
cp .junit/*.xml ~/test-results/spec/
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/spec
- persist_to_workspace:
root: .
paths:
- docs
test_linux32_std:
machine: true
environment:
<<: *env
TRAVIS_OS_NAME: linux
ARCH: i386
ARCH_CMD: linux32
steps:
- checkout
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci with_build_env 'make std_spec threads=1 junit_output=.junit/std_spec.xml'
- run:
when: always
command: |
mkdir -p ~/test-results/spec
cp .junit/*.xml ~/test-results/spec/
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/spec
test_alpine:
machine: true
environment:
<<: *env
TRAVIS_OS_NAME: linux
ARCH: x86_64-musl
ARCH_CMD: linux64
steps: *ci_steps
test_darwin:
macos:
xcode: 12.4.0
environment:
<<: *env
TRAVIS_OS_NAME: osx
LLVM_CONFIG: /usr/local/opt/llvm/bin/llvm-config
steps:
- restore_cache:
keys:
- brew-cache-v1
- checkout
- run: bin/ci prepare_system
- run: echo 'export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/[email protected]/lib/pkgconfig"' >> $BASH_ENV
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci build
- run:
when: always
command: |
mkdir -p ~/test-results/spec
cp .junit/*.xml ~/test-results/spec/
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/spec
- save_cache:
key: brew-cache-v1
paths:
- /usr/local/Homebrew
- ~/Library/Caches/Homebrew/downloads
test_preview_mt:
machine: true
environment:
<<: *env
TRAVIS_OS_NAME: linux
ARCH: x86_64
ARCH_CMD: linux64
steps:
- checkout
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci with_build_env 'make crystal'
- run: bin/ci with_build_env 'CRYSTAL_WORKERS=4 make std_spec threads=1 FLAGS="-D preview_mt" junit_output=.junit/std_spec.xml'
- run:
when: always
command: |
mkdir -p ~/test-results/spec
cp .junit/*.xml ~/test-results/spec/
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/spec
prepare_common:
docker:
- image: docker:stable-git
steps:
# checkout specific distribution-scripts version to perform releases and nightly
- run: |
git clone https://github.com/crystal-lang/distribution-scripts.git ~/distribution-scripts
cd ~/distribution-scripts
git checkout 0c1b679583360ca1e16f6082d07ec1a8d1112016
# persist relevant information for build process
- run: |
cd ~/distribution-scripts
touch build.env
echo "export DOCKER_REPOSITORY=crystallang/crystal" >> build.env
# What to build
echo "export CRYSTAL_SHA1=$CIRCLE_SHA1" >> build.env
# Which previous version use
export PREVIOUS_CRYSTAL_BASE_URL="https://github.com/crystal-lang/crystal/releases/download/1.1.1/crystal-1.1.1-1"
echo "export PREVIOUS_CRYSTAL_RELEASE_LINUX64_TARGZ=${PREVIOUS_CRYSTAL_BASE_URL}-linux-x86_64.tar.gz" >> build.env
echo "export PREVIOUS_CRYSTAL_RELEASE_LINUX32_TARGZ=${PREVIOUS_CRYSTAL_BASE_URL}-linux-i686.tar.gz" >> build.env
echo "export PREVIOUS_CRYSTAL_RELEASE_DARWIN_TARGZ=${PREVIOUS_CRYSTAL_BASE_URL}-darwin-x86_64.tar.gz" >> build.env
cat build.env
- persist_to_workspace:
root: ../
paths:
- distribution-scripts
# prepare build for tagged releases
prepare_tagged:
docker:
- image: docker:stable-git
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
# How to brand it
echo "export CRYSTAL_VERSION=$CIRCLE_TAG" >> build.env
echo "export DOCKER_TAG=$CIRCLE_TAG" >> build.env
# Snapcraft configuration
echo "export SNAP_GRADE=stable" >> build.env
echo "export SNAP_CHANNEL=edge" >> build.env
cat build.env
- persist_to_workspace:
root: /tmp/workspace
paths:
- distribution-scripts
# prepare build for nightly releases
prepare_nightly:
docker:
- image: docker:stable-git
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run: |
# We need CRYSTAL_VERSION in prepare_nightly to use src/VERSION so we publish them as x.y.z-dev in apt/rpm
#
# How to brand it
echo "export CRYSTAL_VERSION=$(cat src/VERSION)" >> /tmp/workspace/distribution-scripts/build.env
#
# TODO: We might want to do that on docker images also to support updates on multiple development versions the same date.
- run: |
cd /tmp/workspace/distribution-scripts
echo "export DOCKER_TAG=nightly" >> build.env
# Build from working directory (needed for omnibus and when version does not match branch/tag)
echo "export FORCE_GIT_TAGGED=0" >> build.env
# Snapcraft configuration
echo "export SNAP_GRADE=devel" >> build.env
echo "export SNAP_CHANNEL=edge" >> build.env
cat build.env
- persist_to_workspace:
root: /tmp/workspace
paths:
- distribution-scripts
# prepare build for manual triggered releases like ci branches, maintenance releases, etc.
prepare_maintenance:
docker:
- image: docker:stable-git
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
# How to brand it
export VERSION=${CIRCLE_BRANCH/release\//}
export VERSION=${VERSION//\//-}-dev
echo "export CRYSTAL_VERSION=$VERSION" >> build.env
echo "export DOCKER_TAG=$VERSION" >> build.env
# Build from working directory (needed for omnibus and when version does not match branch/tag)
echo "export FORCE_GIT_TAGGED=0" >> build.env
# Snapcraft configuration
echo "export SNAP_GRADE=devel" >> build.env
echo "export SNAP_CHANNEL=edge/$VERSION" >> build.env
cat build.env
- persist_to_workspace:
root: /tmp/workspace
paths:
- distribution-scripts
dist_linux:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
no_output_timeout: 20m
command: |
cd /tmp/workspace/distribution-scripts
source build.env
cd linux
make all64 release=true
- store_artifacts:
path: /tmp/workspace/distribution-scripts/linux/build
destination: build
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/linux/
paths:
- build
dist_linux32:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
no_output_timeout: 20m
command: |
cd /tmp/workspace/distribution-scripts
source build.env
cd linux
make all32 release=true
- store_artifacts:
path: /tmp/workspace/distribution-scripts/linux/build
destination: build
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/linux/
paths:
- build
dist_darwin:
macos:
xcode: 12.4.0
shell: /bin/bash --login -eo pipefail
steps:
- restore_cache:
keys:
- brew-cache-v1
- run:
name: Setup environment
command: |
brew unlink python@2 || true
# We need ruby-install >= 0.8.3
brew install ruby-install
ruby-install ruby 2.7.3
brew install pkgconfig libtool
sudo mkdir -p /opt/crystal
sudo chown $(whoami) /opt/crystal/
sudo mkdir -p /var/cache
sudo chown $(whoami) /var/cache
- attach_workspace:
at: /tmp/workspace
- run:
no_output_timeout: 40m
command: |
echo "2.7.3" > /tmp/workspace/distribution-scripts/.ruby-version
cd /tmp/workspace/distribution-scripts
source build.env
cd omnibus
ruby --version
gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
bundle check || bundle install --binstubs
cd ../darwin
make
- store_artifacts:
path: /tmp/workspace/distribution-scripts/darwin/build
destination: build
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/darwin/
paths:
- build
push_obs_nightly:
docker:
- image: crystallang/osc
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command: |
cd /tmp/workspace/distribution-scripts
source build.env
packages/obs-setup.sh
packages/obs-push.sh devel:languages:crystal:nightly ${CRYSTAL_VERSION%-*} $(date '+%Y%m%d') $CRYSTAL_SHA1 \
/tmp/workspace/build/crystal-*-linux-x86_64.tar.gz \
/tmp/workspace/build/crystal-*-linux-i686.tar.gz \
/tmp/workspace/build/crystal-*-docs.tar.gz
dist_docker:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
source build.env
cd docker
make all64 CRYSTAL_DEB=/tmp/workspace/build/crystal_${CRYSTAL_VERSION}-1_amd64.deb CRYSTAL_TARGZ=/tmp/workspace/build/crystal-$CRYSTAL_VERSION-1-linux-x86_64.tar.gz
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/docker/
paths:
- build
dist_docker32:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
source build.env
cd docker
make all32 CRYSTAL_DEB=/tmp/workspace/build/crystal_${CRYSTAL_VERSION}-1_i386.deb
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/docker/
paths:
- build
publish_docker:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
source ./build.env
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-ubuntu-x86_64.tar.gz | docker image load
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-ubuntu-x86_64-build.tar.gz | docker image load
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-alpine.tar.gz | docker image load
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-alpine-build.tar.gz | docker image load
docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
docker push ${DOCKER_REPOSITORY}:${DOCKER_TAG}
docker push ${DOCKER_REPOSITORY}:${DOCKER_TAG}-build
docker push ${DOCKER_REPOSITORY}:${DOCKER_TAG}-alpine
docker push ${DOCKER_REPOSITORY}:${DOCKER_TAG}-alpine-build
dist_snap:
docker:
- image: cibuilds/snapcraft:stable
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command: |
apt-get install -y make
cd /tmp/workspace/distribution-scripts
source build.env
cd snapcraft
CRYSTAL_RELEASE_LINUX64_TARGZ=/tmp/workspace/build/crystal-$CRYSTAL_VERSION-1-linux-x86_64.tar.gz make
- store_artifacts:
path: /tmp/workspace/distribution-scripts/snapcraft/build
destination: build
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/snapcraft/
paths:
- build
publish_snap:
docker:
- image: cibuilds/snapcraft:stable
steps:
- attach_workspace:
at: /tmp/workspace
- run:
# $SNAPCRAFT_TOKEN is generated using `snapcraft export-login --snaps crystal --channels edge,edge/* -`
command: |
cd /tmp/workspace/distribution-scripts
source build.env
echo $SNAPCRAFT_TOKEN | snapcraft login --with -
snapcraft push /tmp/workspace/build/*.snap --release=$SNAP_CHANNEL
dist_docs:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
source build.env
cd docs
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-ubuntu-x86_64-build.tar.gz | docker image load
make CRYSTAL_DOCKER_IMAGE=${DOCKER_REPOSITORY}:${DOCKER_TAG}-build
- store_artifacts:
path: /tmp/workspace/distribution-scripts/docs/build
destination: build
- persist_to_workspace:
root: /tmp/workspace/distribution-scripts/docs/
paths:
- build
dist_artifacts:
docker:
- image: buildpack-deps:xenial
steps:
- attach_workspace:
at: /tmp/workspace
- store_artifacts:
path: /tmp/workspace/build
destination: dist_packages
test_dist_linux_on_docker:
machine: true
environment:
<<: *env
TRAVIS_OS_NAME: linux
ARCH: x86_64
ARCH_CMD: linux64
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
source ./build.env
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-ubuntu-x86_64.tar.gz | docker image load
export DOCKER_TEST_PREFIX="crystallang/crystal:$DOCKER_TAG" >> $BASH_ENV
- checkout
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci build
test_dist_linux32_std_on_docker:
machine: true
environment:
<<: *env
TRAVIS_OS_NAME: linux
ARCH: i386
ARCH_CMD: linux32
steps:
- attach_workspace:
at: /tmp/workspace
- run: |
cd /tmp/workspace/distribution-scripts
source ./build.env
gunzip -c /tmp/workspace/build/docker-${CRYSTAL_VERSION}-ubuntu-i386.tar.gz | docker image load
export DOCKER_TEST_PREFIX="crystallang/crystal:$DOCKER_TAG-i386" >> $BASH_ENV
- checkout
- run: bin/ci prepare_system
- run: echo 'export CURRENT_TAG="$CIRCLE_TAG"' >> $BASH_ENV
- run: bin/ci prepare_build
- run: bin/ci with_build_env 'make std_spec threads=1'
workflows:
version: 2
tagged_release:
jobs:
- test_linux:
filters: &per_tag
branches:
ignore: /.*/
tags:
only: /.*/
- test_linux32_std:
filters: *per_tag
- test_alpine:
filters: *per_tag
# - test_darwin: # See https://github.com/crystal-lang/crystal/pull/9763
# filters: *per_tag
- test_preview_mt:
filters: *per_tag
- prepare_common:
filters: *per_tag
- prepare_tagged:
filters: *per_tag
requires:
- prepare_common
- dist_linux:
filters: *per_tag
requires:
- prepare_tagged
- dist_linux32:
filters: *per_tag
requires:
- prepare_tagged
- dist_darwin:
filters: *per_tag
requires:
- prepare_tagged
- dist_docker:
filters: *per_tag
requires:
- dist_linux
- dist_docker32:
filters: *per_tag
requires:
- dist_linux32
- dist_snap:
filters: *per_tag
requires:
- dist_linux
- publish_snap:
filters: *per_tag
requires:
- dist_snap
- test_dist_linux_on_docker:
filters: *per_tag
requires:
- dist_docker
- test_dist_linux32_std_on_docker:
filters: *per_tag
requires:
- dist_docker32
# Tagged release do not publish docker images since they are unsigned
# publish_docker:
- dist_docs:
filters: *per_tag
requires:
- dist_docker
- dist_artifacts:
filters: *per_tag
requires:
- dist_linux
- dist_linux32
- dist_darwin
- dist_snap
- dist_docs
nightly_release:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- test_linux
- test_linux32_std
- test_alpine
# - test_darwin # See https://github.com/crystal-lang/crystal/pull/9763
- test_preview_mt
- prepare_common
- prepare_nightly:
requires:
- prepare_common
- dist_linux:
requires:
- prepare_nightly
- dist_linux32:
requires:
- prepare_nightly
- dist_darwin:
requires:
- prepare_nightly
- push_obs_nightly:
requires:
- dist_linux
- dist_linux32
- dist_docs
- dist_docker:
requires:
- dist_linux
- dist_docker32:
requires:
- dist_linux32
- dist_snap:
requires:
- dist_linux
- publish_snap:
requires:
- dist_snap
- test_dist_linux_on_docker:
requires:
- dist_docker
- test_dist_linux32_std_on_docker:
requires:
- dist_docker32
- publish_docker:
requires:
- dist_docker
- dist_docs:
requires:
- dist_docker
- dist_artifacts:
requires:
- dist_linux
- dist_linux32
- dist_darwin
- dist_snap
- dist_docs
maintenance_release:
jobs:
- test_linux:
filters: &maintenance
branches:
only:
- /release\/.+/
- /.*\bci\b.*/
- test_linux32_std:
filters: *maintenance
- test_alpine:
filters: *maintenance
# - test_darwin: # See https://github.com/crystal-lang/crystal/pull/9763
# filters: *maintenance
- test_preview_mt:
filters: *maintenance
- prepare_common:
filters: *maintenance
- prepare_maintenance:
filters: *maintenance
requires:
- prepare_common
- dist_linux:
filters: *maintenance
requires:
- prepare_maintenance
- dist_linux32:
filters: *maintenance
requires:
- prepare_maintenance
- dist_darwin:
filters: *maintenance
requires:
- prepare_maintenance
- dist_docker:
filters: *maintenance
requires:
- dist_linux
- dist_docker32:
filters: *maintenance
requires:
- dist_linux32
- dist_snap:
filters: *maintenance
requires:
- dist_linux
- publish_snap:
filters: *maintenance
requires:
- dist_snap
- test_dist_linux_on_docker:
filters: *maintenance
requires:
- dist_docker
- test_dist_linux32_std_on_docker:
filters: *maintenance
requires:
- dist_docker32
- publish_docker:
filters: *maintenance
requires:
- dist_docker
- dist_docs:
filters: *maintenance
requires:
- dist_docker
- dist_artifacts:
filters: *maintenance
requires:
- dist_linux
- dist_linux32
- dist_darwin
- dist_snap
- dist_docs