forked from wearerequired/lint-action
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (133 loc) · 4.11 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
name: Test
on:
push:
branches:
- master
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
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@v2
# Go
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.13
- name: Install Go dependencies
run: |
cd ./test/linters/projects/golint
go get -u golang.org/x/lint/golint
# Node.js
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 12
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Set up yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('./test/linters/projects/**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- 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 ../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/[email protected]
with:
python-version: 3.8
- name: Get pip cache directory path
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Set up pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('./test/linters/projects/**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
cd ./test/linters/projects/
pip install -r ./black/requirements.txt -r ./flake8/requirements.txt -r ./mypy/requirements.txt
# Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
bundler: 2
- name: Set up bundle cache
uses: actions/cache@v2
with:
path: ./test/linters/projects/**/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('./test/linters/projects/**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install Ruby dependencies
run: |
cd ./test/linters/projects/rubocop/
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
# Swift (only on Linux)
- name: Install Swift dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
git clone --branch 0.50300.0 --depth 1 git://github.com/apple/swift-format
cd swift-format
swift build -c release
echo "${PWD}/.build/release" >> $GITHUB_PATH
# Swift (only on macOS)
- name: Set up mint cache
if: startsWith(matrix.os, 'macos')
uses: actions/cache@v2
with:
path: /usr/local/lib/mint
key: ${{ runner.os }}-mint-${{ hashFiles('./test/linters/projects/**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-
- name: Install Swift dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
brew update >/dev/null
brew install mint
cd ./test/linters/projects/swift-format-lockwood/
mint bootstrap --link --overwrite=y
cd ../swiftlint/
mint bootstrap --link --overwrite=y
# Tests
- name: Run tests
run: |
yarn
yarn test