-
Notifications
You must be signed in to change notification settings - Fork 472
166 lines (157 loc) · 4.33 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
name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
# C implementation. Lives in c/, tested with bazel.
test-c:
runs-on: ubuntu-latest
env:
OLC_PATH: c
steps:
- uses: actions/checkout@v2
- name: test
run: bazel test --test_output=all ${OLC_PATH}:all
- name: check formatting
run: cd ${OLC_PATH} && bash clang_check.sh
# C++ implementation. Lives in cpp/, tested with bazel.
test-cpp:
runs-on: ubuntu-latest
env:
OLC_PATH: cpp
steps:
- uses: actions/checkout@v2
- name: test
run: bazel test --test_output=all ${OLC_PATH}:all
- name: check formatting
run: cd ${OLC_PATH} && bash clang_check.sh
# Dart implementation. Lives in dart/.
test-dart:
runs-on: ubuntu-latest
env:
OLC_PATH: dart
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- name: test
run: |
cd ${OLC_PATH}
pub get && pub run test
bash checks.sh
# Go implementation. Lives in go/. Tests fail if files have not been formatted with gofmt.
test-go:
runs-on: ubuntu-latest
env:
OLC_PATH: go
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17
- name: test
run: |
cd ${OLC_PATH}
diff -u <(echo -n) <(gofmt -d -s ./)
go test -bench=. ./ -v
- name: test-gridserver
run: |
cd tile_server/gridserver
go test ./ -v
# Java implementation. Lives in java/, tested with bazel and maven.
test-java:
runs-on: ubuntu-latest
env:
OLC_PATH: java
strategy:
matrix:
java: [ '8', '11', '16', '17' ]
name: test-java-${{ matrix.java }}
steps:
- uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: test
run: bazel test --test_output=all ${OLC_PATH}:all && cd ${OLC_PATH} && mvn package
# Javascript Closure library implementation. Lives in js/closure, tested with bazel.
test-js-closure:
runs-on: ubuntu-latest
env:
OLC_PATH: js/closure
steps:
- uses: actions/checkout@v2
- name: test
run: |
bazel test ${OLC_PATH}:all
cd js && npm install && ./node_modules/.bin/eslint closure/*js
# Javascript implementation. Lives in js/.
test-js:
runs-on: ubuntu-latest
env:
OLC_PATH: js
steps:
- uses: actions/checkout@v2
- name: test
run: |
cd ${OLC_PATH}
bash checks.sh
# Python implementation. Lives in python/, tested with bazel.
test-python:
runs-on: ubuntu-latest
env:
OLC_PATH: python
strategy:
matrix:
python: [ '2.7', '3.6', '3.7', '3.8' ]
name: test-python-${{ matrix.python }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: test
run: bazel test --test_output=all ${OLC_PATH}:all
- name: check formatting
run: |
cd ${OLC_PATH}
pip install yapf
DIFF=`python -m yapf --diff *py`
if [ $? -eq 0 ]; then
echo -e "Python files are correctly formatted"
exit 0
else
echo -e "Python files have formatting errors"
echo -e "These must be corrected using format_check.sh"
echo "$DIFF"
fi
exit 1
# Ruby implementation. Lives in ruby/.
test-ruby:
runs-on: ubuntu-latest
env:
OLC_PATH: ruby
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
- name: test
run: |
gem install rubocop
gem install test-unit
cd ${OLC_PATH} && ruby test/plus_codes_test.rb
rubocop --config rubocop.yml
# Rust implementation. Lives in rust/.
test-rust:
runs-on: ubuntu-latest
env:
OLC_PATH: rust
steps:
- uses: actions/checkout@v2
- name: test
run: |
cd ${OLC_PATH}
cargo fmt --all -- --check
cargo build
cargo test -- --nocapture