Skip to content

Commit

Permalink
Add readme ci (#116)
Browse files Browse the repository at this point in the history
feat: add README CI
  • Loading branch information
idea404 authored Aug 11, 2022
1 parent 605b53e commit dca9bf2
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/scripts/readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
echo ==== Quick Deploy ====
TEXT=$(printf 'y\n' | near dev-deploy --wasmFile res/status_message.wasm --helperUrl https://near-contract-helper.onrender.com)
if [[ ! "$TEXT" =~ .*"Done deploying to".* ]]; then
echo -e "\033[0;31m FAIL \033[0m"
exit 1
else
echo -e "\033[0;32m SUCCESS \033[0m"
fi

echo ==== Set dev account env variable ====
source neardev/dev-account.env
TEXT=$(echo $CONTRACT_NAME)
if [[ ! "$TEXT" =~ .*"dev-".* ]]; then
echo -e "\033[0;31m FAIL \033[0m"
exit 1
else
echo -e "\033[0;32m SUCCESS \033[0m"
fi

echo ==== Set status ====
TEXT=$(near call $CONTRACT_NAME set_status '{"message": "aloha!"}' --accountId $CONTRACT_NAME)
if [[ ! "$TEXT" =~ .*"To see the transaction in the transaction explorer".* ]]; then
echo -e "\033[0;31m FAIL \033[0m"
exit 1
else
echo -e "\033[0;32m SUCCESS \033[0m"
fi

echo ==== Get status ====
TEXT=$(near view $CONTRACT_NAME get_status '{"account_id": "'$CONTRACT_NAME'"}')
if [[ ! "$TEXT" =~ .*"aloha!".* ]]; then
echo -e "\033[0;31m FAIL \033[0m"
exit 1
else
echo -e "\033[0;32m SUCCESS \033[0m"
fi
27 changes: 27 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Readme CI
on:
repository_dispatch:
types: [tests-report]
push:
jobs:
readme-ci:
strategy:
matrix:
platform: [ubuntu-latest] # mac-os lags out
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install NEAR CLI
run: npm install near-cli -g
- name: Building this contract
run: npm run build
- name: Run Readme Quick Deploy Commands
run: bash .github/scripts/readme.sh

0 comments on commit dca9bf2

Please sign in to comment.