-
Notifications
You must be signed in to change notification settings - Fork 5
181 lines (162 loc) · 5.64 KB
/
unit-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
171
172
173
174
175
176
177
178
179
180
181
name: Unit Tests
concurrency:
group: unittests-${{ github.repository }}
on:
push:
branches:
- master
workflow_dispatch:
inputs:
branch:
description: 'Branch under test:'
required: false
default: master
type: string
kubernetes-version:
description: 'Version of Kubernetes to use (e.g. 1.24.9):'
required: false
default: '1.24.9'
type: string
env:
AWS_CPP_SDK_VERSION: "1.9.365"
CCACHE_NAME: "cpp-unittest-build"
DEBIAN_FRONTEND: "noninteractive"
HELM_VERSION: "3.8.1"
MINIKUBE_VERSION: "1.30.1"
OPENTELEMETRY_VERSION: "1.6.1"
PYTHON_VERSION: "3.10.7"
jobs:
workflow-inputs:
name: Display Workflow Inputs
runs-on: ubuntu-20.04
if: github.event.inputs != ''
steps:
- name: Output inputs
run: |-
echo "## Workflow inputs" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "${{ toJSON(github.event.inputs) }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
test:
name: Test
runs-on: ubuntu-22.04
steps:
- name: Install OS Packages
run: |-
sudo apt-get update -y
sudo apt-get install -y \
autoconf \
build-essential \
ccache \
cmake \
g++ \
libbenchmark-dev \
libboost-all-dev \
libcrypto++-dev \
libcurl4-openssl-dev \
libgmock-dev \
libgrpc-dev \
libgrpc++-dev \
libgtest-dev \
libprotobuf-dev \
libtool \
libssl-dev \
libyaml-cpp-dev \
libz-dev \
pkg-config \
protobuf-compiler-grpc
- name: Install AWS C++ SDK
working-directory: .
run: |-
curl -fsSL https://raw.githubusercontent.com/slateci/docker-images/master/slate-client-server/scripts/install-aws-cpp-sdk.sh -o install-aws-cpp-sdk.sh
chmod +x ./install-aws-cpp-sdk.sh
sudo ./install-aws-cpp-sdk.sh ${{ env.AWS_CPP_SDK_VERSION }} ubuntu22_04
- name: Install OpenTelemetry C++ Client
working-directory: .
run: |-
curl -fsSL https://raw.githubusercontent.com/slateci/docker-images/master/slate-client-server/scripts/install-opentelemetry.sh -o install-opentelemetry.sh
chmod +x ./install-opentelemetry.sh
sudo ./install-opentelemetry.sh ${{ env.OPENTELEMETRY_VERSION }} ubuntu22_04
- name: Check out repo
if: ${{ github.event.inputs.branch == '' }}
uses: actions/checkout@v3
with:
fetch-depth: 0
path: ./checkout
- name: Check out specific branch of repo
if: ${{ github.event.inputs.branch != '' }}
uses: actions/checkout@v3
with:
fetch-depth: 0
path: ./checkout
ref: ${{ github.event.inputs.branch }}
- name: Set up ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-${{ env.CCACHE_NAME }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-${{ env.CCACHE_NAME }}-${{ github.ref }}
${{ runner.os }}-${{ env.CCACHE_NAME }}-
- name: Build SLATE binaries and tests
working-directory: ./checkout/build
env:
VERSION_OVERRIDE: localdev
run: |-
cmake .. \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_CLIENT=True \
-DBUILD_SERVER=True \
-DBUILD_SERVER_TESTS=True \
-DSTATIC_CLIENT=False
make -j2 -k
- name: Create Minikube Cluster
if: ${{ github.event.inputs.kubernetes-version == '' }}
uses: medyagh/setup-minikube@master
with:
minikube-version: ${{ env.MINIKUBE_VERSION }}
driver: docker
container-runtime: containerd
kubernetes-version: "v1.24.9"
cni: calico
- name: Create Minikube Cluster
if: ${{ github.event.inputs.kubernetes-version != '' }}
uses: medyagh/setup-minikube@master
with:
minikube-version: ${{ env.MINIKUBE_VERSION }}
driver: docker
container-runtime: containerd
kubernetes-version: "v${{ github.event.inputs.kubernetes-version }}"
cni: calico
- name: Install local DynamoDB
working-directory: .
run: |-
mkdir ./dynamodb
curl -fsSL https://raw.githubusercontent.com/slateci/docker-images/master/slate-client-server/scripts/install-dynamo.sh -o install-dynamo.sh
chmod +x ./install-dynamo.sh
sudo ./install-dynamo.sh ${{ github.workspace }}/dynamodb
ls -al ./dynamodb
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Run tests
timeout-minutes: 180
working-directory: ./checkout/build
env:
DYNAMODB_JAR: "${{ github.workspace }}/dynamodb/DynamoDBLocal.jar"
DYNAMODB_LIB: "${{ github.workspace }}/dynamodb/DynamoDBLocal_lib"
SLATE_SCHEMA_DIR: "${{ github.workspace }}/checkout/resources/api_specification"
TEST_SRC: "${{ github.workspace }}/checkout/test"
run: make check
notifications:
name: Notifications
runs-on: ubuntu-20.04
needs:
- test
if: ${{ always() && (needs.test.result == 'failure') }}
steps:
- name: Notify Slack of Failure
uses: slateci/github-actions/.github/actions/slack-notify-failure@v16
with:
slack_bot_token: '${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}'