forked from alisw/alidist
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (66 loc) · 2.19 KB
/
recipe-checks.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
---
# GitHub workflow to check pull requests and commits for pitfalls and formatting
# mistakes in build recipes.
name: Check recipes
'on':
push:
paths:
- '*.sh'
pull_request:
paths:
- '*.sh'
permissions: {}
jobs:
lint:
name: alidistlint
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: python3 -m pip install -U --user 'alidistlint[git]'
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run linter
run: |
if [ -n "$BASE_SHA" ]; then
# For pull requests, only check files that have changed relative to
# the base commit.
merge_base=$(git merge-base "$BASE_SHA" "$HEAD_SHA")
git diff -z --diff-filter d --name-only "$merge_base..$HEAD_SHA" -- '*.sh' |
xargs -0tr alidistlint -f github --changes "$merge_base..$HEAD_SHA"
else
# On push, check every file, ignoring warnings and notes.
alidistlint -ef github ./*.sh
fi
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.head_commit.sha }}
circular:
name: circular dependencies
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install -y graphviz
python3 -m pip install -U --user alibuild
aliBuild analytics off
- uses: actions/checkout@v3
- name: Run check
run: |
for fname in *.sh; do
case "$fname" in
jalien*) default=jalien ;;
*) default=o2 ;;
esac
echo "Checking $fname with --defaults $default"
if aliBuild deps --defaults "$default" --outgraph /dev/null --no-system --neat -c . \
"$(awk '/^package: /{print $2}' "$fname")" 2>&1 |
grep -q 'transitive reduction not unique'
then
echo -n "::error title=circular dependency,file=$fname,line=1"
echo '::recipe has circular dependency'
err=1
fi
done
exit "${err:-0}"