Build #354
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
name: Build | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GEAR_NODE_PATH: ./gear | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Artifact cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Remove binaries from cache | |
run: rm -vfr target/wasm32-unknown-unknown/* | |
- name: Check fmt | |
run: make fmt | |
- name: Run linter | |
run: make lint | |
- name: Run tests | |
run: | | |
curl https://get.gear.rs/gear-v1.0.2-x86_64-unknown-linux-gnu.tar.xz | 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: | |
tag_name: build | |
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/** |