|
82 | 82 | submodules: false |
83 | 83 | persist-credentials: false |
84 | 84 |
|
| 85 | + - name: Selinux - Setup Lima |
| 86 | + uses: lima-vm/lima-actions/setup@v1 |
| 87 | + id: lima-actions-setup |
| 88 | + |
| 89 | + - name: Selinux - Cache ~/.cache/lima |
| 90 | + uses: actions/cache@v4 |
| 91 | + with: |
| 92 | + path: ~/.cache/lima |
| 93 | + key: lima-${{ steps.lima-actions-setup.outputs.version }} |
| 94 | + |
| 95 | + - name: Selinux - Start Fedora VM with SELinux |
| 96 | + run: limactl start --plain --name=default --cpus=2 --disk=40 --memory=8 --network=lima:user-v2 template://fedora |
| 97 | + |
| 98 | + - name: Selinux - Setup SSH |
| 99 | + uses: lima-vm/lima-actions/ssh@v1 |
| 100 | + |
| 101 | + - name: Selinux - Verify SELinux Status and Configuration |
| 102 | + run: | |
| 103 | + lima getenforce |
| 104 | + lima ls -laZ /etc/selinux |
| 105 | + lima sudo sestatus |
| 106 | +
|
| 107 | + # Ensure we're running in enforcing mode |
| 108 | + lima sudo setenforce 1 |
| 109 | + lima getenforce |
| 110 | +
|
| 111 | + # Create test files with SELinux contexts for testing |
| 112 | + lima sudo mkdir -p /var/test_selinux |
| 113 | + lima sudo touch /var/test_selinux/test_file |
| 114 | + lima sudo chcon -t etc_t /var/test_selinux/test_file |
| 115 | + lima ls -Z /var/test_selinux/test_file # Verify context |
| 116 | +
|
| 117 | + - name: Selinux - Install dependencies in VM |
| 118 | + run: | |
| 119 | + lima sudo dnf -y update |
| 120 | + lima sudo dnf -y install git autoconf autopoint bison texinfo gperf gcc g++ gdb jq libacl-devel libattr-devel libcap-devel libselinux-devel attr rustup clang-devel texinfo-tex wget automake patch quilt |
| 121 | + lima rustup-init -y --default-toolchain stable |
| 122 | +
|
85 | 123 | - name: Override submodule URL and initialize submodules |
86 | 124 | # Use github instead of upstream git server |
87 | 125 | run: | |
@@ -125,12 +163,42 @@ jobs: |
125 | 163 | sudo update-locale |
126 | 164 | echo "After:" |
127 | 165 | locale -a |
| 166 | +
|
| 167 | + - name: Selinux - Copy the sources to VM |
| 168 | + run: | |
| 169 | + rsync -a -e ssh . lima-default:~/work/ |
| 170 | +
|
128 | 171 | - name: Build binaries |
129 | 172 | shell: bash |
130 | 173 | run: | |
131 | 174 | ## Build binaries |
132 | 175 | cd '${{ steps.vars.outputs.path_UUTILS }}' |
133 | 176 | bash util/build-gnu.sh --release-build |
| 177 | +
|
| 178 | + - name: Selinux - Generate selinux tests list |
| 179 | + run: | |
| 180 | + # Find and list all tests that require SELinux |
| 181 | + lima bash -c "cd ~/work/gnu/ && grep -l 'require_selinux_' -r tests/ > ~/work/uutils/selinux-tests.txt" |
| 182 | + lima bash -c "cd ~/work/uutils/ && cat selinux-tests.txt" |
| 183 | +
|
| 184 | + # Count the tests |
| 185 | + lima bash -c "cd ~/work/uutils/ && echo 'Found SELinux tests:'; wc -l selinux-tests.txt" |
| 186 | +
|
| 187 | + - name: Selinux - Build for selinux tests |
| 188 | + run: | |
| 189 | + lima bash -c "cd ~/work/uutils/ && bash util/build-gnu.sh" |
| 190 | +
|
| 191 | + - name: Selinux - Run selinux tests |
| 192 | + run: | |
| 193 | + lima sudo setenforce 1 |
| 194 | + lima getenforce |
| 195 | + lima cat /proc/filesystems |
| 196 | + lima bash -c "cd ~/work/uutils/ && bash util/run-gnu-test.sh \$(cat selinux-tests.txt)" |
| 197 | +
|
| 198 | + - name: Selinux - Run selinux tests as root |
| 199 | + run: | |
| 200 | + lima bash -c "cd ~/work/uutils/ && CI=1 bash util/run-gnu-test.sh run-root \$(cat selinux-tests.txt)" |
| 201 | +
|
134 | 202 | - name: Run GNU tests |
135 | 203 | shell: bash |
136 | 204 | run: | |
|
0 commit comments