From c26f0b873c554c7fe8f6359e3b22bc58d8294ca2 Mon Sep 17 00:00:00 2001 From: Trung Nguyen <57174311+trungnt2910@users.noreply.github.com> Date: Sat, 25 Mar 2023 23:39:04 +1100 Subject: [PATCH] feat: Add buildtools --- .github/workflows/buildtools.yml | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/buildtools.yml diff --git a/.github/workflows/buildtools.yml b/.github/workflows/buildtools.yml new file mode 100644 index 0000000..ef012a0 --- /dev/null +++ b/.github/workflows/buildtools.yml @@ -0,0 +1,54 @@ +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + push: + branches: + - master + +permissions: + contents: write + +env: + HAIKU_ARCH: x86_64 + +jobs: + build_cross_tools: + runs-on: ubuntu-latest + steps: + - name: Check latest Haiku buildtools btrev + id: get_btrev + run: | + echo "btrev=$(curl -s https://git.haiku-os.org/buildtools/refs/tags | sed -n 's/^.*>\(btrev[^<]*\).*$/\1/p' | head -n 1)" >> "$GITHUB_OUTPUT" + - name: Check latest buildtools release + id: get_buildtools + run: | + echo "btrev=$(curl -s https://api.github.com/repos/trungnt2910/haiku-tools/releases | sed -n 's/^.*"html_url": ".*releases\/tag\/buildtools-${{ env.HAIKU_ARCH }}-\([^"]*\)".*$/\1/p' | head -n 1)" >> "$GITHUB_OUTPUT" + - name: Build buildtools + if: steps.get_btrev.outputs.btrev != steps.get_buildtools.outputs.btrev + run: | + echo "Building buildtools at ${{ steps.get_btrev.outputs.btrev }}" + git clone https://review.haiku-os.org/haiku --depth 1 + git clone https://review.haiku-os.org/buildtools --depth 1 + sudo apt install -y git nasm bc autoconf automake texinfo flex bison gawk build-essential unzip wget zip less zlib1g-dev libzstd-dev xorriso libtool python3 attr + cd haiku + mkdir generated.${{ env.HAIKU_ARCH }}; cd generated.${{ env.HAIKU_ARCH }} + ../configure --cross-tools-source ../../buildtools --build-cross-tools ${{ env.HAIKU_ARCH }} -j$(nproc) + cd cross-tools-${{ env.HAIKU_ARCH }} + zip -r ../../../x86_64-linux-buildtools-${{ env.HAIKU_ARCH }}-${{ steps.get_btrev.outputs.btrev }}.zip * + - name: Upload artifacts + if: steps.get_btrev.outputs.btrev != steps.get_buildtools.outputs.btrev + uses: actions/upload-artifact@v3 + with: + name: x86_64-linux-buildtools-${{ env.HAIKU_ARCH }}-${{ steps.get_btrev.outputs.btrev }} + path: x86_64-linux-buildtools-${{ env.HAIKU_ARCH }}-${{ steps.get_btrev.outputs.btrev }}.zip + - name: Create release + if: steps.get_btrev.outputs.btrev != steps.get_buildtools.outputs.btrev + id: create-release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: buildtools-${{ env.HAIKU_ARCH }}-${{ steps.get_btrev.outputs.btrev }} + prerelease: false + title: Cross compiler for ${{ env.HAIKU_ARCH }} Haiku ${{ steps.get_btrev.outputs.btrev }} + files: x86_64-linux-buildtools-${{ env.HAIKU_ARCH }}-${{ steps.get_btrev.outputs.btrev }}.zip \ No newline at end of file