-
Notifications
You must be signed in to change notification settings - Fork 57
170 lines (167 loc) · 5.36 KB
/
tests.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
name: Tests
on: [push, pull_request]
jobs:
build_cpp:
runs-on: ${{ matrix.cfg.os }}
strategy:
matrix:
cfg:
- {
os: ubuntu-latest,
cpp-version: g++
}
- {
os: ubuntu-latest,
cpp-version: clang++
}
- {
os: macos-latest,
cpp-version: clang++
}
steps:
- uses: actions/checkout@v2
- if: matrix.cfg.os == 'ubuntu-latest'
name: Build on Ubuntu
env:
CXX: ${{ matrix.cfg.cpp-version}}
run: |
sudo apt install libtins-dev libjsoncpp-dev libpcap-dev # pcap required for libtins
mkdir build
cd build
cmake ..
make VERBOSE=1
./dublin-traceroute -v
- if: matrix.cfg.os == 'macos-latest'
name: Build on macOS
env:
CXX: ${{ matrix.cfg.cpp-version}}
run: |
brew update
brew install libtins jsoncpp
mkdir build
cd build
cmake ..
make
./dublin-traceroute -v
build_go:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ['1.21', '1.22']
os: ['ubuntu-latest', 'macos-latest'] # , 'windows-latest']
steps:
- uses: actions/checkout@v2
with:
# clone in the gopath
path: src/github.com/${{ github.repository }}
- if: github.event_name == 'pull_request'
# this is for debugging. pull_request has a different hash from push,
# but the original hash is exposed in github.event.pull_request.head.sha
run: |
echo "Building SHA ${{ github.event.pull_request.head.sha }}"
- uses: actions/setup-go@v2
with:
stable: false
go-version: ${{ matrix.go }}
- run: |
echo "GOPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- if: matrix.os != 'windows-latest'
run: |
cd src/github.com/${{ github.repository }}/go/dublintraceroute/cmd/dublin-traceroute
go get -v ./...
go build
./dublin-traceroute --version
- if: matrix.os == 'windows-latest'
run: |
cd src/github.com/${{ github.repository }}/go/dublintraceroute/cmd/dublin-traceroute
go get -v ./...
go build
.\dublin-traceroute.exe --version
test_go:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ['1.21', '1.22']
os: ['ubuntu-latest', 'macos-latest'] # , 'windows-latest']
steps:
- uses: actions/checkout@v2
with:
# clone in the gopath
path: src/github.com/${{ github.repository }}
- uses: actions/setup-go@v2
with:
stable: false
go-version: ${{ matrix.go }}
- run: |
echo "GOPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- if: matrix.os != 'windows-latest'
run: |
cd src/github.com/${{ github.repository }}/go/dublintraceroute/cmd/dublin-traceroute
go get -v -t ./...
echo "" > coverage.txt
for d in $(go list ./...); do
go test -v -race -coverprofile=profile.out -covermode=atomic "${d}"
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
bash <(curl -s https://codecov.io/bash) -c -f coverage.txt -F unittest
test_cpp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
stable: "false"
go-version: "1.22"
- name: Run Tests
run: |
sudo apt install libtins-dev libjsoncpp-dev libpcap-dev googletest
git submodule init
git submodule update
mkdir build
cd build
cmake ..
make tests
make test
integ:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.22']
env:
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- run: |
echo "GOPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "COMPOSE_FILE=$GITHUB_WORKSPACE/src/github.com/${{ github.repository }}/docker-compose.yml" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
# clone in the gopath
path: "src/github.com/${{ github.repository }}"
- if: github.event_name == 'pull_request'
# this is for debugging. pull_request has a different hash from push,
# but the original hash is exposed in github.event.pull_request.head.sha
run: |
echo "Building SHA ${{ github.event.pull_request.head.sha }}"
- uses: actions/setup-go@v2
with:
stable: false
go-version: ${{ matrix.go }}
- name: build routest
run: |
set -exu
cd "src/github.com/${{ github.repository }}/go/dublintraceroute/cmd/routest"
go get -v ./...
go build
- name: Login to Docker hub
run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- name: Build docker image
run: docker-compose -f $COMPOSE_FILE build
- name: Run integ tests
run: docker-compose -f $COMPOSE_FILE up --abort-on-container-exit
- name: publish coverage data
run: |
bash <(curl -s https://codecov.io/bash) -c -f coverage_integ.txt -F integ