-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (63 loc) · 2.22 KB
/
ci.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
# SPDX-FileCopyrightText: Copyright DB Netz AG
# SPDX-License-Identifier: CC0-1.0
name: dbs-onboard-map-api CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- '**'
env:
IS_MAIN_BRANCH: ${{ github.ref == 'refs/heads/main' }}
IMAGE_NAME: dbs-map-mock-server
VERSION: latest
REGISTRY: ghcr.io
REPOSITORY: dsd-dbs/dbs-onboard-map-api
PORT: 8080
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout DBS Onboard API code including submodules recursively
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y cmake
sudo apt-get install -y gcovr
sudo apt-get install libgmock-dev libgtest-dev
sudo apt-get install -y rapidjson-dev
sudo apt-get install -y doxygen
sudo apt-get install libcurl4-openssl-dev protobuf-compiler libprotobuf-dev libboost-all-dev -y --no-install-recommends --fix-missing
- name: Login to github container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull mock server image
run: |
docker pull ${{ env.REGISTRY }}/${{ env.REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Run mock server
run: |
docker run -d -p ${{ env.PORT }}:${{ env.PORT }} -e PORT=${{ env.PORT }} \
${{ env.REGISTRY }}/${{ env.REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Build DBS Onboard MAP API sources
run: ${{github.workspace}}/scripts/build.sh -DCMAKE_BUILD_TYPE=Debug
- name: Run Test
run: |
${{github.workspace}}/build/dbs-map-api/tests/GoogleTestRunner
- name: Generate Test Coverage
# if: env.IS_MAIN_BRANCH == 'true'
run: |
${{github.workspace}}/scripts/code_coverage.sh
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
# if: env.IS_MAIN_BRANCH == 'true'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{github.workspace}}/build/coverage/coverage.xml
fail_ci_if_error: true