diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..31de0cc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + push: + branches: + - 'main' + - 'feature/**' + pull_request: + workflow_dispatch: + +jobs: + build: + name: Toolchain build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install dependencies + run: sudo ./install-deps + + - name: Build + run: ./build-toolchain + + - name: Package + run: | + cd ./INSTALL + zip -r9 ../linux.zip . + cd ../INSTALL-WIN + zip -r9X ../win32.zip . + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: tricore-gcc-artifacts + path: ./*.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6f14d68 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + name: Publish Release artifacts + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Extract commit SHA + shell: bash + run: | + echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" + + - name: Download artifacts from latest workflow + uses: dawidd6/action-download-artifact@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: build.yml + branch: ${{ github.event.release.target_commitish }} + workflow_conclusion: success + skip_unpack: false + + - name: Rename build artifacts + run: | + mv tricore-gcc-artifacts/linux.zip tricore-gcc-11.3.1-${{ env.SHORT_SHA }}-linux.zip + mv tricore-gcc-artifacts/win32.zip tricore-gcc-11.3.1-${{ env.SHORT_SHA }}-win32.zip + + - name: Push release artifacts + uses: softprops/action-gh-release@v2 + with: + files: | + *.zip \ No newline at end of file diff --git a/install-deps b/install-deps new file mode 100755 index 0000000..12d3621 --- /dev/null +++ b/install-deps @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +if [ ! -f /etc/lsb_release ] && [ ! -f /etc/debian_version ] +then + echo "Script is meant to install packages on Debian/Ubuntu based distributions" + echo "Pleas install dependencies manually on other distributions" + exit 1 +fi + +apt-get update +apt-get -y install build-essential build-essential gcc-mingw-w64 g++-mingw-w64 texinfo flex bison libmpfr-dev libgmp-dev libmpc-dev zip \ No newline at end of file