diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..748595c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,201 @@ +# +# Copyright (C) 2023 AuxXxilium and Ing +# +# This is free software, licensed under the MIT License. +# See /LICENSE for more information. +# + +# version: [ 7.1, 7.2 ] +# platform: [ apollolake, broadwell, broadwellnk, denverton, epyc7002, geminilake, purley, r1000, v1000 ] +# exclude: +# - version: 7.1 +# platform: broadwell +# include: +# - version: "7.2" +# platform: "broadwell" + +name: Build Prebuilts + +on: + workflow_dispatch: + inputs: + version: + description: "format %y.%-m.$i or auto" + required: false + type: string + prerelease: + description: "pre release" + default: false + type: boolean + firmware: + description: "firmware" + default: false + type: boolean + +jobs: + build: + strategy: + matrix: + include: + - version: 7.2 + platform: epyc7002 + parm: "5.10.55" + + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@main + + - name: Init Env + run: | + git config --global user.email "info@auxxxilium.tech" + git config --global user.name "AuxXxilium" + sudo timedatectl set-timezone "Europe/Berlin" + + - name: Tar to Artifacts + run: | + if [ ! -d "${{ github.workspace }}/source/output" ]; then + mkdir -p "${{ github.workspace }}/source/output" + chmod a+rw -R "${{ github.workspace }}/source/output" + fi + + if [ "${{ matrix.platform }}" = "epyc7002" ]; then + MODULES_PATH="${{ github.workspace }}/modules/${{ matrix.platform }}-${{ matrix.version }}-${{ matrix.parm }}" + else + MODULES_PATH="${{ github.workspace }}/modules/${{ matrix.platform }}-${{ matrix.parm }}" + fi + + echo "copy 3rd modules" + [ -d "${MODULES_PATH}" ] && cp -Rvf "${MODULES_PATH}/." "${{ github.workspace }}/source/output" + + if [ "${{ matrix.platform }}" = "epyc7002" ]; then + tar caf ${{ github.workspace }}/source/${{ matrix.platform }}-${{ matrix.version }}-${{ matrix.parm }}.tgz -C ${{ github.workspace }}/source/output . + else + tar caf ${{ github.workspace }}/source/${{ matrix.platform }}-${{ matrix.parm }}.tgz -C ${{ github.workspace }}/source/output . + fi + + echo "add kernel" + tar caf ${{ github.workspace }}/source/kernel.tgz -C ${{ github.workspace }}/bzImage . + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: prebuilts + path: | + ${{ github.workspace }}/source/*.tgz + + firmware: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@main + + - name: Download from Artifacts + uses: actions/download-artifact@v3 + with: + name: prebuilts + path: ./prebuilts + + - name: Firmware + run: | + mkdir -p firmware + + echo "copy 3rd modules" + MODULES_PATH="${{ github.workspace }}/modules/firmware" + cp -rf ${MODULES_PATH}/* firmware/ + + if [ "${{ inputs.firmware }}" == "true" ]; then + echo "extract all modules" + for F in ./modules/*.tgz; do mkdir "${F%.tgz}" && tar -xzf "${F}" -C "${F%.tgz}"; done + + echo "get firmware" + SOURCE=/tmp/linux-firmware + git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git ${SOURCE} + while read -r L; do + if [ -e "${SOURCE}/${L}" ]; then + mkdir -p "`dirname firmware/${L}`" + cp "${SOURCE}/${L}" "firmware/${L}" + else + [ -e "firmware/${L}" ] && echo "Used modules ${L}" || echo "Missing ${L}" + fi + done < <(find ./modules -name \*.ko -exec sh -c '/sbin/modinfo {} | grep ^firmware' \; | awk '{print $2}') + fi + + tar caf firmware.tgz -C firmware . + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: prebuilts + path: | + firmware.tgz + + release: + runs-on: ubuntu-latest + needs: firmware + steps: + - name: Checkout + uses: actions/checkout@main + with: + fetch-depth: 0 + + - name: Changelog + uses: Bullrich/generate-release-changelog@master + id: Changelog + env: + REPO: ${{ github.repository }} + + - name: Init Env + run: | + git config --global user.email "info@auxxxilium.tech" + git config --global user.name "AuxXxilium" + sudo timedatectl set-timezone "Europe/Berlin" + + - name: Download from Artifacts + uses: actions/download-artifact@v3 + with: + name: prebuilts + path: ./prebuilts + + - name: Calculate Version + run: | + # Calculate Version + VERSION="" + if [ -n "${{ inputs.version }}" ]; then + VERSION="${{ inputs.version }}" + else + LATEST_TAG="`curl -skL "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r ".tag_name" 2>/dev/null`" + if [[ -n "${LATEST_TAG}" && "`echo ${LATEST_TAG} | cut -d '.' -f 1,2`" = "`date +'%y.%-m.%-d'`" ]]; then # format %y.%-m.$i + VERSION="`echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.'`" + else + VERSION="`date +'%y.%-m.%-d'`" + fi + fi + + if [ -n "${VERSION}" ]; then + # Modify Source File + echo "Version: ${VERSION}" + echo "${VERSION}" >VERSION + echo "${VERSION}" >"./prebuilts/VERSION" + echo "VERSION=${VERSION}" >> $GITHUB_ENV + fi + + - name: Zip Modules + if: env.VERSION != '' + run: | + zip -9 prebuilts.zip -j prebuilts/* + + - name: Release + uses: softprops/action-gh-release@v1 + if: env.VERSION != '' + with: + tag_name: ${{ env.VERSION }} + prerelease: ${{ inputs.prerelease }} + body: | + ${{ steps.Changelog.outputs.changelog }} + files: | + prebuilts.zip + ./prebuilts/*.tgz \ No newline at end of file