ci(github): split build job to build and then tests job.

This commit is contained in:
Alexandre Pujol 2024-10-21 21:12:46 +01:00
parent a65ebc42b2
commit 1efb50e67e
Failed to generate hash of commit

View file

@ -9,10 +9,10 @@ jobs:
matrix: matrix:
os: os:
- ubuntu-24.04 - ubuntu-24.04
# - ubuntu-22.04 - ubuntu-22.04
mode: mode:
- default - default
# - full-system-policy - full-system-policy
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -30,12 +30,10 @@ jobs:
if [[ ${{ matrix.mode }} == full-system-policy ]]; then if [[ ${{ matrix.mode }} == full-system-policy ]]; then
echo -e "\noverride_dh_auto_build:\n\tmake full" >> debian/rules echo -e "\noverride_dh_auto_build:\n\tmake full" >> debian/rules
fi fi
VERSION="0.$(git rev-list --count HEAD)-1" bash dists/build.sh dpkg
dch --newversion="$VERSION" --urgency=medium --distribution=stable --controlmaint "Release $VERSION"
dpkg-buildpackage -b -d --no-sign
- name: Install apparmor.d - name: Install apparmor.d
run: sudo dpkg --install ../apparmor.d_*_amd64.deb || true run: sudo dpkg --install .pkg/apparmor.d_*_amd64.deb || true
- name: Reload AppArmor - name: Reload AppArmor
run: | run: |
@ -56,14 +54,45 @@ jobs:
- name: Show Number of loaded profile - name: Show Number of loaded profile
run: sudo aa-status --profiled run: sudo aa-status --profiled
- name: Install Tests dependencies - name: Cache the build package
if: matrix.mode == 'default' && matrix.os == 'ubuntu-24.04' if: matrix.mode == 'default' && matrix.os == 'ubuntu-24.04'
uses: actions/cache/save@v4
with:
path: .pkg/apparmor.d_*_amd64.deb
key: ${{ matrix.os }}-${{ matrix.mode }}-${{ hashFiles('.pkg/apparmor.d_*_amd64.deb') }}
tests:
runs-on: ubuntu-24.04
needs: build
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Restore the cached build package
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
path: .pkg/apparmor.d_*_amd64.deb
key: ubuntu-24.04-default-${{ hashFiles('.pkg/apparmor.d_*_amd64.deb') }}
restore-keys: |
ubuntu-24.04-default-
- name: Install Tests dependencies
run: | run: |
sudo apt-get update -q sudo apt-get update -q
sudo apt-get install -y \ sudo apt-get install -y \
apparmor-profiles apparmor-utils \
bats bats-support bats bats-support
- name: Install apparmor.d
run: |
sudo dpkg --install .pkg/apparmor.d_*_amd64.deb || true
sudo systemctl restart apparmor.service
- name: Run the bats integration tests - name: Run the bats integration tests
if: matrix.mode == 'default' && matrix.os == 'ubuntu-24.04'
run: | run: |
make bats make bats
- name: Show final AppArmor logs
run: |
sudo aa-log -s