From 9fbda544235756c36311eb583873cc1965d586ad Mon Sep 17 00:00:00 2001 From: Domenico Iezzi Date: Tue, 23 Jul 2024 13:24:41 +0200 Subject: [PATCH] Add github action configuration --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 21 ++++++++++++++++++ install-deps | 13 ++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml create mode 100755 install-deps diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..57b5495 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: push + +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: Extract commit SHA + shell: bash + run: | + echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" + echo $SHORT_SHA + + - name: Package + run: | + cd ./INSTALL + zip -r9 ../tricore-gcc-11.3.1-${{ env.SHORT_SHA }}-linux.zip . + cd ../INSTALL-WIN + zip -r9X ../tricore-gcc-11.3.1-${{ env.SHORT_SHA }}-win32.zip . + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + name: Toolchain packages + path: ./*.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9d9775b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + name: Publish Release artifacts + runs-on: ubuntu-latest + + steps: + - 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 \ 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