From 7e3477bdccddb0379b0a8b7c30c9f8b60664ec5f Mon Sep 17 00:00:00 2001 From: garikbesson Date: Tue, 29 Oct 2024 17:02:01 +0100 Subject: [PATCH] fix workflow tests --- .github/scripts/readme.sh | 82 ------------------------------------ .github/workflows/readme.yml | 27 ------------ .github/workflows/tests.yml | 30 +++---------- 3 files changed, 6 insertions(+), 133 deletions(-) delete mode 100755 .github/scripts/readme.sh delete mode 100755 .github/workflows/readme.yml diff --git a/.github/scripts/readme.sh b/.github/scripts/readme.sh deleted file mode 100755 index 8e70071..0000000 --- a/.github/scripts/readme.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -echo ==== Quicket deploy ==== -TEXT=$(printf 'y\n' | near dev-deploy --wasmFile res/fungible_token.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 ==== Initialize contract using the new method ==== -TEXT=$(near call $CONTRACT_NAME new '{"owner_id": "'$CONTRACT_NAME'", "total_supply": "1000000000000000", "metadata": { "spec": "ft-1.0.0", "name": "Example Token Name", "symbol": "EXLT", "decimals": 8 }}' --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 ==== View contract metadata ==== -TEXT=$(near view $CONTRACT_NAME ft_metadata) -if [[ ! "$TEXT" =~ .*"Example Token Name".* ]]; then - echo -e "\033[0;31m FAIL \033[0m" - exit 1 -else - echo -e "\033[0;32m SUCCESS \033[0m" -fi - -echo ==== Create sub-account ==== -TEXT=$(near create-account bob.$CONTRACT_NAME --masterAccount $CONTRACT_NAME --initialBalance 1) -if [[ ! "$TEXT" =~ .*"Account bob.$CONTRACT_NAME for network".* ]]; then - echo -e "\033[0;31m FAIL \033[0m" - exit 1 -else - echo -e "\033[0;32m SUCCESS \033[0m" -fi - -echo ==== Add sub-account storage deposit ==== -TEXT=$(near call $CONTRACT_NAME storage_deposit '' --accountId bob.$CONTRACT_NAME --amount 0.00125) -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 ==== Check balance of sub-account ==== -TEXT=$(near view $CONTRACT_NAME ft_balance_of '{"account_id": "'bob.$CONTRACT_NAME'"}') -if [[ ! "$TEXT" =~ .*"'0'".* ]]; then - echo -e "\033[0;31m FAIL \033[0m" - exit 1 -else - echo -e "\033[0;32m SUCCESS \033[0m" -fi - -echo ==== Transfer tokens ==== -TEXT=$(near call $CONTRACT_NAME ft_transfer '{"receiver_id": "'bob.$CONTRACT_NAME'", "amount": "19"}' --accountId $CONTRACT_NAME --amount 0.000000000000000000000001) -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 ==== Check balance of sub-account ==== -TEXT=$(near view $CONTRACT_NAME ft_balance_of '{"account_id": "'bob.$CONTRACT_NAME'"}') -if [[ ! "$TEXT" =~ .*"'19'".* ]]; then - echo -e "\033[0;31m FAIL \033[0m" - exit 1 -else - echo -e "\033[0;32m SUCCESS \033[0m" -fi \ No newline at end of file diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml deleted file mode 100755 index a2ec48c..0000000 --- a/.github/workflows/readme.yml +++ /dev/null @@ -1,27 +0,0 @@ -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: Build - run: cd scripts && bash ./build.sh - - name: Run Readme Commands - run: bash .github/scripts/readme.sh \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ec59460..8599863 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,31 +1,13 @@ name: Tests -on: - repository_dispatch: - types: [tests-report] - push: - pull_request_target: - types: [opened, edited] +on: push jobs: tests: strategy: matrix: - platform: [ubuntu-latest] # mac-os in development + platform: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.platform }} - env: - RUST_BACKTRACE: 1 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-2020-10-08 - target: wasm32-unknown-unknown - - name: Run unit tests - run: cd ft && cargo test -- --nocapture --color=always - - name: Run Rust integration tests - run: cd integration-tests/rs && cargo run --example integration-tests - - name: Run TS integration tests - run: cd integration-tests/ts && yarn && yarn test + - uses: actions/checkout@v4 + - name: Install and test modules + run: | + cargo test