-
Notifications
You must be signed in to change notification settings - Fork 344
173 lines (160 loc) · 5.66 KB
/
tp.integration.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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: TP Tests
env:
# alpine:3.13
ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
NODE_VERSION: 16
on:
push:
paths:
- .github/actions/todb-init/**
- .github/actions/tvdb-init/**
- .github/actions/tp-integration-tests/**
- .github/workflows/tp.integration.tests.yml
- GO_VERSION
- '!**_test.go'
- infrastructure/cdn-in-a-box/optional/traffic_vault/**
- lib/go-tc/**
- traffic_ops/app/db/**
- traffic_ops/traffic_ops_golang/**.go
- traffic_portal/**
pull_request:
paths:
- .github/actions/todb-init/**
- .github/actions/tvdb-init/**
- .github/actions/tp-integration-tests/**
- .github/workflows/tp.integration.tests.yml
- GO_VERSION
- '!**_test.go'
- infrastructure/cdn-in-a-box/optional/traffic_vault/**
- lib/go-tc/**
- traffic_ops/app/db/**
- traffic_ops/traffic_ops_golang/**.go
- traffic_portal/**
types: [ opened, reopened, ready_for_review, synchronize ]
jobs:
unit-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('traffic_portal/package-lock.json traffic_portal/test/integration/package-lock.json') }}
- name: Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}.x
- name: Install latest Chrome
run: sudo apt-get update && sudo apt-get install google-chrome-stable
- name: NPM install
if: steps.restore-npm-cache.cache-hit != 'true'
working-directory: traffic_portal
run: npm ci
- name: Build Traffic Portal
working-directory: traffic_portal
run: npm run build
- name: Unit tests
working-directory: traffic_portal
run: npm run test:ci
integration-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
services:
hub:
image: selenium/hub:4.8.1
ports:
- 4442:4442
- 4443:4443
- 4444:4444
options: --health-cmd=/opt/bin/check-grid.sh --health-interval=5s --health-timeout=15s --health-retries=5
chrome:
image: selenium/node-chrome:110.0
env:
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
volumes:
- /dev/shm:/dev/shm
postgres:
image: postgres:11
env:
POSTGRES_USER: traffic_ops
POSTGRES_PASSWORD: twelve
POSTGRES_DB: traffic_ops
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
smtp:
image: maildev/maildev:2.0.0-beta3
ports:
- 25:25
options: >-
--entrypoint=bin/maildev
--user=root
--health-cmd="sh -c \"[[ \$(wget -qO- http://smtp/healthz) == true ]]\""
--
maildev/maildev:2.0.0-beta3
--smtp=25
--hide-extensions=STARTTLS
--web=80
steps:
- name: Checkout
uses: actions/checkout@master
- name: Cache Alpine Docker image
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/docker-images
key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- name: Import cached Alpine Docker image
run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('traffic_portal/package-lock.json traffic_portal/test/integration/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Initialize Traffic Ops Database
id: todb
uses: ./.github/actions/todb-init
- name: Initialize Traffic Vault Database
id: tvdb
uses: ./.github/actions/tvdb-init
- name: Check Go Version
run: echo "value=$(cat GO_VERSION)" >> $GITHUB_OUTPUT
id: go-version
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.value }}
- name: Run TP
uses: ./.github/actions/tp-integration-tests
with:
smtp_address: 172.17.0.1
- name: Upload Report
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ github.job }}
path: ${{ github.workspace }}/traffic_portal/test/integration/Reports/
- name: Save Alpine Docker image
run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}