166 lines (142 loc) 路 5.04 KB
/
tests.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
name: GitHub Actions CI
on:
push:
branches: master
pull_request: []
release:
types:
- published
jobs:
tests:
if: github.repository == 'Homebrew/brew'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- name: Set up Homebrew PATH
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
echo "::add-path::/home/linuxbrew/.linuxbrew/bin"
else
echo "::add-path::/usr/local/bin"
fi
- name: Set up Homebrew
run: |
cd $(brew --repo)
rm -rf $GITHUB_WORKSPACE
ln -s $PWD $GITHUB_WORKSPACE
git fetch --tags origin ${{github.sha}}
git checkout --force -B master FETCH_HEAD
brew update-reset Library/Taps/homebrew/homebrew-core
if [ "$RUNNER_OS" = "Linux" ]; then
sudo chown -R "$USER" $(brew --prefix)
fi
- name: Set up Ruby
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Run brew config
run: brew config
- name: Run brew doctor
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
# Cleanup some Linux `brew doctor` failures
sudo rm -rf /usr/local/include/node/
else
# Allow Xcode to be outdated
export HOMEBREW_GITHUB_ACTIONS=1
fi
brew doctor
- name: Install Bundler RubyGems
run: |
brew install-bundler-gems
# Check for uncommitted gems
git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby
if [ "$RUNNER_OS" = "Linux" ]; then
# Fix permissions for 'brew tests'
sudo chmod -R g-w,o-w /home/linuxbrew /home/runner /opt
fi
- name: Install taps
run: |
# Install taps needed for 'brew tests' and 'brew man'
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap homebrew/bundle
brew tap homebrew/services
if [ "$RUNNER_OS" = "macOS" ]; then
brew tap homebrew/cask
fi
- name: Run brew style
run: brew style --display-cop-names
- name: Run brew man
run: brew man --fail-if-changed
- name: Run brew tests
run: |
# brew tests doesn't like world writable directories
umask 022
# set variables for coverage reporting
export HOMEBREW_CI_BUILD_NUMBER="$GITHUB_REF"
export HOMEBREW_CI_BRANCH="$HEAD_GITHUB_REF"
export HOMEBREW_GITHUB_REPOSITORY="$GITHUB_REPOSITORY"
# don't bother running all tests on both platforms (for speed)
if [ "$RUNNER_OS" = "Linux" ]; then
brew tests --no-compat --online
brew tests --generic --online
brew tests --online
else
brew tests --online --coverage
fi
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# set variables for coverage reporting
HOMEBREW_GITHUB_ACTIONS: 1
HOMEBREW_CI_NAME: github-actions
HOMEBREW_COVERALLS_REPO_TOKEN: 3F6U6ZqctoNJwKyREremsqMgpU3qYgxFk
# These cannot be queried at the macOS level on GitHub Actions.
HOMEBREW_LANGUAGES: en-GB
- name: Run brew update-tests
run: |
git config --global user.name "BrewTestBot"
git config --global user.email "homebrew-test-bot@lists.sfconservancy.org"
brew update-test
brew update-test --to-tag
brew update-test --commit=HEAD
if: github.event_name == 'pull_request'
- name: Run brew readall on all taps
run: brew readall --aliases
- name: Run brew style on homebrew-core
if: matrix.os == 'macOS-latest'
run: brew style --display-cop-names homebrew/core
- name: Run brew style on official taps
run: brew style --display-cop-names homebrew/bundle homebrew/services homebrew/test-bot
- name: Run vale for docs linting
run: |
brew install vale
vale docs/
- name: Build Docker image
if: matrix.os == 'ubuntu-latest'
run: |
docker pull homebrew/brew
docker-compose -f Dockerfile.yml build sut
- name: Run brew test-bot
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut
docker tag homebrew_sut brew
else
brew test-bot
fi
- name: Deploy the latest Docker image
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master'
run: |
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
docker tag brew docker.pkg.github.com/homebrew/brew/brew
docker push docker.pkg.github.com/homebrew/brew/brew
- name: Deploy the tagged Docker image
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
run: |
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
v=${GITHUB_REF:10}
docker tag brew "docker.pkg.github.com/homebrew/brew/brew:$v"
docker push "docker.pkg.github.com/homebrew/brew/brew:$v"