From e005382633d2a8b6309f7955fc4dd93fb7ef0d5f Mon Sep 17 00:00:00 2001 From: Noah Huetter Date: Mon, 10 Jan 2022 09:43:18 +0100 Subject: [PATCH] [CI] Add GitHub release and deploy flow --- .github/workflows/release.yml | 109 ++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000000..3df6623b6d1548 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,109 @@ +# Copyright 2022 ETH Zurich and University of Bologna. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +# Build toolchain on release +name: release +on: + release: + types: [created] + +jobs: + + release: + name: Build Release + strategy: + matrix: + os: + - ubuntu2004 + - centos7 + runs-on: ubuntu-20.04 + env: + BUGURL: https://github.com/pulp-platform/llvm-project/issues + BUILDNO: ${{ github.run_number }} + steps: + ######################################## + ## Checkout + ######################################## + + ## This + - + name: Checkout LLVM + uses: actions/checkout@v2 + with: + path: llvm-project + + ## NEWLIB + - + name: Checkout newlib + run: | + git clone --depth 1 -b newlib-3.3.0 https://sourceware.org/git/newlib-cygwin.git newlib + + ######################################## + ## Build docker container + ######################################## + - + name: Prepare Docker + uses: docker/build-push-action@v2 + with: + push: false + load: true + context: llvm-project/.github/docker + file: llvm-project/.github/docker/linux-${{ matrix.os }}.Dockerfile + tags: linux-${{ matrix.os }}:latest + + ######################################## + ## Build Info + ######################################## + - + name: Build Info + run: | + PKGVERS=riscv32-pulp-llvm-${{ matrix.os }}-${GITHUB_REF#refs/*/} + echo "PKGVERS=${PKGVERS}" >> $GITHUB_ENV + echo "BUGURL=${BUGURL}" + echo "PKGVERS=${PKGVERS}" + docker run -v $PWD:/home/builder -w/home/builder linux-${{ matrix.os }}:latest llvm-project/.github/scripts/builder-info.sh + cat build-info.txt + + ######################################## + ## Build + ######################################## + - + name: Build + run: | + docker run -v $PWD:/home/builder -w/home/builder \ + -e BUGURL=${BUGURL} \ + -e PKGVERS=${PKGVERS} \ + -e BUILDNO=${BUILDNO} \ + linux-${{ matrix.os }}:latest \ + llvm-project/.github/scripts/build-riscv32-llvm.sh + + ######################################## + ## Package + ######################################## + - + name: Package + run: | + echo "PKGVERS: ${PKGVERS}" + tar -czf ${PKGVERS}.tar.gz --transform s/^install/${PKGVERS}/ install + + ######################################## + ## Deploy + ######################################## + - name: Get Artifact Name + run: | + ARTIFACT_PATHNAME=${PKGVERS}.tar.gz + ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) + echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV + echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV + shell: bash + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ env.ARTIFACT_PATHNAME }} + asset_name: ${{ env.ARTIFACT_NAME }} + asset_content_type: application/tar.gz