Skip to content

Build

Build #63

Workflow file for this run

name: Build
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '0 0 * * *'
env:
CARGO_TERM_COLOR: always
GEAR_NODE_PATH: ./gear
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Artifact cache
uses: Swatinem/rust-cache@v2
- name: Remove binaries from cache
run: rm -vfr target/wasm32-unknown-unknown/*
- name: Pin toolchain
run: make init
- name: Check fmt
run: make fmt
- name: Run linter
run: make lint
- name: Run tests
run: |
curl -L https://get.gear.rs/vara-testnet-x86_64-unknown-linux-gnu.tar.xz -o - | tar xJ
make full-test
- name: Build
run: make build
- name: Upload artifacts
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
path: |
target/wasm32-unknown-unknown/*
*.meta.txt
upload:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Delete previous release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rename binaries
run: |
cd artifact/target/wasm32-unknown-unknown
for WASM in */*; do
BUILD_TYPE=${WASM%/*}
NAME=`basename $WASM`
if [[ $NAME == *.opt.wasm ]]; then
NAME=${NAME%.opt.wasm}
EXT=opt.wasm
elif [[ $NAME == *.meta.wasm ]]; then
NAME=${NAME%.meta.wasm}
EXT=meta.wasm
else
NAME=${NAME%.wasm}
EXT=wasm
fi
if [ $BUILD_TYPE == debug ]; then
mv $WASM $NAME.debug.$EXT
else
mv $WASM $NAME.$EXT
fi
done
- name: Upload
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
tag_name: build
draft: false
files: artifact/**