build kernels on CI #9
Workflow file for this run
This file contains 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: Build and Push Images | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
permissions: | |
contents: read | |
packages: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.set-matrix.outputs.versions }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Read kernel versions from JSON | |
id: set-matrix | |
run: | | |
{ | |
echo "versions<<EOF" | |
cat versions.json | |
echo -e "\nEOF" | |
} >> "$GITHUB_OUTPUT" | |
build-and-push: | |
runs-on: ubuntu-latest | |
needs: setup-matrix | |
strategy: | |
matrix: | |
kernel_version: ${{ fromJSON(needs.setup-matrix.outputs.versions) }} | |
arch: | |
- "amd64" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Extract series | |
if: ${{ !contains(matrix.kernel_version, '-rc') }} | |
run: | | |
SERIES="$(echo "${{ matrix.kernel_version }}" | cut -d . -f 1-2)" | |
echo "SERIES=$SERIES" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
./make.sh ${{ matrix.kernel_version }} ${{ matrix.arch }} vmlinux --tag "ghcr.io/${{ github.repository_owner }}/ci-kernels:${{ matrix.kernel_version }}" | |
- name: Build selftests | |
if: matrix.arch == 'amd64' | |
run: | | |
./make.sh ${{ matrix.kernel_version }} ${{ matrix.arch }} selftests-bpf --tag "ghcr.io/${{ github.repository_owner }}/ci-kernels:selftests-${{ matrix.kernel_version }}" | |
- name: Build with series tag | |
if: env.SERIES != '' | |
run: | | |
./make.sh ${{ matrix.kernel_version }} ${{ matrix.arch }} vmlinux --tag "ghcr.io/${{ github.repository_owner }}/ci-kernels:${{ env.SERIES }}" | |
- name: Build selftests with series tag | |
if: env.SERIES != '' && matrix.arch == 'amd64' | |
run: | | |
./make.sh ${{ matrix.kernel_version }} ${{ matrix.arch }} selftests-bpf --tag "ghcr.io/${{ github.repository_owner }}/ci-kernels:selftests-${{ env.SERIES }}" | |
- name: Log in to GitHub Container Registry | |
if: github.ref == 'refs/heads/master' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push | |
if: github.ref == 'refs/heads/master' | |
run: | | |
docker push "ghcr.io/${{ github.repository_owner }}/ci-kernels:${{ matrix.kernel_version }}" | |
docker push "ghcr.io/${{ github.repository_owner }}/ci-kernels:selftests-${{ matrix.kernel_version }}" | |
- name: Push selftests | |
if: github.ref == 'refs/heads/master' && matrix.arch == 'amd64' | |
run: | | |
docker push "ghcr.io/${{ github.repository_owner }}/ci-kernels:selftests-${{ matrix.kernel_version }}" | |
- name: Push with series tag | |
if: github.ref == 'refs/heads/master' && env.SERIES != '' | |
run: | | |
docker push "ghcr.io/${{ github.repository_owner }}/ci-kernels:${{ env.SERIES }}" | |
- name: Push selftests with series tag | |
if: github.ref == 'refs/heads/master' && env.SERIES != '' && matrix.arch == 'amd64' | |
run: | | |
docker push "ghcr.io/${{ github.repository_owner }}/ci-kernels:selftests-${{ env.SERIES }}" | |
build-arm64: | |
runs-on: ubuntu-latest | |
needs: setup-matrix | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build | |
run: | | |
./make.sh ${{ matrix.kernel_version }} arm64 vmlinux |