forked from lf-edge/eve
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (86 loc) · 3.56 KB
/
Copy pathyetus.yml
File metadata and controls
91 lines (86 loc) · 3.56 KB
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
# Copyright (c) 2025, Zededa, Inc.
# SPDX-License-Identifier: Apache-2.0
#
---
name: Apache Yetus
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- "master"
- "[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+-stable"
- "feature/*"
jobs:
yetus:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: src
fetch-depth: 0
- name: Generate patch locally
working-directory: src
run: |
# Add upstream and fetch the base branch
git remote add upstream ${{ github.server_url }}/${{ github.repository }}.git
git fetch upstream ${{ github.base_ref }}
# Now diff against the correct base
git diff upstream/${{ github.base_ref }}...HEAD > ${{ github.workspace }}/pr.patch
# Get back to upstream master so patch can be applied
git checkout upstream/master
- name: Yetus
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
lfedge/eve-yetus:0.15.1-eve-2 \
test-patch \
--basedir=/workspace/src \
--patch-dir=/workspace/out \
--build-tool=nobuild \
--continuous-improvement=true \
--buf-basedir=/workspace/src/evetest \
--user-plugins=/workspace/src/.yetus/plugins.d \
--plugins='all,-asflicense,-author,-findbugs,-gitlab,-jira,-shelldocs' \
--revive-config=.revive.toml \
--brief-report-file=/workspace/out/brief.txt \
--console-report-file=/workspace/out/console.txt \
--html-report-file=/workspace/out/report.html \
--junit-report-xml=/workspace/out/junit-report.xml \
--pylint-requirements=true \
--report-unknown-options=false \
/workspace/pr.patch
- name: Store Yetus artifacts
if: ${{ always() }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: 'yetus-scan'
path: ${{ github.workspace }}/out
- name: Annotate errors from Yetus
if: ${{ always() }}
run: |
set +e
# Yetus writes patch-<plugin>.txt files for each plugin that found issues.
# Each line is in the format: filename:line:message
if [ -z "$(ls ${{ github.workspace }}/out/patch-*-result.txt 2> /dev/null || true)" ]; then
echo "No result files to annotate."
exit 0
fi
for patch_file in ${{ github.workspace }}/out/patch-*-result.txt; do
plugin=$(basename "$patch_file" | sed "s/patch-\(.*\)-result.txt/\1/")
while read -r line; do
# Skip empty lines and header lines
[ -z "$line" ] && continue
# Parse filename:linenum:message
file=$(echo "$line" | awk -F: '{print $1}')
lineno=$(echo "$line" | awk -F: '{print $2}' | grep "^[0-9].*" || true)
message=$(echo "$line" | awk -F: '{start=($3~/^[0-9]+$/)?4:3; for(i=start;i<=NF;i++) printf "%s%s",(i>start?":":""),$i; print ""}')
# Only annotate if we got a valid file and line number
if [ -n "$file" ] && [ -n "$lineno" ]; then
echo "::error file=${file},line=${lineno},title=Yetus [${plugin}]::${message}"
else
# No file/line info, just print for visibility
echo "${line}"
fi
done < "$patch_file"
done