-
Notifications
You must be signed in to change notification settings - Fork 87
143 lines (136 loc) · 4.36 KB
/
test_pr.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
name: PR Tests
on: [pull_request]
jobs:
is_source_changed:
name: Check if sources has changed
runs-on: ubuntu-latest
outputs:
is_source_changed: ${{steps.check_source_change.outputs.changed}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if any source changed
id: check_source_change
uses: ./.github/actions/files-changed
with:
paths: |
.github/*
examples/*
testplan/*
tests/*
scripts/*
releaseherald/releaseherald/*
pytest.ini
pyproject.toml
setup.py
requirements.txt
success:
name: PR Tets Completed
needs: [is_source_changed, test]
runs-on: ubuntu-latest
if: always() && needs.is_source_changed.result == 'success' && (needs.is_source_changed.outputs.is_source_changed == 'false' || needs.Test.result == 'success')
steps:
- run: echo ${{needs.is_source_changed.result}} ${{needs.is_source_changed.outputs.is_source_changed}} ${{needs.Test.result}}
- run: true
lint_python:
name: Run lint on python code
needs: [is_source_changed]
runs-on: ubuntu-latest
if: needs.is_source_changed.outputs.is_source_changed == 'true'
env:
BLACK_VERSION: "22.10.0"
LINT_PYTHON_VERSION: "3.7"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ env.LINT_PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.LINT_PYTHON_VERSION }}
- name: Restore pip cache
uses: ./.github/actions/pip-cache
- name: Setup
run: |
pip install -r requirements.txt -U
- name: Lint
run: doit lint
build_ui:
name: Build UI (with test and lint)
needs: [is_source_changed]
runs-on: ubuntu-latest
if: needs.is_source_changed.outputs.is_source_changed == 'true'
env:
REACT_APP_API_BASE_URL: "/fake/api/endpoint"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "14.x"
- name: Restore pip cache
uses: ./.github/actions/pip-cache
- name: Set up PNPM
uses: pnpm/[email protected]
with:
version: 6.30.1
- name: Setup
run: |
pip install -r requirements-build.txt -U
- name: Build
run: |
doit lint_ui
CI=false doit build_ui
doit test_ui
- name: Archive ui artifacts
uses: actions/upload-artifact@v3
with:
name: ui_bundle
path: testplan/web_ui/testing/build
retention-days: 1
test:
name: Test
needs: [lint_python, build_ui]
runs-on: ${{ matrix.os }}
env:
CI: ""
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.7, 3.8, '3.10', 3.11]
fail-fast: false
steps:
- run: echo "BUILD ${{ matrix.os }} ${{ matrix.python-version }} ${{needs.is_source_changed.outputs.is_source_changed}}"
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore pip cache
uses: ./.github/actions/pip-cache
- name: Download ui bundle
uses: actions/download-artifact@v3
with:
name: ui_bundle
path: testplan/web_ui/testing/build
- name: Set up Zookeeper for tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get -y install zookeeper zookeeper-bin zookeeperd
- name: Set up Kafka for tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
wget https://downloads.apache.org/kafka/3.4.1/kafka_2.13-3.4.1.tgz -O kafka.tgz
sudo mkdir /opt/kafka
sudo chown -R $USER:$USER /opt/kafka
tar zxf kafka.tgz -C /opt/kafka --strip-components 1
- name: Install dependencies
run: pip install -r requirements.txt -U
- name: Test Python
run: doit test