Reusable workflow compiler and misc docker images build #1
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: 'Compiler and misc docker images build' | |
on: | |
workflow_dispatch: | |
inputs: | |
GIT_REPO: | |
description: 'Repo (owner/repo)' | |
required: true | |
default: 'kernelci/kernelci-core' | |
GIT_BRANCH: | |
description: 'Branch' | |
required: true | |
default: 'main' | |
env: | |
USER_GIT_REPO: ${{ github.event.inputs.GIT_REPO }} | |
USER_GIT_BRANCH: ${{ github.event.inputs.GIT_BRANCH }} | |
jobs: | |
docker-compiler-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
kciarch: [ 'arc', 'arm', 'armv5', 'arm64', 'x86', 'mips', 'riscv64' ] | |
kcicmd: [ 'clang-15 kselftest kernelci', | |
'clang-17 kselftest kernelci', | |
'gcc-12 kselftest kernelci' | |
] | |
# only selected people can trigger this job | |
if: contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao"]', github.actor) | |
runs-on: ubuntu-22.04 | |
environment: deploydocker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.USER_GIT_REPO }} | |
ref: ${{ env.USER_GIT_BRANCH }} | |
submodules: recursive | |
fetch-depth: 0 | |
path: kernelci-core | |
- name: Prepare necessary tools | |
run: | | |
sudo apt-get update | |
sudo apt-get remove containerd.io | |
sudo apt-get install -y python3-pip git docker.io python3-docker | |
pip3 install --upgrade pip | |
cd kernelci-core | |
python3 -m pip install '.[dev]' | |
sudo cp -R config /etc/kernelci/ | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build base kernelci docker image for main branch | |
if: ${{ env.USER_GIT_BRANCH }} == 'main' | |
run: | | |
cd kernelci-core | |
export core_rev=$(git rev-parse HEAD) | |
export core_url=$(git remote get-url origin) | |
kci_arg="build --push --build-arg core_rev=$core_rev --prefix=ghcr.io/${{ github.actor }}/ --build-arg core_url=$core_url" | |
./kci docker $kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }} | |
- name: build base kernelci docker image for other branches | |
if: ${{ env.USER_GIT_BRANCH }} != 'main' | |
run: | | |
cd kernelci-core | |
export core_rev=$(git rev-parse HEAD) | |
export core_url=$(git remote get-url origin) | |
kci_arg="build --push --build-arg core_rev=$core_rev --prefix=ghcr.io/staging-${{ github.actor }}/ --build-arg core_url=$core_url" | |
./kci docker $kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }} | |
docker-misc-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
kcicmd: [ 'gcc-12 kunit kernelci --arch x86', | |
'rustc-1.74 kselftest kernelci --arch x86', | |
'rustc-1.75 kselftest kernelci --arch x86', | |
'kernelci', | |
'k8s kernelci', | |
'qemu', | |
] | |
# only selected people can trigger this job | |
if: contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao"]', github.actor) | |
runs-on: ubuntu-22.04 | |
environment: deploydocker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.USER_GIT_REPO }} | |
ref: ${{ env.USER_GIT_BRANCH }} | |
submodules: recursive | |
fetch-depth: 0 | |
path: kernelci-core | |
- name: Prepare necessary tools | |
run: | | |
sudo apt-get update | |
sudo apt-get remove containerd.io | |
sudo apt-get install -y python3-pip git docker.io python3-docker | |
pip3 install --upgrade pip | |
cd kernelci-core | |
python3 -m pip install '.[dev]' | |
sudo cp -R config /etc/kernelci/ | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build base kernelci docker image for main branch | |
if: ${{ env.USER_GIT_BRANCH }} == 'main' | |
run: | | |
cd kernelci-core | |
export core_rev=$(git rev-parse HEAD) | |
export core_url=$(git remote get-url origin) | |
kci_arg="build --push --build-arg core_rev=$core_rev --prefix=ghcr.io/${{ github.actor }}/ --build-arg core_url=$core_url" | |
./kci docker $kci_arg ${{ matrix.kcicmd }} | |
- name: build base kernelci docker image for other branches | |
if: ${{ env.USER_GIT_BRANCH }} != 'main' | |
run: | | |
cd kernelci-core | |
export core_rev=$(git rev-parse HEAD) | |
export core_url=$(git remote get-url origin) | |
kci_arg="build --push --build-arg core_rev=$core_rev --prefix=ghcr.io/staging-${{ github.actor }}/ --build-arg core_url=$core_url" | |
./kci docker $kci_arg ${{ matrix.kcicmd }} | |