diff --git a/.github/workflows/kernel-check.yaml b/.github/workflows/kernel-check.yaml new file mode 100644 index 00000000..36224ca3 --- /dev/null +++ b/.github/workflows/kernel-check.yaml @@ -0,0 +1,64 @@ +name: Check Dahdi compilation against a kernel + +on: + workflow_call: + inputs: + kernel-git-cache: + description: 'The name of the cache for the kernel git repo' + required: true + type: string + kernel-git-repo: + description: 'The URL for the kernel git repo' + required: true + type: string + kernel-git-branch: + description: 'The branch to use' + type: string + +jobs: + kernel_test: + runs-on: ubuntu-latest + + steps: + - name: Cache kernel git repo + id: cache-kernel-git + uses: actions/cache@v3 + with: + path: ./linux + key: ${{ inputs.kernel-git-cache }} + + - if: ${{ steps.cache-kernel-git.outputs.cache-hit != 'true' }} + name: Clone Kernel repo + run: git clone ${{ inputs.kernel-git-repo }} + + - name: Update kernel git + run: git fetch + working-directory: ./linux + + - name: Switch to desired branch + run: git checkout ${{ inputs.kernel-git-branch }} + working-directory: ./linux + + - name: Fetch dahdi-linux + uses: actions/checkout@v3 + with: + path: dahdi-linux + + - name: Create build container + run: docker build ./ci -t dahdi-builder + working-directory: ./dahdi-linux + + - name: Build dahdi-linux + run: "docker run -v ${PWD}/dahdi-linux:/src -v ${PWD}/linux:/linux dahdi-builder" + + - name: Archive kernel version + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.kernel-git-branch }} Kernel Version + path: ./dahdi-linux/build_logs/kernel_version.txt + + - name: Archive build log + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.kernel-git-branch }} Build Log + path: ./dahdi-linux/build_logs/build_log.txt diff --git a/.github/workflows/kernel-lts.yaml b/.github/workflows/kernel-lts.yaml index 9c6d0781..78f6064e 100644 --- a/.github/workflows/kernel-lts.yaml +++ b/.github/workflows/kernel-lts.yaml @@ -20,35 +20,8 @@ jobs: 'linux-5.15.y', 'linux-6.1.y' ] - steps: - - name: Cache kernel git repo - id: cache-kernel-git - uses: actions/cache@v3 - with: - path: ./linux - key: kernel-git-cache - - - if: ${{ steps.cache-kernel-git.outputs.cache-hit != 'true' }} - name: Clone Kernel repo - run: git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git - - - name: Update kernel git - run: git fetch - working-directory: ./linux - - - name: Switch to desired branch - run: git checkout ${{matrix.kernel_branch}} - working-directory: ./linux - - - name: Fetch dahdi-linux - uses: actions/checkout@v3 - with: - path: dahdi-linux - - - name: Create build container - run: docker build ./ci -t dahdi-builder - working-directory: ./dahdi-linux - - - name: Build dahdi-linux - run: "docker run -v ${PWD}/dahdi-linux:/src -v ${PWD}/linux:/linux dahdi-builder" - + uses: duncanpatterson/dahdi-linux/.github/workflows/kernel-check.yaml@ci-fix + with: + kernel-git-cache: kernel-git-cache + kernel-git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git + kernel-git-branch: ${{ matrix.kernel_branch }} diff --git a/ci/Dockerfile b/ci/Dockerfile index 76059bb2..204277a3 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -3,5 +3,4 @@ RUN apt-get update RUN apt-get -y upgrade RUN apt-get -y install gcc make perl-modules RUN apt-get -y install flex bison wget libssl-dev libelf-dev bc -ENTRYPOINT [ "/usr/bin/bash" ] - +ENTRYPOINT [ "/src/ci/build-dahdi.sh" ] diff --git a/ci/build-dahdi.sh b/ci/build-dahdi.sh index 0b328c6a..5ac0c6a5 100755 --- a/ci/build-dahdi.sh +++ b/ci/build-dahdi.sh @@ -1,4 +1,6 @@ #!/bin/sh +rm -rf /src/build_logs +mkdir -p /src/build_logs cd /linux echo "### Cleaning Kernel tree" echo " # rm .config" @@ -7,7 +9,7 @@ rm .config echo " # make clean" make clean echo "### Get kernel version" -make kernelversion +make kernelversion > /src/build_logs/kernel_version.txt echo "### Create defconfig and prepare for module building" echo " # make x86_64_defconfig" make x86_64_defconfig @@ -19,5 +21,5 @@ cd /src echo " # make clean" make clean echo " # make install KSRC=/linux" -make install KSRC=/linux +make install KSRC=/linux 2>&1 | tee /src/build_logs/build_log.txt