-
Notifications
You must be signed in to change notification settings - Fork 175
161 lines (144 loc) · 4.83 KB
/
main.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
name: Insights Core Test
on:
push:
branches: [ master, '3.0']
pull_request:
branches: [ master ]
jobs:
code-test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-versions: ["3.6", "3.9", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-versions }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: flake8
run: |
pip install -e .[linting]
flake8 .
- name: pytest with coverage report
run: |
pip install 'urllib3'
pip install -e .[testing]
pytest --cov --cov-branch --cov-report=
coverage json
- name: coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-versions }}.json
path: ./coverage.json
overwrite: true
coverage-check:
runs-on: ubuntu-latest
needs: code-test
strategy:
matrix:
python-versions: ["3.6", "3.9", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get Changed files
run: git diff --name-only --diff-filter=AM -r HEAD^1 HEAD | grep -e "insights/.*\.py" | egrep -v "tests/|tools/|contrib/|parsr/|formats/|plugins/" > changes
continue-on-error: true
- uses: actions/setup-python@v5
- uses: actions/download-artifact@master
with:
name: coverage-${{ matrix.python-versions }}.json
path: coverage_json
- name: coverage analysis
run: |
python -m pip install --upgrade pip
pip install -e .
mv ./coverage_json/coverage.json ./coverage.json
python insights/tools/coverage.py changes
python27-test:
runs-on: ubuntu-latest
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v4
- name: Set up Python 2.7
uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: flake8
run: |
pip install -e .[linting]
flake8 .
- name: pytest
run: |
pip install 'urllib3'
pip install -e .[testing]
pytest
python26-test:
runs-on: ubuntu-latest
container:
image: cronosmobi/python2.6:latest
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- uses: actions/checkout@v3
- name: install dependencies
run: |
apt-get install -y --no-install-recommends software-properties-common
apt-get install -y build-essential git curl unzip file tar
- name: build setuptools and pip
run: |
export PATH=$PATH:/github/home/.local/bin
CUR_DIR=$(pwd)
mkdir ../tools && cd ../tools
curl -L -O https://files.pythonhosted.org/packages/b8/04/be569e393006fa9a2c10ef72ea33133c2902baa115dd1d4279dae55c3b3b/setuptools-36.8.0.zip
unzip setuptools-36.8.0.zip && cd setuptools-36.8.0
python setup.py install --user && cd ..
curl -L -O https://github.com/pypa/pip/archive/refs/tags/9.0.3.tar.gz
tar -xvzf 9.0.3.tar.gz && cd pip-9.0.3
python setup.py install --user
cd ${CUR_DIR}
- name: get depenencies
run: |
export PATH=$PATH:/github/home/.local/bin
CUR_DIR=$(pwd)
cd ../
git clone https://github.com/SteveHNH/jenkins-s2i-example.git pips
(cd ./pips/slave26/pip_packages && test -f coverage-4.3.4-cp26-cp26mu-manylinux1_x86_64.whl && mv coverage-4.3.4-cp26-cp26mu-manylinux1_x86_64.whl coverage-4.3.4-py2.py3-none-any.whl)
pip install --user --no-index -f ./pips/slave26/pip_packages -r ./pips/slave26/ci_requirements.txt
cd ${CUR_DIR}
mkdir ../collections_module
curl -L -o ./../collections_module/collections.py https://raw.githubusercontent.com/RedHatInsights/insights-core/5c8ca0f2fb3de45908e8d931d40758af34a7997a/.collections.py
- name: flake8
run: |
export PATH=$PATH:/github/home/.local/bin
pip install --user -e .[linting] -f ./pips/slave26/pip_packages
flake8 .
- name: pytest
run: |
export PATH=$PATH:/github/home/.local/bin
pip install --user -e .[testing] -f ./pips/slave26/pip_packages
export PYTHONPATH=${PYTHONPATH}:./../collections_module
pytest
docs-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: install dependencies
run: |
sudo apt-get install pandoc
python -m pip install --upgrade pip
- name: docs Test
run: |
pip install -e .[docs]
sphinx-build -W -b html -qa -E docs docs/_build/html