forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Add GitHub release and deploy flow
- Loading branch information
Showing
1 changed file
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |