|
| 1 | +# SPDX-License-Identifier: GPL-2.0 |
| 2 | +--- |
| 3 | +name: Fast Compatibility & Config Tests |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - '**' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - '**' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +env: |
| 15 | + REGISTRY: ghcr.io |
| 16 | + IMAGE_NAME: ${{ github.repository }}/kdevops-ci |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-kdevops-containers: |
| 20 | + name: Build kdevops Container (${{ matrix.base_image_name }}) |
| 21 | + runs-on: ubuntu-latest |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + packages: write |
| 25 | + outputs: |
| 26 | + debian-image: ${{ steps.set-outputs-debian.outputs.debian-image }} |
| 27 | + fedora-image: ${{ steps.set-outputs-fedora.outputs.fedora-image }} |
| 28 | + opensuse-image: ${{ steps.set-outputs-opensuse.outputs.opensuse-image }} |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + include: |
| 33 | + - base_image: debian:testing |
| 34 | + base_image_name: debian |
| 35 | + install_cmd: > |
| 36 | + apt update && apt-get install -y |
| 37 | + ansible-core |
| 38 | + bash |
| 39 | + bison |
| 40 | + coreutils |
| 41 | + flex |
| 42 | + gawk |
| 43 | + gcc |
| 44 | + git |
| 45 | + hostname |
| 46 | + libvirt-clients |
| 47 | + libvirt0 |
| 48 | + make |
| 49 | + ncurses-dev |
| 50 | + netcat-openbsd |
| 51 | + pkg-config |
| 52 | + python3 |
| 53 | + sudo |
| 54 | + traceroute |
| 55 | + which |
| 56 | + - base_image: fedora:latest |
| 57 | + base_image_name: fedora |
| 58 | + install_cmd: > |
| 59 | + dnf install -y |
| 60 | + ansible |
| 61 | + bash |
| 62 | + bison |
| 63 | + coreutils |
| 64 | + flex |
| 65 | + gawk |
| 66 | + gcc |
| 67 | + git |
| 68 | + hostname |
| 69 | + libvirt-client |
| 70 | + make |
| 71 | + ncurses-devel |
| 72 | + nmap-ncat |
| 73 | + pkgconf |
| 74 | + python3 |
| 75 | + sudo |
| 76 | + traceroute |
| 77 | + which |
| 78 | + - base_image: opensuse/tumbleweed |
| 79 | + base_image_name: opensuse |
| 80 | + install_cmd: > |
| 81 | + zypper refresh && zypper install -y |
| 82 | + ansible |
| 83 | + bash |
| 84 | + bison |
| 85 | + coreutils |
| 86 | + flex |
| 87 | + gawk |
| 88 | + gcc |
| 89 | + git |
| 90 | + hostname |
| 91 | + libvirt |
| 92 | + make |
| 93 | + ncurses-devel |
| 94 | + netcat-openbsd |
| 95 | + pkg-config |
| 96 | + python3 |
| 97 | + sudo |
| 98 | + traceroute |
| 99 | + which |
| 100 | + steps: |
| 101 | + - name: Checkout repository |
| 102 | + uses: actions/checkout@v4 |
| 103 | + |
| 104 | + - name: Log in to Container Registry |
| 105 | + uses: docker/login-action@v3 |
| 106 | + with: |
| 107 | + registry: ${{ env.REGISTRY }} |
| 108 | + username: ${{ github.actor }} |
| 109 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 110 | + |
| 111 | + - name: Create Dockerfile for ${{ matrix.base_image_name }} |
| 112 | + run: | |
| 113 | + cat > Dockerfile.${{ matrix.base_image_name }} << 'EOF' |
| 114 | + FROM ${{ matrix.base_image }} |
| 115 | + RUN ${{ matrix.install_cmd }} |
| 116 | + RUN git config --global --add safe.directory '*' && \ |
| 117 | + git config --global user.name "kdevops-ci" && \ |
| 118 | + git config --global user.email "[email protected]" |
| 119 | + RUN mkdir -p /github/home/.ssh && chmod 700 /github/home/.ssh |
| 120 | + ENV USER=kdevops-ci |
| 121 | + ENV HOME=/github/home |
| 122 | + WORKDIR /workspace |
| 123 | + EOF |
| 124 | +
|
| 125 | + - name: Build and test ${{ matrix.base_image_name }} container |
| 126 | + run: | |
| 127 | + IMAGE_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.base_image_name }}:${{ github.sha }}" |
| 128 | +
|
| 129 | + # Build container |
| 130 | + docker build -f Dockerfile.${{ matrix.base_image_name }} -t "$IMAGE_TAG" . |
| 131 | +
|
| 132 | + # Test basic functionality |
| 133 | + docker run --rm -v "$PWD:/workspace" "$IMAGE_TAG" sh -c " |
| 134 | + echo '🧪 Testing kdevops build in ${{ matrix.base_image_name }} container' |
| 135 | + make mrproper |
| 136 | + echo '✅ Basic kdevops build validation passed' |
| 137 | + " |
| 138 | +
|
| 139 | + # Push container |
| 140 | + docker push "$IMAGE_TAG" |
| 141 | +
|
| 142 | + - name: Set outputs for downstream jobs (debian only) |
| 143 | + id: set-outputs-debian |
| 144 | + if: matrix.base_image_name == 'debian' |
| 145 | + run: | |
| 146 | + ./scripts/github_output.sh debian-image "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-debian:${{ github.sha }}" |
| 147 | +
|
| 148 | + - name: Set outputs for downstream jobs (fedora only) |
| 149 | + id: set-outputs-fedora |
| 150 | + if: matrix.base_image_name == 'fedora' |
| 151 | + run: | |
| 152 | + ./scripts/github_output.sh fedora-image "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-fedora:${{ github.sha }}" |
| 153 | +
|
| 154 | + - name: Set outputs for downstream jobs (opensuse only) |
| 155 | + id: set-outputs-opensuse |
| 156 | + if: matrix.base_image_name == 'opensuse' |
| 157 | + run: | |
| 158 | + ./scripts/github_output.sh opensuse-image "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-opensuse:${{ github.sha }}" |
| 159 | +
|
| 160 | + linux-ab-config-tests: |
| 161 | + name: Linux A/B Tests (${{ matrix.distro_name }}) |
| 162 | + runs-on: ubuntu-latest |
| 163 | + needs: build-kdevops-containers |
| 164 | + strategy: |
| 165 | + fail-fast: false |
| 166 | + matrix: |
| 167 | + include: |
| 168 | + - distro_name: debian |
| 169 | + container_image: ${{ needs.build-kdevops-containers.outputs.debian-image }} |
| 170 | + - distro_name: fedora |
| 171 | + container_image: ${{ needs.build-kdevops-containers.outputs.fedora-image }} |
| 172 | + - distro_name: opensuse |
| 173 | + container_image: ${{ needs.build-kdevops-containers.outputs.opensuse-image }} |
| 174 | + container: ${{ matrix.container_image }} |
| 175 | + steps: |
| 176 | + - name: Checkout repository |
| 177 | + uses: actions/checkout@v4 |
| 178 | + |
| 179 | + - name: Run Linux A/B testing configuration validation |
| 180 | + run: | |
| 181 | + echo "🧪 Running comprehensive A/B configuration tests on ${{ matrix.distro_name }}..." |
| 182 | + echo "This validates all 3 build methods without requiring VMs" |
| 183 | + make check-linux-ab |
| 184 | +
|
| 185 | + - name: Validate A/B test results and generated files |
| 186 | + run: | |
| 187 | + echo "✅ All A/B configuration tests passed on ${{ matrix.distro_name }}!" |
| 188 | + echo "📋 Validated configurations:" |
| 189 | + echo " - Target build method A/B setup" |
| 190 | + echo " - 9P build method A/B setup" |
| 191 | + echo " - Builder method A/B setup" |
| 192 | + echo " - Kernel reference differentiation" |
| 193 | + echo " - Configuration file generation (.config, .extra_vars_auto.yaml, extra_vars.yaml)" |
| 194 | + echo " - Cross-distribution compatibility: ${{ matrix.distro_name }}" |
| 195 | +
|
| 196 | + quick-config-validation: |
| 197 | + name: Quick Config Tests (${{ matrix.defconfig }}) on ${{ matrix.distro_name }} |
| 198 | + runs-on: ubuntu-latest |
| 199 | + needs: build-kdevops-containers |
| 200 | + strategy: |
| 201 | + fail-fast: false |
| 202 | + matrix: |
| 203 | + defconfig: [blktests_nvme, xfs_reflink_4k, lbs-xfs, linux-ab-testing] |
| 204 | + distro_name: [debian, fedora, opensuse] |
| 205 | + include: |
| 206 | + - distro_name: debian |
| 207 | + container_image: ${{ needs.build-kdevops-containers.outputs.debian-image }} |
| 208 | + - distro_name: fedora |
| 209 | + container_image: ${{ needs.build-kdevops-containers.outputs.fedora-image }} |
| 210 | + - distro_name: opensuse |
| 211 | + container_image: ${{ needs.build-kdevops-containers.outputs.opensuse-image }} |
| 212 | + container: ${{ matrix.container_image }} |
| 213 | + steps: |
| 214 | + - name: Checkout repository |
| 215 | + uses: actions/checkout@v4 |
| 216 | + |
| 217 | + - name: Test defconfig-${{ matrix.defconfig }} configuration |
| 218 | + run: | |
| 219 | + echo "🔧 Testing defconfig-${{ matrix.defconfig }} configuration on ${{ matrix.distro_name }}..." |
| 220 | + make mrproper |
| 221 | + make defconfig-${{ matrix.defconfig }} |
| 222 | + echo "📁 Checking files after defconfig..." |
| 223 | + test -f .config || (echo "❌ .config not generated by defconfig" && exit 1) |
| 224 | + test -f .extra_vars_auto.yaml || (echo "❌ .extra_vars_auto.yaml not generated by defconfig" && exit 1) |
| 225 | + echo "✅ defconfig generated .config and .extra_vars_auto.yaml successfully" |
| 226 | +
|
| 227 | + - name: Generate configuration files (container-safe) |
| 228 | + run: | |
| 229 | + echo "🔨 Generating core configuration files without systemd services..." |
| 230 | + # Generate the essential files from DEFAULT_DEPS but skip LOCALHOST_SETUP_WORK (systemd) |
| 231 | + # This generates: .kdevops.depcheck, extra_vars.yaml, ansible.cfg, hosts |
| 232 | + make .kdevops.depcheck |
| 233 | + make extra_vars.yaml |
| 234 | + make $PWD/ansible.cfg |
| 235 | + make $PWD/hosts |
| 236 | + echo "✅ Core configuration files generated successfully" |
| 237 | +
|
| 238 | + - name: Verify all generated configuration files |
| 239 | + run: | |
| 240 | + echo "📁 Validating all generated configuration files..." |
| 241 | + test -f .config || (echo "❌ .config not found" && exit 1) |
| 242 | + test -f .extra_vars_auto.yaml || (echo "❌ .extra_vars_auto.yaml not found" && exit 1) |
| 243 | + test -f extra_vars.yaml || (echo "❌ extra_vars.yaml not generated by make" && exit 1) |
| 244 | + test -f .kdevops.depcheck || (echo "❌ .kdevops.depcheck not found" && exit 1) |
| 245 | + test -f ansible.cfg || (echo "❌ ansible.cfg not found" && exit 1) |
| 246 | + test -f hosts || (echo "❌ hosts not found" && exit 1) |
| 247 | + echo "✅ All required configuration files generated:" |
| 248 | + echo " - .config (kernel-style configuration)" |
| 249 | + echo " - .extra_vars_auto.yaml (auto-generated from defconfig)" |
| 250 | + echo " - extra_vars.yaml (final ansible variables from make)" |
| 251 | + echo " - .kdevops.depcheck (dependency verification)" |
| 252 | + echo " - ansible.cfg (ansible configuration)" |
| 253 | + echo " - hosts (inventory file)" |
0 commit comments