forked from mxcl/swift-sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
92 lines (75 loc) · 2.89 KB
/
.travis.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
# only run for: merge commits, releases and pull-requests
if: type != push OR branch = master OR branch =~ /^\d+\.\d+(\.\d+)?(-\S*)?$/
os: osx
language: swift
osx_image: xcode10.2
stages:
- name: pretest
- name: test
- name: deploy
if: branch =~ ^\d+\.\d+\.\d+$
jobs:
include:
- stage: pretest
name: Check Linux tests are sync’d
install: swift test --generate-linuxmain
script: git diff --exit-code
- name: macOS / Swift 4.2.1 (Xcode 10.1)
osx_image: xcode10.1
stage: test
script: swift test
- name: macOS / Swift 5.0.1 (Xcode 10.2)
script: swift test
- name: macOS / Swift 5.1.0 (Xcode 11)
osx_image: xcode11
script: swift test
- &linux
name: Linux / Swift 4.2.3
env: SWIFT_VERSION=4.2.3
install: eval "$(curl -sL https://swiftenv.fuller.li/install.sh)"
os: linux
osx_image: null
language: generic
script: swift test
- <<: *linux
name: Linux / Swift 5.0.2
env: SWIFT_VERSION=5.0.2
- <<: *linux
name: Linux / Swift 5.1.3
env: SWIFT_VERSION=5.1.3
- stage: deploy
osx_image: xcode11
env:
- HOMEBREW_NO_AUTO_UPDATE=1
- HOMEBREW_NO_INSTALL_CLEANUP=1
script: |
brew tap mxcl/homebrew-made
cd /usr/local/Homebrew/Library/Taps/mxcl/homebrew-made
# update our formula to new tag
URL="https://github.com/mxcl/swift-sh/archive/$TRAVIS_TAG.tar.gz"
sed -E -i '' 's~^ url ".+"~ url "'$URL\"~ ./swift-sh.rb
brew fetch swift-sh || true
# ^^ fails because SHA is wrong, hence || true
SHA256=$(shasum --algorithm 256 $(brew --cache --build-from-source swift-sh) | awk '{print $1}')
sed -E -i '' 's/^ sha256 ".+"/ sha256 "'$SHA256\"/ ./swift-sh.rb
# update bottle
MIDDLE=$TRAVIS_TAG.mojave.bottle
SUFFIX=$MIDDLE.tar.gz
brew install --build-bottle ./swift-sh.rb
brew bottle --json --root-url=https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG ./swift-sh.rb
brew bottle --merge swift-sh--$MIDDLE.json --write --no-commit
git remote set-url origin "https://[email protected]/mxcl/homebrew-made.git"
git add swift-sh.rb
git config user.name "Travis"
git config user.email "[email protected]"
git commit -m "swift-sh $TRAVIS_TAG"
git push origin master
curl -O https://raw.githubusercontent.com/mxcl/ops/master/deploy
chmod u+x deploy
RELEASE_ID=$(./deploy publish-release)
# upload bottle
curl --data-binary @"swift-sh--$SUFFIX" \
"https://uploads.github.com/repos/$TRAVIS_REPO_SLUG/releases/$RELEASE_ID/assets?name=swift-sh-$SUFFIX" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream"
after_script: sleep 1