generated from IBM/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 11
240 lines (237 loc) · 8.88 KB
/
test-push.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: test-push
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
test-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Build Docker image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
id: build_docker
with:
context: .
push: false
- name: Check Docker image
run: docker run ${{ steps.build_docker.outputs.digest }} -h
test-docker-ubi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Build Docker image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
id: build_docker
with:
context: .
file: Dockerfile.ubi
push: false
- name: Check Docker image
run: docker run ${{ steps.build_docker.outputs.digest }} -h
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- run: pip install flake8
- name: Lint with flake8
run: flake8 nca --count --max-complexity=15 --max-line-length=127 --statistics
# - name: flake8 Lint
# uses: py-actions/flake8@2014ef764424fd7699d615323c17836092bec9b9
# with:
# path: nca
# max-line-length: "127"
# args: "--max-complexity=15"
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- run: |
export PYTHONPATH=.
python tests/run_unittests.py
k8s-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: install helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
sudo ./get_helm.sh
- name: Run k8s tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=k8s --check_run_time | tee tests/k8s_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_k8s_tests log
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: k8s-log
path: tests/k8s_log.txt
- name: Upload k8s failed run-time tests file
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: k8s-failed-run-time-check-file
path: ./tests/k8s_tests_failed_runtime_check.csv
if-no-files-found: ignore
k8s-tests-orig-vs-opt-comparison:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: install helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
sudo ./get_helm.sh
- name: Run k8s tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=k8s --hc_opt=debug | tee tests/k8s_cmp_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_k8s_tests log
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: k8s-cmp-log
path: tests/k8s_cmp_log.txt
calico-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: Run calico tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=calico --check_run_time | tee tests/calico_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_calico_tests log
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: calico-log
path: tests/calico_log.txt
- name: Upload calico failed run-time tests file
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: calico-failed-run-time-check-file
path: ./tests/calico_tests_failed_runtime_check.csv
if-no-files-found: ignore
calico-tests-orig-vs-opt-comparison:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: Run calico tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=calico --hc_opt=debug | tee tests/calico_cmp_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_calico_tests log
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: calico-cmp-log
path: tests/calico_cmp_log.txt
istio-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: Run istio tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=istio --check_run_time | tee tests/istio_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_istio_tests log
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: istio-log
path: tests/istio_log.txt
- name: Upload istio failed run-time tests file
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: istio-failed-run-time-check-file
path: ./tests/istio_tests_failed_runtime_check.csv
if-no-files-found: ignore
istio-tests-orig-vs-opt-comparison:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: Run istio tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=istio --hc_opt=debug | tee tests/istio_cmp_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_istio_tests log
if: ${{ always() }}
uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: istio-cmp-log
path: tests/istio_cmp_log.txt
fw-rules-assertion-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- run: |
export PYTHONPATH=.
python tests/run_all_tests.py --type=fw_rules_assertions
# live-cluster:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
# - uses: ./.github/actions/setup-nca-env
# - uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00
# - run: |
# curl -L https://istio.io/downloadIstio | sh -
# cd istio-1.*
# export PATH=$PWD/bin:$PATH
# istioctl install --set profile=demo -y
# - run: |
# export PYTHONPATH=.
# python tests/run_all_tests.py --type=k8s_live_general
build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: ./.github/actions/setup-nca-env
- name: Build package
run: |
pip install build==0.10.0
python -m build
- uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595
with:
name: nca-package
path: dist/*
test_package:
runs-on: ubuntu-latest
needs: build_package
steps:
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.9
architecture: x64
- uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
name: nca-package
path: nca_build
- run: |
pip install nca_build/network-config-analyzer-*.tar.gz
nca --connectivity -r https://github.com/IBM/network-config-analyzer/blob/master/tests/livesim_tests/livesim_topology.yaml
env:
GHE_TOKEN: ${{ github.token }}