Skip to content

Commit 91a233b

Browse files
authored
Merge pull request #3946 from PaulYuuu/ci-update
2 parents 4aac838 + 71c98c0 commit 91a233b

File tree

5 files changed

+57
-75
lines changed

5 files changed

+57
-75
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,100 @@
1-
name: GH Actions
1+
name: CI
22

33
on:
44
pull_request:
55
branches: [ master ]
66
workflow_dispatch:
77

88
jobs:
9-
10-
python-style-check:
11-
9+
python-sanity-check:
1210
name: Python ${{ matrix.python-version }}
13-
runs-on: ubuntu-20.04
14-
11+
runs-on: ubuntu-24.04
1512
strategy:
1613
matrix:
17-
python-version: [3.6, 3.9]
14+
python-version: [3.9, 3.12]
1815
fail-fast: false
19-
2016
steps:
2117
- run: echo "Job triggered by a ${{ github.event_name }} event on branch is ${{ github.ref }} in repository is ${{ github.repository }}"
2218
- name: Check out repository code
23-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2420
with:
2521
fetch-depth: 0
2622
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
2824
with:
2925
python-version: ${{ matrix.python-version }}
30-
- name: Install dependencies
31-
run: |
32-
pip install sphinx
33-
pip install -r requirements-ci.txt
34-
- name: Run inspekt
35-
if: ${{ matrix.python-version > 3.6 }}
36-
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
37-
- name: Run inspekt (py36)
38-
if: ${{ matrix.python-version == 3.6 }}
39-
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
26+
- name: Install pylint
27+
run: pip install pylint
28+
- name: Run pylint
29+
run: pylint .
4030
- run: echo "This job's status is ${{ job.status }}."
4131

4232
commitlint:
43-
44-
name: Commit lint
45-
runs-on: ubuntu-20.04
46-
33+
name: Commitlint
34+
runs-on: ubuntu-24.04
4735
steps:
4836
- name: Check out repository code
49-
uses: actions/checkout@v3
37+
uses: actions/checkout@v4
5038
with:
5139
fetch-depth: 0
5240
- name: Lint commit messages
53-
uses: wagoid/commitlint-github-action@v5
41+
uses: wagoid/commitlint-github-action@v6
5442
with:
55-
configFile: ./.ci/commitlint.config.ts
43+
configFile: commitlint.config.mjs
5644
helpURL: https://avocado-framework.readthedocs.io/en/latest/guides/contributor/chapters/styleguides.html#commit-style-guide
5745

5846
pr-check:
59-
6047
name: PR title
61-
runs-on: ubuntu-20.04
62-
48+
runs-on: ubuntu-24.04
6349
steps:
64-
- name: Check title length of pull request(${{github.event.pull_request.number}})
65-
run: |
66-
if [ $(echo "${{ github.event.pull_request.title }}" | wc -L) -gt 72 ]; then
67-
echo "Title of pull request(${{github.event.pull_request.number}}) is longer than 72 characters"
68-
exit 1
69-
fi
70-
71-
cfg-lint-check:
72-
73-
name: Cfg lint
74-
runs-on: ubuntu-20.04
50+
- name: Check title length of pull request
51+
uses: actions/github-script@v7
52+
with:
53+
script: |
54+
const title = context.payload.pull_request.title;
55+
const prNumber = context.payload.pull_request.number;
56+
const titleLength = title.length;
57+
58+
console.log(`Current title length for pull request(#${prNumber}): ${titleLength}`);
59+
if (titleLength > 72) {
60+
core.setFailed(`Title of pull request(#${prNumber}) is longer than 72 characters`);
61+
}
62+
63+
changed-cfg-files:
64+
name: Changed cfg files
65+
runs-on: ubuntu-24.04
7566
outputs:
76-
matrix: ${{ steps.set-matrix.outputs.matrix }}
77-
67+
matrix: ${{ steps.cfg-files.outputs.all_changed_files }}
7868
steps:
7969
- name: Check out repository code
80-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
8171
with:
8272
fetch-depth: 0
83-
- name: Get changed files
73+
- name: Detect changed cfg files
8474
id: cfg-files
85-
uses: tj-actions/changed-files@v35
75+
uses: tj-actions/changed-files@v46
8676
with:
87-
files: |
88-
*/tests/cfg/*.cfg
89-
- name: Set matrix
90-
id: set-matrix
91-
run: echo matrix=$(python3 -c 'print("${{ steps.cfg-files.outputs.all_changed_files }}".split())') >> $GITHUB_OUTPUT
92-
- name: Check cfg files lint
93-
if: steps.cfg-files.outputs.any_changed == 'true'
94-
run: |
95-
./.ci/cfg-lint-check.py ${{ steps.cfg-files.outputs.all_changed_files }}
77+
files: "*/tests/cfg/*.cfg"
78+
matrix: true
9679

9780
cartesian-syntax-check:
98-
9981
name: Cartesian syntax
100-
runs-on: ubuntu-20.04
101-
needs: cfg-lint-check
102-
if: ${{ needs.cfg-lint-check.outputs.matrix != '[]' }}
82+
runs-on: ubuntu-24.04
83+
if: ${{ needs.changed-cfg-files.outputs.matrix != '[]' }}
84+
needs: changed-cfg-files
10385
strategy:
10486
matrix:
105-
file: ${{ fromJson(needs.cfg-lint-check.outputs.matrix) }}
87+
file: ${{ fromJSON(needs.changed-cfg-files.outputs.matrix) }}
10688
fail-fast: false
107-
10889
steps:
10990
- name: Check out repository code
110-
uses: actions/checkout@v3
91+
uses: actions/checkout@v4
11192
with:
11293
fetch-depth: 0
113-
- name: Parse ${{ matrix.file }} into Cartesian configuration
94+
- name: Parse file into Cartesian configuration
11495
env:
11596
CFG_FILE: ${{ matrix.file }}
11697
run: |
117-
echo "Parse ${CFG_FILE} into Cartesian configuration"
118-
sed -i '1s/^/variants:\n/' ${CFG_FILE}
119-
curl -fsSL https://raw.githubusercontent.com/avocado-framework/avocado-vt/master/virttest/cartesian_config.py | python3 - -f ${CFG_FILE}
98+
echo "Parsing ${CFG_FILE} into Cartesian configuration"
99+
sed -i '1s/^/variants:\n/' "${CFG_FILE}"
100+
curl -fsSL https://raw.githubusercontent.com/avocado-framework/avocado-vt/master/virttest/cartesian_config.py | python3 - -f "${CFG_FILE}"

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
default_stages: [pre-commit, pre-push]
12
exclude: "qemu/deps/cpuid/cpuid_dumps/kvm"
23
repos:
34
- repo: local
@@ -26,3 +27,7 @@ repos:
2627
- id: ruff
2728
args: ["--fix"]
2829
- id: ruff-format
30+
- repo: https://github.com/opensource-nepal/commitlint
31+
rev: v1.3.0
32+
hooks:
33+
- id: commitlint

.pylintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[MESSAGES CONTROL]
2+
enable=basic
3+
disable=C,R,W,E0401,E0601,E1101,E1120,F0010

.ci/commitlint.config.ts renamed to commitlint.config.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import type {UserConfig} from '@commitlint/types';
2-
3-
const Configuration: UserConfig = {
1+
export default {
42
/*
53
* Resolve and load @commitlint/config-conventional from node_modules.
64
* Referenced packages must be installed
@@ -65,6 +63,4 @@ const Configuration: UserConfig = {
6563
},
6664
},
6765
},
68-
};
69-
70-
module.exports = Configuration;
66+
}

requirements-ci.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)