-
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (134 loc) · 5.07 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
name: "Test"
on:
push:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: get postgres version
run: |
sudo service postgresql start
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d \()')
echo "PGVER=${PGVER}" >> $GITHUB_ENV
echo "PGPORT=5432" >> $GITHUB_ENV
echo "PGIS=3" >> $GITHUB_ENV
echo "VROOMVER=1.11.0" >> $GITHUB_ENV
echo "VRPVER=0.3.0" >> $GITHUB_ENV
echo "DEVELOP=false" >> $GITHUB_ENV
- name: Add PostgreSQL APT repository
run: |
sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ \
$(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libboost-graph-dev \
libtap-parser-sourcehandler-pgtap-perl \
postgresql-${PGVER} \
postgresql-${PGVER}-pgtap \
postgresql-${PGVER}-postgis-${PGIS} \
postgresql-${PGVER}-postgis-${PGIS}-scripts \
postgresql-${PGVER}-pgrouting \
postgresql-server-dev-${PGVER}
- name: Install VROOM dependencies
run: |
sudo apt-get install libssl-dev libasio-dev libglpk-dev
- name: Cache VROOM
id: cache-vroom
uses: actions/cache@v2
env:
cache-name: vroom
with:
path: |
~/vroom-${{ env.VROOMVER }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.VROOMVER }}
- name: Build VROOM
if: steps.cache-vroom.outputs.cache-hit != 'true'
run: |
wget https://github.com/VROOM-Project/vroom/archive/refs/tags/v${{ env.VROOMVER }}.tar.gz -O /tmp/${{ env.VROOMVER }}.tar.gz
tar -zvxf /tmp/${{ env.VROOMVER }}.tar.gz -C ~/
cd ~/vroom-${{ env.VROOMVER }}/src
# Create object file with position independent code using -fPIC flag
sed -i 's/CXXFLAGS = /CXXFLAGS = -fPIC /' makefile
cd ~/vroom-${{ env.VROOMVER }}/src
make
- name: Cache vrpRouting
if: ${{ env.DEVELOP != 'true' }}
id: cache-vrprouting
uses: actions/cache@v2
env:
cache-name: vrprouting
with:
path: |
~/vrprouting-${{ env.VRPVER }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.VRPVER }}
- name: Clone vrpRouting
if: steps.cache-vroom.outputs.cache-hit != 'true' || ${{ env.DEVELOP }} == "true"
run: |
if [ "${{ env.DEVELOP }}" = true ]; then
git clone --depth 1 https://github.com/pgRouting/vrprouting -b develop
mv vrprouting ~/vrprouting-${{ env.VRPVER }}
else
wget https://github.com/pgRouting/vrprouting/archive/refs/tags/v${{ env.VRPVER }}.tar.gz -O /tmp/${{ env.VRPVER }}.tar.gz
tar -zvxf /tmp/${{ env.VRPVER }}.tar.gz -C ~/
cd ~/vrprouting-${{ env.VRPVER }}
# TEMP: Adding support for postgresql-14
sed -i 's/PostgreSQL_ADDITIONAL_VERSIONS "12" "13"/PostgreSQL_ADDITIONAL_VERSIONS "12" "13" "14"/' CMakeLists.txt
fi
- name: Configure vrpRouting
run: |
cd ~/vrprouting-${{ env.VRPVER }}
export PATH=/usr/lib/postgresql/${PGVER}/bin:$PATH
mkdir -p build
cd build
cmake -DPOSTGRESQL_VERSION=${PGVER} -DCMAKE_BUILD_TYPE=Release -DVROOM_INSTALL_PATH=$HOME/vroom-${{ env.VROOMVER }} ..
- name: Build vrpRouting
run: |
cd ~/vrprouting-${{ env.VRPVER }}
cd build
make -j 4
sudo make install
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.17.x"
- name: Cache Go modules
uses: actions/cache@v2
env:
cache-name: modules
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.cache-name }}-
${{ runner.os }}-go-
- name: Configure
run: |
cp app.env.example app.env
sudo -u postgres createdb -p ${PGPORT} scheduler
sudo -u postgres psql -p ${PGPORT} -c "CREATE ROLE username SUPERUSER INHERIT LOGIN PASSWORD 'password'" -d scheduler
- name: go-test
shell: bash
run: make test
- name: go-coverage
shell: bash
run: |-
OUTPUT="$(make test-coverage)"
TOTAL="$(echo $OUTPUT | awk 'END{print $NF}')"
echo "::group::Coverage (${TOTAL})"
echo "${OUTPUT}"
echo "::endgroup::"
- name: Upload to codecov
uses: codecov/codecov-action@v2
with:
files: coverage.out