Skip to content

Commit bf2e4a8

Browse files
author
jsf9k
committed
# Conflicts: # .github/workflows/build.yml
2 parents 406169b + be68cb2 commit bf2e4a8

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/workflows/build.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,116 @@ jobs:
172172
- name: Setup tmate debug session
173173
uses: mxschmitt/action-tmate@v3
174174
if: env.RUN_TMATE
175+
<<<<<<< HEAD
176+
=======
177+
test:
178+
name: >-
179+
test (${{ matrix.scenario }}) -
180+
${{ matrix.platform }}-${{ matrix.architecture }}
181+
needs:
182+
- diagnostics
183+
permissions:
184+
# actions/checkout needs this to fetch code
185+
contents: read
186+
runs-on: ubuntu-${{ startsWith(matrix.architecture, 'arm') && '24.04-arm' || 'latest' }}
187+
strategy:
188+
fail-fast: false
189+
matrix:
190+
architecture:
191+
- amd64
192+
- arm64
193+
platform:
194+
- amazonlinux2023-systemd
195+
- debian10-systemd
196+
- debian11-systemd
197+
- debian12-systemd
198+
- debian13-systemd
199+
- fedora39-systemd
200+
- fedora40-systemd
201+
- fedora41-systemd
202+
- kali-systemd
203+
- ubuntu-20-systemd
204+
- ubuntu-22-systemd
205+
- ubuntu-24-systemd
206+
scenario:
207+
- default
208+
steps:
209+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
210+
with:
211+
# Uses the organization variable unless overridden
212+
config: ${{ vars.ACTIONS_PERMISSIONS_CONFIG }}
213+
- id: harden-runner
214+
name: Harden the runner
215+
uses: step-security/harden-runner@v2
216+
with:
217+
egress-policy: audit
218+
- id: setup-env
219+
uses: cisagov/setup-env-github-action@develop
220+
- uses: actions/checkout@v4
221+
- id: setup-python
222+
uses: actions/setup-python@v5
223+
with:
224+
python-version: ${{ steps.setup-env.outputs.python-version }}
225+
- uses: actions/cache@v4
226+
env:
227+
BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
228+
py${{ steps.setup-python.outputs.python-version }}-"
229+
with:
230+
path: ${{ env.PIP_CACHE_DIR }}
231+
key: "${{ env.BASE_CACHE_KEY }}\
232+
${{ hashFiles('**/requirements-test.txt') }}-\
233+
${{ hashFiles('**/requirements.txt') }}"
234+
restore-keys: |
235+
${{ env.BASE_CACHE_KEY }}
236+
- name: Install dependencies
237+
run: |
238+
python -m pip install --upgrade pip
239+
pip install --upgrade --requirement requirements-test.txt
240+
- name: Set up QEMU
241+
uses: docker/setup-qemu-action@v3
242+
- name: Set up Docker Buildx
243+
uses: docker/setup-buildx-action@v3
244+
# Disabling the unix-chkpwd AppArmor profile is necessary when
245+
# running Molecule tests against Fedora 40 and 41; otherwise,
246+
# the privileged container cannot successfully run sudo and
247+
# hence Ansible is unable to do anything. See
248+
# fedora-cloud/docker-brew-fedora#117 for more details.
249+
#
250+
# Purging firefox is currently necessary because the
251+
# installation available on the GitHub runner instance provides
252+
# two conflicting AppArmor profiles:
253+
# /etc/apparmor.d/usr.bin.firefox and /etc/apparmor.d/firefox.
254+
# This conflict causes the aa-disable /usr/sbin/unix_chkpwd
255+
# command to fail.
256+
#
257+
# Purging passt is currently necessary because the installation
258+
# available on the GitHub runner instance contains a wonky
259+
# AppArmor file (/etc/apparmor.d/abstractions/passt) that causes
260+
# the aa-disable command to fail.
261+
#
262+
# TODO: Remove the apt-get purge and systemctl reload commands
263+
# when possible. See cisagov/skeleton-ansible-role#215 for more
264+
# details.
265+
- name: Disable unix-chkpwd AppArmor profile
266+
run: |
267+
sudo apt-get purge firefox passt
268+
sudo systemctl reload apparmor.service
269+
sudo apt-get install apparmor-utils
270+
sudo aa-disable /usr/sbin/unix_chkpwd
271+
if: ${{ startsWith(matrix.platform, 'fedora') }}
272+
- name: Run molecule tests
273+
run: >-
274+
molecule test
275+
--platform-name ${{ matrix.platform }}-${{ matrix.architecture }}
276+
--scenario-name ${{ matrix.scenario }}
277+
# TODO: Remove the apt-get install command when possible. See
278+
# cisagov/skeleton-ansible-role#215 for more details.
279+
- name: Re-enable unix-chkpwd AppArmor profile
280+
run: |
281+
sudo aa-enforce /usr/sbin/unix_chkpwd
282+
sudo apt-get install firefox passt
283+
if: ${{ startsWith(matrix.platform, 'fedora') }}
284+
- name: Setup tmate debug session
285+
uses: mxschmitt/action-tmate@v3
286+
if: env.RUN_TMATE
287+
>>>>>>> be68cb2505df92d0e66f832e9bbe4ccd884fb628

0 commit comments

Comments
 (0)