forked from py2many/py2many
-
Notifications
You must be signed in to change notification settings - Fork 2
260 lines (227 loc) · 8.29 KB
/
main.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Can be blank, or one of: cpp, dart, go, julia, kotlin, nim, smt, vlang
FOCUS: ''
jobs:
build:
strategy:
matrix:
python-version: [ '3.9' ]
os:
- ubuntu-22.04
- macos-12
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
if: ${{ matrix.os != 'macos-12' && (!env.FOCUS || env.FOCUS == 'kotlin') }}
with:
distribution: adopt
java-version: 15
- name: Add missing dependencies on act Medium runner
if: ${{ env.ACT }}
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
cargo \
clang-format \
powershell \
rustfmt \
z3 \
&& true
echo "${HOME}/.cargo/bin/" >> $GITHUB_PATH
- uses: subosito/flutter-action@v1
if: ${{ !env.FOCUS || env.FOCUS == 'dart' }}
with:
flutter-version: '2.10.5'
- uses: julia-actions/setup-julia@v1
if: ${{ !env.FOCUS || env.FOCUS == 'julia' }}
- uses: fwilhe2/setup-kotlin@main
if: ${{ matrix.os != 'macos-12' && (!env.FOCUS || env.FOCUS == 'kotlin') }}
- uses: jiro4989/setup-nim-action@v1
if: ${{ !env.FOCUS || env.FOCUS == 'nim' }}
- uses: actions/setup-go@v2
if: ${{ !env.FOCUS || env.FOCUS == 'go' }}
# Needed as https://github.com/actions/setup-go/pull/89 is not merged
with:
go-version: '1.17'
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
- name: Install go packages
if: ${{ !env.FOCUS || env.FOCUS == 'go' }}
shell: bash
run: |
mkdir -p tests/build
cd tests/build
go mod init github.com/py2many/py2many/tests
go get -u github.com/electrious/refutil
go get -u github.com/hgfischer/go-iter
go get -u github.com/google/go-cmp/cmp
go get github.com/mgechev/revive
if [[ -d /usr/local/bin && ! -f /usr/local/bin/golint && -f $HOME/go/bin/golint ]]; then
(cd /usr/local/bin && sudo ln -fs $HOME/go/bin/golint)
fi
- name: Install tox
run: |
pip3 --version
pip3 install setuptools tox
- name: Install Julia packages
if: ${{ !env.FOCUS || env.FOCUS == 'julia' }}
shell: bash
run: |
julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
julia -e 'using Pkg; Pkg.add("SuperEnum")'
JULIA_FORMATTER_ROOT=$(julia -e 'import JuliaFormatter;print(dirname(dirname(pathof(JuliaFormatter))));')
echo "${JULIA_FORMATTER_ROOT}/bin/" >> $GITHUB_PATH
- name: Install dependencies for ${{ runner.os }}.
shell: bash
run: |
set -ex
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install --yes \
astyle \
catch2 \
clang-14 \
libc++-14-dev \
libc++abi-14-dev \
z3 \
&& true
pip3 install conan
echo "CXX=clang++-14" >> $GITHUB_ENV
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.48.2/ktlint
chmod a+x ktlint
sudo mv ktlint /usr/local/bin/
elif [ "$RUNNER_OS" == "macOS" ]; then
brew tap holgerbrandl/tap https://github.com/holgerbrandl/homebrew-tap
brew install \
astyle \
catch2 \
clang-format \
cljstyle \
conan \
kscript \
ktlint \
z3 \
&& true
# brew's vlang 0.2.4 is too old, and has no @head
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install \
astyle \
conan \
curl \
llvm \
zip \
&& true
echo "C:/Program Files/Conan/conan/" >> $GITHUB_PATH
fi
echo "WHICH_KSCRIPT=$(which kscript 2>/dev/null)" >> $GITHUB_ENV
echo "WHICH_V=$(which v 2>/dev/null)" >> $GITHUB_ENV
- name: Install C++ packages
if: ${{ !env.FOCUS || env.FOCUS == 'cpp' }}
shell: bash
run: |
conan download cppitertools/2.1@:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
conan download catch2/3.0.1@:a25d6c83542b56b72fdaa05a85db5d46f5f0f71c
- name: Install V
if: ${{ !env.WHICH_V && (!env.FOCUS || env.FOCUS == 'vlang') }}
uses: vlang/setup-v@v1
with:
token: ${{ github.token }}
- name: Install V packages
if: ${{ !env.FOCUS || env.FOCUS == 'vlang' }}
shell: bash
run: |
v install div72.vexc
- name: Install kscript (using sdkman)
if: ${{ !env.WHICH_KSCRIPT && matrix.os == 'ubuntu-22.04' && (!env.FOCUS || env.FOCUS == 'kotlin') }}
shell: bash
run: |
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install kscript
- name: Install dart dependencies
if: ${{ !env.FOCUS || env.FOCUS == 'dart' }}
shell: bash
run: |
dart --version
flutter --version
set -ex
# tests/build here must be the same as defined in test_cli
if [[ ! -f tests/build/pubspec.yaml ]]; then
dart create --no-pub --force -t package-simple tests/build
cat tests/build/pubspec.yaml
fi
cd tests/build
if ! grep collection pubspec.yaml ; then
# Specifying the version here doesnt stick
dart pub add collection:1.15.0
cat pubspec.yaml
dart pub add sprintf
dart pub add tuple
fi
if ! grep vnum pubspec.yaml ; then
cat pubspec.yaml
sed -i.bak '/test:/d' pubspec.yaml
# Force version downgrade here
sed -i.bak 's:1.16.0:1.15.0:' pubspec.yaml
flutter pub add vnum
fi
- name: Install cargo-eval
if: ${{ !env.FOCUS || env.FOCUS == 'rust' }}
uses: taiki-e/install-action@v2
with:
tool: cargo-eval
- name: Install smt dependencies
if: ${{ matrix.os == 'ubuntu-22.04' && (!env.FOCUS || env.FOCUS == 'smt') }}
shell: bash
run: |
if [ "$RUNNER_OS" != "Windows" ]; then
(curl -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/script/install-cljstyle
sed -i.bak 's/--overwrite//' install-cljstyle
chmod +x install-cljstyle
sudo ./install-cljstyle)
fi
- name: Run tox
shell: bash
# sdkman init can be replaced with actions setup when the following is fixed
# https://github.com/sdkman/sdkman-action/issues/8
run: |
if [ -f $HOME/.sdkman/bin/sdkman-init.sh ]; then
source "$HOME/.sdkman/bin/sdkman-init.sh"
fi
LINT=1
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$PATH:/C/Program Files/LLVM/bin:/tmp/v"
fi
if [ "$FOCUS" ]; then
tox -e py39 -- -k "$FOCUS"
else
tox -e py39
fi
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install linters
run: pip install black pyflakes cpplint
- name: Remove tests/cases/*.py & tests/expected/*.py
run: rm tests/cases/*.py tests/expected/*.py tests/dir_cases/test1-*-expected/*.py
- name: Run black
run: black --check */ *.py
- name: Run pyflakes
run: pyflakes */ *.py
- name: Run cpplint
run: cpplint --filter=-legal/copyright,-whitespace/semicolon,-runtime/reference tests/expected/*.cpp