forked from wearerequired/lint-action
-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (154 loc) · 5.12 KB
/
test.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
name: Test
on:
push:
branches:
- master
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v3
# ClangFormat
- name: Install ClangFormat (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install -y clang-format
- name: Install ClangFormat (macOS)
if: startsWith(matrix.os, 'macos')
run: brew install clang-format
# Go
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.4
- name: Install Go dependencies
run: |
cd ./test/linters/projects/golint
go install golang.org/x/lint/golint@latest
# Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "yarn"
cache-dependency-path: |
yarn.lock
test/linters/projects/**/yarn.lock
.github/workflows/test.yml
- name: Install Node.js dependencies
run: |
cd ./test/linters/projects/eslint/
yarn install
cd ../eslint-typescript/
yarn install
cd ../prettier/
yarn install
cd ../stylelint/
yarn install
cd ../tsc/
yarn install
cd ../xo/
yarn install
# PHP
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
coverage: none
tools: phpcs
# Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: |
test/linters/projects/**/requirements.txt
.github/workflows/test.yml
- name: Install Python dependencies
run: |
cd ./test/linters/projects/
pip install -r ./autopep8/requirements.txt -r ./black/requirements.txt -r ./flake8/requirements.txt -r ./mypy/requirements.txt -r ./oitnb/requirements.txt -r ./pylint/requirements.txt
# Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.7
bundler: 2
- name: Set up bundle cache
uses: actions/cache@v3
with:
path: ./test/linters/projects/**/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('./test/linters/projects/**/Gemfile.lock', '.github/workflows/test.yml') }}
- name: Install Ruby dependencies (Rubocop)
run: |
cd ./test/linters/projects/rubocop/
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Install Ruby dependencies (ERB Lint)
run: |
cd ./test/linters/projects/erblint/
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
# Swift (only on Linux)
- name: Set up Swift cache (Linux)
id: cache-swift
if: startsWith(matrix.os, 'ubuntu')
uses: actions/cache@v3
with:
path: ./swift-format/.build
key: ${{ runner.os }}-swift-0.50500.0
- name: Install Swift dependencies (Linux, uncached)
if: steps.cache-swift.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu')
run: |
git clone --branch 0.50500.0 --depth 1 https://github.com/apple/swift-format
cd swift-format
swift build -c release
echo "${PWD}/.build/release" >> $GITHUB_PATH
- name: Install Swift dependencies (Linux, cached)
if: steps.cache-swift.outputs.cache-hit == 'true' && startsWith(matrix.os, 'ubuntu')
run: |
echo "${PWD}/swift-format/.build/release" >> $GITHUB_PATH
# Swift (only on macOS)
- name: Set up Mint cache (macOS)
if: startsWith(matrix.os, 'macos')
uses: actions/cache@v3
with:
path: ~/.mint
key: ${{ runner.os }}-mint-${{ hashFiles('./test/linters/projects/**/Mintfile', '.github/workflows/test.yml') }}
- name: Install Swift dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_AUTO_UPDATE=1
brew install mint
cd ./test/linters/projects/swift-format-lockwood/
mint bootstrap --link --overwrite=y
cd ../swiftlint/
mint bootstrap --link --overwrite=y
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: "6.0.x"
# Tests
- name: Install test dependencies
run: yarn install
- name: Run tests
run: yarn test