test: add e2e test #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: e2e | |
| # triggered by labeled PR | |
| on: | |
| pull_request: | |
| types: [ labeled ] | |
| jobs: | |
| test: | |
| if: ${{ github.event.label.name == 'e2e' }} | |
| strategy: | |
| matrix: | |
| # os: [ubuntu-latest, ubuntu-24.04-arm] | |
| os: [ubuntu-latest] | |
| # distro: [fedora-41, fedora-42, fedora-r43, centos-stream-9, centos-stream-10] | |
| distro: [centos-stream-10] | |
| runs-on: ${{ matrix.os }} | |
| # Required to push container image to ghcr.io | |
| # https://github.com/orgs/community/discussions/57724 | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build bootc RPM | |
| env: | |
| DISTRO: ${{ matrix.distro }} | |
| BUILD_IMAGE: quay.io/fedora/fedora:42 | |
| run: | | |
| podman run \ | |
| --rm \ | |
| --privileged \ | |
| -v $(pwd):/workdir:z \ | |
| -e DISTRO=$DISTRO \ | |
| --workdir /workdir \ | |
| $BUILD_IMAGE \ | |
| contrib/scripts/mock_build.sh | |
| - name: Re-build bootc image with new bootc PRM | |
| env: | |
| DISTRO: ${{ matrix.distro }} | |
| PR_NUMBER: ${{ github.event.number }} | |
| run: | | |
| set -xeu | |
| if [[ $DISTRO =~ fedora ]]; then | |
| VERSION_ID=$(cut -d'-' -f2 <<<"$DISTRO") | |
| BASE_IMAGE="quay.io/fedora/fedora-bootc:${VERSION_ID}" | |
| fi | |
| if [[ $DISTRO =~ centos ]]; then | |
| VERSION_ID=$(cut -d'-' -f3 <<<"$DISTRO") | |
| BASE_IMAGE="quay.io/centos-bootc/centos-bootc:stream${VERSION_ID}" | |
| fi | |
| tee target/build/Containerfile >/dev/null <<CONTAINERFILEEOF | |
| FROM $BASE_IMAGE | |
| RUN dnf -y upgrade /rpms/*.rpm && dnf -y clean all && rm -rf /var/cache /var/lib/dnf | |
| CONTAINERFILEEOF | |
| cat target/build/Containerfile | |
| IMAGE_NAME="bootc-image:PR-${PR_NUMBER}-${DISTRO}-$(uname -m)" | |
| podman build -v "$(pwd)/target/build/":/rpms:z -t $IMAGE_NAME target/build | |
| podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
| podman push $IMAGE_NAME "docker://ghcr.io/bootc-dev/$IMAGE_NAME" |