-
Notifications
You must be signed in to change notification settings - Fork 174
119 lines (101 loc) · 3.8 KB
/
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
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
name: GH Actions
on:
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
python-style-check:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.9]
fail-fast: false
steps:
- run: echo "Job triggered by a ${{ github.event_name }} event on branch is ${{ github.ref }} in repository is ${{ github.repository }}"
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install sphinx
pip install -r requirements-ci.txt
- name: Run inspekt
if: ${{ matrix.python-version > 3.6 }}
run: inspekt checkall --disable-style E203,E501,E265,W601,E402,E722,E741 --disable-lint=W,R,C,E0601,E1002,E1101,E1103,E1120,F0401,I0011,I1101 --enable-lint W0611,W1201 --no-license-check
- name: Run inspekt (py36)
if: ${{ matrix.python-version == 3.6 }}
run: inspekt checkall --disable-style E203,E501,E265,W601,E402,E722,E741 --disable-lint=W,R,C,E0012,E0601,E1002,E1101,E1103,E1120,F0401,I0011,I1101 --enable-lint W0611,W1201 --no-license-check
- run: echo "This job's status is ${{ job.status }}."
commitlint:
name: Commit lint
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint commit messages
uses: wagoid/commitlint-github-action@v5
with:
configFile: ./.ci/commitlint.config.ts
helpURL: https://avocado-framework.readthedocs.io/en/latest/guides/contributor/chapters/styleguides.html#commit-style-guide
pr-check:
name: PR title
runs-on: ubuntu-20.04
steps:
- name: Check title length of pull request(${{github.event.pull_request.number}})
run: |
if [ $(echo "${{ github.event.pull_request.title }}" | wc -L) -gt 72 ]; then
echo "Title of pull request(${{github.event.pull_request.number}}) is longer than 72 characters"
exit 1
fi
cfg-lint-check:
name: Cfg lint
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: cfg-files
uses: tj-actions/changed-files@v35
with:
files: |
*/tests/cfg/*.cfg
- name: Set matrix
id: set-matrix
run: echo matrix=$(python3 -c 'print("${{ steps.cfg-files.outputs.all_changed_files }}".split())') >> $GITHUB_OUTPUT
- name: Check cfg files lint
if: steps.cfg-files.outputs.any_changed == 'true'
run: |
./.ci/cfg-lint-check.py ${{ steps.cfg-files.outputs.all_changed_files }}
cartesian-syntax-check:
name: Cartesian syntax
runs-on: ubuntu-20.04
needs: cfg-lint-check
if: ${{ needs.cfg-lint-check.outputs.matrix != '[]' }}
strategy:
matrix:
file: ${{ fromJson(needs.cfg-lint-check.outputs.matrix) }}
fail-fast: false
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Parse ${{ matrix.file }} into Cartesian configuration
env:
CFG_FILE: ${{ matrix.file }}
run: |
echo "Parse ${CFG_FILE} into Cartesian configuration"
sed -i '1s/^/variants:\n/' ${CFG_FILE}
curl -fsSL https://raw.githubusercontent.com/avocado-framework/avocado-vt/master/virttest/cartesian_config.py | python3 - -f ${CFG_FILE}