Skip to content

Commit 02ea5e1

Browse files
authored
ci: add test and coverage pipelines (#1)
1 parent aff888e commit 02ea5e1

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/test.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
env:
12+
# Upload coverage only for this go version.
13+
LATEST_GO_VERSION: "1.20"
14+
15+
jobs:
16+
test:
17+
services:
18+
osrm-iran:
19+
image: mojixcoder/osrm-iran:v5.25.0
20+
ports:
21+
- 5000:5000
22+
23+
strategy:
24+
matrix:
25+
os: ["ubuntu-latest"]
26+
go: ["1.18", "1.19", "1.20"]
27+
28+
name: ${{ matrix.os }} & Go ${{ matrix.go }}
29+
30+
runs-on: ${{ matrix.os }}
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v3
35+
36+
- name: Set up ${{ matrix.go }}
37+
uses: actions/setup-go@v3
38+
with:
39+
go-version: ${{ matrix.go }}
40+
41+
- name: Test
42+
shell: bash
43+
run: |
44+
bash test.sh -p -a http://127.0.0.1:5000
45+
46+
- name: Upload coverage
47+
if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'
48+
uses: codacy/codacy-coverage-reporter-action@v1
49+
with:
50+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
51+
coverage-reports: "coverage.out"
52+
force-coverage-parser: "go"

0 commit comments

Comments
 (0)