-
Notifications
You must be signed in to change notification settings - Fork 2
138 lines (107 loc) · 3.36 KB
/
validate_selinux_compile.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
#
# SELinux code validation workflow
#
name: "Validate SELinux code"
concurrency:
group: SELinux_compile_wkf_group
on:
workflow_dispatch:
push:
paths:
- '**.te'
- '**.fc'
- '**.if'
pull_request:
branches: [ "main", "release/**" ]
paths:
- '**.te'
- '**.fc'
- '**.if'
env:
SEMODULE: springboot
jobs:
compile_el8:
name: Validate SELinux code (EL 8)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: lhqg/selinux_compile@almalinux8
compile_el9:
name: Validate SELinux code (EL 9)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@master
- uses: lhqg/selinux_compile@centos9
compile_fedora37:
name: Validate SELinux code (Fedora 37)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: lhqg/selinux_compile@fedora37
compile_fedora38:
name: Validate SELinux code (Fedora 38)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: lhqg/selinux_compile@fedora38
compile_fedora39:
name: Validate SELinux code (Fedora 39)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: lhqg/selinux_compile@fedora39
compile_fedora40:
name: Validate SELinux code (Fedora 40)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: lhqg/selinux_compile@fedora40
semodule_info:
name: Get SELinux module informations
needs: [ compile_el8, compile_el9, compile_fedora37, compile_fedora38, compile_fedora39, compile_fedora40 ]
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
outputs:
semodule_name: ${{ steps.semodule_chars.outputs.semodule_name }}
semodule_vers: ${{ steps.semodule_chars.outputs.semodule_vers }}
steps:
- uses: actions/checkout@master
- name: Get SELinux policy module characteristics
id: semodule_chars
run: |
awk '
/^[[:blank:]]*module[[:blank:]]+/ {
sub("[[:blank:]]*;$", "")
module_name=$2
module_vers=$3
}
/^[[:blank:]]*policy_module[[:blank:]]*\(/ {
sub("^[[:blank:]]*policy_module[[:blank:]]*[(][[:blank:]]*", "")
sub("[[:blank:]]*)[[:blank:]]*$", "")
split($0, a, "[[:blank:]]*,[[:blank:]]*")
module_name=a[1]
module_vers=a[2]
}
END {
print "{semodule_name}="module_name"}"
print "{semodule_vers}="module_vers"}"
}' se_module/${SEMODULE}.te >> $GITHUB_OUTPUT
add_tag:
name: Add SELinux module version tag on the branch
needs: semodule_info
runs-on: ubuntu-latest
if: ( github.event_name == 'push' && ( github.ref_name == 'main' || startsWith(github.ref_name, 'release/') ) )
steps:
- uses: actions/checkout@master
- name: Tag the branch with the SELinux module version and draft a pre-release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.semodule_info.outputs.semodule_vers }}-rc
release_name: Release candidate for v${{ needs.semodule_info.outputs.semodule_vers }}
draft: true
prerelease: true