Skip to content

Commit

Permalink
feat: Add buildtools
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnt2910 committed Mar 25, 2023
1 parent 2e0d9cf commit c26f0b8
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/buildtools.yml
Original file line number Diff line number Diff line change
@@ -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"

This comment has been minimized.

Copy link
@korli

korli Mar 30, 2023

This should use GITHUB_API_URL and GITHUB_REPOSITORY

This comment has been minimized.

Copy link
@trungnt2910

trungnt2910 Mar 30, 2023

Author Contributor

Thanks for your suggestion, I have fixed this issue.

- 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

0 comments on commit c26f0b8

Please sign in to comment.