This repository was archived by the owner on Aug 6, 2020. It is now read-only.
forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (150 loc) · 5.39 KB
/
tests.yml
File metadata and controls
174 lines (150 loc) · 5.39 KB
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
name: GitHub Actions CI
on:
push:
branches: master
pull_request: []
jobs:
tap_syntax:
if: github.repository == 'Homebrew/homebrew-core'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- name: Set up Homebrew
id: set-up-homebrew
run: |
if which brew &>/dev/null; then
HOMEBREW_PREFIX="$(brew --prefix)"
HOMEBREW_REPOSITORY="$HOMEBREW_PREFIX/Homebrew"
brew update-reset "$HOMEBREW_REPOSITORY"
HOMEBREW_CORE_REPOSITORY="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core"
git -C "$HOMEBREW_CORE_REPOSITORY" remote set-url origin "https://github.com/$GITHUB_REPOSITORY"
else
HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY="$HOMEBREW_PREFIX/Homebrew"
sudo mkdir -p "$HOMEBREW_PREFIX"
sudo git clone --depth=1 https://github.com/Homebrew/brew "$HOMEBREW_REPOSITORY"
HOMEBREW_CORE_REPOSITORY="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core"
sudo mkdir -p "$HOMEBREW_CORE_REPOSITORY"
git -C "$HOMEBREW_CORE_REPOSITORY" init
git -C "$HOMEBREW_CORE_REPOSITORY" remote add origin "https://github.com/$GITHUB_REPOSITORY"
cd "$HOMEBREW_PREFIX"
sudo mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar
sudo ln -sf ../Homebrew/bin/brew "$HOMEBREW_PREFIX/bin/"
cd -
fi
export PATH="$HOMEBREW_PREFIX/bin:$PATH"
echo "::add-path::$HOMEBREW_PREFIX/bin"
GEMS_PATH="$HOMEBREW_REPOSITORY/Library/Homebrew/vendor/bundle/ruby/"
echo "::set-output name=gems-path::$GEMS_PATH"
GEMS_HASH=$(shasum -a 256 "$HOMEBREW_REPOSITORY/Library/Homebrew/Gemfile.lock" | cut -f1 -d' ')
echo "::set-output name=gems-hash::$GEMS_HASH"
cd "$HOMEBREW_CORE_REPOSITORY"
rm -rf "$GITHUB_WORKSPACE"
ln -s "$HOMEBREW_CORE_REPOSITORY" "$GITHUB_WORKSPACE"
git fetch origin "${{github.sha}}"
git checkout --force -B master FETCH_HEAD
cd -
if [ "$RUNNER_OS" = "Linux" ]; then
sudo chown -R "$USER" "$HOMEBREW_PREFIX"
sudo chmod -R g-w,o-w "$HOMEBREW_CORE_REPOSITORY"
fi
- name: Set up Ruby
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-ruby@master
with:
ruby-version: '2.6'
- name: Cache Bundler RubyGems
id: cache
uses: actions/cache@v1
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-
- name: Install Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems
- name: Install taps
run: |
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap homebrew/test-bot
- name: Run brew test-bot --only-tap-syntax
run: brew test-bot --only-tap-syntax
tests:
needs: tap_syntax
if: github.event_name == 'pull_request'
strategy:
matrix:
version: [10.15, 10.14, 10.13]
fail-fast: false
runs-on: ${{ matrix.version }}
timeout-minutes: 4320
env:
HOMEBREW_GIT_NAME: BrewTestBot
HOMEBREW_GIT_EMAIL: 'homebrew-test-bot@lists.sfconservancy.org'
PATH: '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED: 1
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- name: Update Homebrew
run: brew update-reset
- name: Set up Git repository
run: |
cd $(brew --repo ${{github.repository}})
git clean -ffdx
git fetch --prune --force origin master
git fetch --prune --force origin ${{github.sha}}
git checkout --force ${{github.sha}}
git log -1
- name: Run brew test-bot --only-cleanup-before
run: brew test-bot --only-cleanup-before
- name: Run brew test-bot --only-setup
run: brew test-bot --only-setup
- name: Run brew test-bot --only-formulae
run: |
rm -rf bottles
mkdir bottles
cd bottles
brew test-bot --only-formulae
- name: Output brew test-bot --only-formulae failures
if: always()
run: |
cat bottles/steps_output.txt
rm bottles/steps_output.txt
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs (${{ matrix.version }})
path: bottles/logs
- name: Delete logs and home
if: always()
run: |
rm -rf bottles/logs
rm -rf bottles/home
- name: Count bottles
id: bottles
if: always()
run: |
cd bottles
count=$(ls *.json | wc -l | xargs echo -n)
echo "$count bottles"
echo "::set-output name=count::$count"
- name: Upload bottles
if: always() && steps.bottles.outputs.count > 0
uses: actions/upload-artifact@v2
with:
name: bottles
path: bottles
- name: Run brew test-bot --only-cleanup-after
if: always()
run: brew test-bot --only-cleanup-after
- name: Cleanup
if: always()
run: |
find .
rm -rf *