Skip to content

Commit

Permalink
[CI] Add GitHub release and deploy flow
Browse files Browse the repository at this point in the history
  • Loading branch information
huettern committed Jan 14, 2022
1 parent a9d462a commit e005382
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/release.yml
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

0 comments on commit e005382

Please sign in to comment.