forked from datacenter/ACI-Pre-Upgrade-Validation-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
93 lines (87 loc) · 2.49 KB
/
.gitlab-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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
# Change pip's cache directory to be inside the project directory
# since gitlab ci can only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
stages:
- unit_test
- integration_test
test:py27:
stage: unit_test
image: python:2.7.11-slim
before_script:
# pip 21.0 does not support py2 but the default pip in this container
# is too old and fails. Hence the pip version must be 20.3.4.
- pip install --upgrade pip==20.3.4
- python --version ; pip --version
- pip install virtualenv
- virtualenv venv27
- source venv27/bin/activate
script:
- pip install -r tests/requirements-py27.txt
- pytest --junitxml=report.xml
artifacts:
when: always
reports:
junit: report.xml
cache:
key:
files:
- tests/requirements-py27.txt
paths:
- venv27/
- .cache/pip
test:py38:
stage: unit_test
image: python:3.8.10-slim
before_script:
- pip install --upgrade pip
- python --version ; pip --version
- pip install virtualenv
- virtualenv venv38
- source venv38/bin/activate
script:
- pip install -r tests/requirements-py38.txt
- pytest --junitxml=report.xml
artifacts:
when: always
reports:
junit: report.xml
cache:
key:
files:
- tests/requirements-py38.txt
paths:
- venv38/
- .cache/pip
test:integration:
stage: integration_test
image: python:3.8.10-slim
before_script:
- echo 'ACQUIRE {http::proxy "$apt_proxy"}' >> /etc/apt/apt.conf
- echo -e "$apt_source" > /etc/apt/sources.list
- apt update
- apt install -y curl
- pip install --upgrade pip
- python --version ; pip --version
- pip install virtualenv
- virtualenv venv38-integration
- source venv38-integration/bin/activate
script:
- cd tests
- 'curl --header "PRIVATE-TOKEN: $integration_repo_token" "$repo_url/requirements.txt/raw?ref=main" -o requirements.txt'
- 'curl --header "PRIVATE-TOKEN: $integration_repo_token" "$repo_url/runner.py/raw?ref=main" -o runner.py'
- 'curl --header "PRIVATE-TOKEN: $integration_repo_token" "$repo_url/test_fabrics.yaml/raw?ref=main" -o test_fabrics.yaml'
- pip install -r requirements.txt
- python3 runner.py -f ../aci-preupgrade-validation-script.py -i test_fabrics.yaml -k $decode_key
artifacts:
when: always
paths:
- $CI_PROJECT_DIR/tests/*.log
cache:
key:
files:
- tests/requirements.txt
paths:
- venv38-integration/
- .cache/pip