From 2bfea0cc96ef2e4ac8a3293d33b9e16833af4c44 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sun, 15 Dec 2019 13:31:32 -0500 Subject: [PATCH] Github Actions uploads built artifacts (#83) * build: put artifacts into dist/. workflow: upload contents of dist/. * review feedback * CI workflow: add comment explaining artifact name * checkout action to v1 * typo fix --- .github/workflows/main.yml | 5 +++++ Makefile | 5 +++-- deb_from_installation.sh | 11 +++++++++-- tar_from_installation.sh | 14 ++++++++++---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 839ee58..bb39b9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,3 +40,8 @@ jobs: - run: sudo make -j4 package shell: bash name: Build + - uses: actions/upload-artifact@v1 + with: + # Upload the dist folder. Give it a name according to the OS it was built for. + name: ${{ format( 'dist-{0}.tgz', matrix.os) }} + path: dist diff --git a/Makefile b/Makefile index f09a901..e800939 100644 --- a/Makefile +++ b/Makefile @@ -152,8 +152,9 @@ strip: build/llvm.BUILT package: build/package.BUILT build/package.BUILT: build strip - command -v dpkg-deb >/dev/null && ./deb_from_installation.sh || true - ./tar_from_installation.sh + mkdir -p dist + command -v dpkg-deb >/dev/null && ./deb_from_installation.sh $(shell pwd)/dist || true + ./tar_from_installation.sh $(shell pwd)/dist touch build/package.BUILT .PHONY: default clean build strip package diff --git a/deb_from_installation.sh b/deb_from_installation.sh index a1c1b6b..5858306 100755 --- a/deb_from_installation.sh +++ b/deb_from_installation.sh @@ -1,9 +1,15 @@ #!/usr/bin/env sh set -ex if [ -n "$1" ]; then - export VERSION="$1" + OUTDIR=$1 else - export VERSION=`./version.sh` + OUTDIR=$PWD/dist +fi + +if [ -n "$2" ]; then + VERSION="$2" +else + VERSION=`./version.sh` fi rm -rf build/pkg @@ -12,3 +18,4 @@ mkdir -p build/pkg/DEBIAN sed -e s/VERSION/$VERSION/ wasi-sdk.control > build/pkg/DEBIAN/control cp -R /opt/wasi-sdk build/pkg/opt/ cd build && dpkg-deb -b pkg wasi-sdk_$VERSION\_amd64.deb +mv build/wasi-sdk_$VERSION\amd64.deb $OUTDIR/ diff --git a/tar_from_installation.sh b/tar_from_installation.sh index dc8dae5..2ac2179 100755 --- a/tar_from_installation.sh +++ b/tar_from_installation.sh @@ -1,7 +1,13 @@ #!/usr/bin/env bash set -ex if [ -n "$1" ]; then - VERSION="$1" + OUTDIR=$1 +else + OUTDIR=$PWD/dist +fi + +if [ -n "$2" ]; then + VERSION="$2" else VERSION=`./version.sh` fi @@ -19,10 +25,10 @@ esac rm -rf $PKGDIR cp -R /opt/wasi-sdk $PKGDIR cd build -tar czf wasi-sdk-$VERSION\-$MACHINE.tar.gz wasi-sdk-$VERSION +tar czf $OUTDIR/wasi-sdk-$VERSION\-$MACHINE.tar.gz wasi-sdk-$VERSION # As well as the full SDK package, also create archives of libclang_rt.builtins # and the sysroot. These are made available for users who have an existing clang # installation. -tar czf libclang_rt.builtins-wasm32-wasi-$VERSION.tar.gz -C compiler-rt lib/wasi -tar czf wasi-sysroot-$VERSION.tar.gz -C wasi-sdk-$VERSION/share wasi-sysroot +tar czf $OUTDIR/libclang_rt.builtins-wasm32-wasi-$VERSION.tar.gz -C compiler-rt lib/wasi +tar czf $OUTDIR/wasi-sysroot-$VERSION.tar.gz -C wasi-sdk-$VERSION/share wasi-sysroot