From 29f5119f8687050bdb6700b4e6c1b21510f5d097 Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Fri, 1 Sep 2023 00:40:30 +0200 Subject: [PATCH] twip --- .github/workflows/build-test.yml | 202 ++++++------- .github/workflows/heavy-tests.yml | 483 +++++++++++++++--------------- 2 files changed, 343 insertions(+), 342 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f38746b3a6..cbd747b5a2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -17,106 +17,106 @@ jobs: go-version: "1.20" id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3 + # - name: Check out code into the Go module directory + # uses: actions/checkout@v3 - - name: Get dependencies - run: | - make wasm - go get -v -t -d ./... - - - name: Build - run: make build - - - name: Test - run: make test-short - - contract-test: - name: Wasm contract tests - runs-on: ubuntu-latest - strategy: - matrix: - TEST_LANG: [go, rswasm] - steps: - - name: checkout to the directory - uses: actions/checkout@v3 - - - name: install golang - uses: actions/setup-go@v4 - with: - go-version: "1.20" - - - name: install rust-toolchain - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - - - name: install wasm-pack - run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: install schema - run: | - root_path=$(git rev-parse --show-toplevel) - go install $root_path/tools/schema - schema -go - - - name: run builds - env: - TEST_LANG: ${{matrix.TEST_LANG}} - run: | - cd contracts/wasm/scripts - bash core_build.sh - if [ $TEST_LANG == "rswasm" ]; then - bash rust_all.sh ci - fi - - - name: run tests - env: - TEST_LANG: ${{matrix.TEST_LANG}} - run: | - cd contracts/wasm - if [ $TEST_LANG == "go" ]; then - go test ./... - elif [ $TEST_LANG == "rswasm" ]; then - go test ./... -rswasm - fi - - golangci: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v4 - with: - go-version: "1.20" - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - # - name: Generate SC files + # - name: Get dependencies # run: | - # cd contracts/wasm/scripts - # bash schema_all.sh - - # - name: golangci-lint in SC - # uses: golangci/golangci-lint-action@v3 - # with: - # working-directory: contracts/wasm - # args: --fix --timeout 5m0s --path-prefix="" - # skip-pkg-cache: true - - - name: Run global scope golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.53.2 - args: --timeout 15m0s - skip-pkg-cache: true - - - name: Run golangci-lint on wasp-cli - uses: golangci/golangci-lint-action@v3 - with: - working-directory: tools/wasp-cli - version: v1.53.2 - args: --timeout 15m0s - skip-pkg-cache: true + # make wasm + # go get -v -t -d ./... + + # - name: Build + # run: make build + + # - name: Test + # run: make test-short + + # contract-test: + # name: Wasm contract tests + # runs-on: ubuntu-latest + # strategy: + # matrix: + # TEST_LANG: [go, rswasm] + # steps: + # - name: checkout to the directory + # uses: actions/checkout@v3 + + # - name: install golang + # uses: actions/setup-go@v4 + # with: + # go-version: "1.20" + + # - name: install rust-toolchain + # uses: actions-rs/toolchain@v1.0.7 + # with: + # toolchain: stable + + # - name: install wasm-pack + # run: | + # curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + + # - name: install schema + # run: | + # root_path=$(git rev-parse --show-toplevel) + # go install $root_path/tools/schema + # schema -go + + # - name: run builds + # env: + # TEST_LANG: ${{matrix.TEST_LANG}} + # run: | + # cd contracts/wasm/scripts + # bash core_build.sh + # if [ $TEST_LANG == "rswasm" ]; then + # bash rust_all.sh ci + # fi + + # - name: run tests + # env: + # TEST_LANG: ${{matrix.TEST_LANG}} + # run: | + # cd contracts/wasm + # if [ $TEST_LANG == "go" ]; then + # go test ./... + # elif [ $TEST_LANG == "rswasm" ]; then + # go test ./... -rswasm + # fi + + # golangci: + # name: Lint + # runs-on: ubuntu-latest + # steps: + # - uses: actions/setup-go@v4 + # with: + # go-version: "1.20" + # id: go + + # - name: Check out code into the Go module directory + # uses: actions/checkout@v3 + + # # - name: Generate SC files + # # run: | + # # cd contracts/wasm/scripts + # # bash schema_all.sh + + # # - name: golangci-lint in SC + # # uses: golangci/golangci-lint-action@v3 + # # with: + # # working-directory: contracts/wasm + # # args: --fix --timeout 5m0s --path-prefix="" + # # skip-pkg-cache: true + + # - name: Run global scope golangci-lint + # uses: golangci/golangci-lint-action@v3 + # with: + # version: v1.53.2 + # args: --timeout 15m0s + # skip-pkg-cache: true + + # - name: Run golangci-lint on wasp-cli + # uses: golangci/golangci-lint-action@v3 + # with: + # working-directory: tools/wasp-cli + # version: v1.53.2 + # args: --timeout 15m0s + # skip-pkg-cache: true diff --git a/.github/workflows/heavy-tests.yml b/.github/workflows/heavy-tests.yml index 1fef0dbd95..0fd9acc89d 100644 --- a/.github/workflows/heavy-tests.yml +++ b/.github/workflows/heavy-tests.yml @@ -1,247 +1,248 @@ name: Nightly Tests on: - workflow_dispatch: - schedule: - - cron: 30 1 * * * + pull_request: + branches: [develop] + paths-ignore: + - '**/README.md' jobs: - golangci: - name: Lint - runs-on: - - self-hosted - - linux - container: ubuntu:22.04 - steps: - - name: Install dependencies - id: dependencies - run: | - apt update - apt install -y build-essential libstdc++6 software-properties-common make gcc git curl tar - - name: Check out code into the Go module directory - id: checkout - uses: actions/checkout@v3 - - name: install go - id: go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - - - name: Run global scope golangci-lint - id: global_lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.53.2 - args: --timeout 10m0s - skip-pkg-cache: true - - - name: Run golangci-lint on wasp-cli - uses: golangci/golangci-lint-action@v3 - with: - working-directory: tools/wasp-cli - version: v1.53.2 - args: --timeout 10m0s - skip-pkg-cache: true - - - name: Get the job name - id: get_job_name - if: "${{ failure() }}" - uses: mikefarah/yq@master - with: - cmd: yq '.jobs.${{ github.job }}.name' .github/workflows/heavy-tests.yml - - - name: prepare reporting outputs - if: "${{ failure() }}" - id: prepare_outputs - run: | - apt install jq -y - echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e 's:\":\\\":g') >> $GITHUB_OUTPUT - - echo "::group::Install JQ" - - apt update && apt install jq -y - - echo "::endgroup::" - - echo "job name result ${{ steps.get_job_name.outputs.result }}" - - if [ "${{ steps.get_job_name.outputs.result }}" != "null" ]; then - if [ "${{ matrix.TEST_LANG }}" ]; then - echo job_name="${{ steps.get_job_name.outputs.result }} (${{ matrix.TEST_LANG }})" >> $GITHUB_OUTPUT - else - echo job_name="${{ steps.get_job_name.outputs.result }}" >> $GITHUB_OUTPUT - fi - else - echo job_name=${{ github.job }} >> $GITHUB_OUTPUT - fi - - - echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e - 's:\":\\\":g') >> $GITHUB_OUTPUT - - - name: The job has failed - if: ${{ failure() }} - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "job": "${{ github.job }}", - "job_name" : "${{ steps.prepare_outputs.outputs.job_name }}", - "steps": "${{ steps.prepare_outputs.outputs.github_steps }}", - "run_number": "${{ github.run_number }}", - "run_attempt": "${{ github.run_attempt }}", - "workflow": "${{ github.workflow }}", - "sha": "${{ github.sha }}", - "ref": "${{ github.ref_name }}", - "run_id": "${{ github.run_id }}", - "server_url": "${{ github.server_url }}", - "repository": "${{ github.repository }}" - } - env: - SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}" + # golangci: + # name: Lint + # runs-on: + # - self-hosted + # - linux + # container: ubuntu:22.04 + # steps: + # - name: Install dependencies + # id: dependencies + # run: | + # apt update + # apt install -y build-essential libstdc++6 software-properties-common make gcc git curl tar + # - name: Check out code into the Go module directory + # id: checkout + # uses: actions/checkout@v3 + # - name: install go + # id: go + # uses: actions/setup-go@v4 + # with: + # go-version: "1.20" + + # - name: Run global scope golangci-lint + # id: global_lint + # uses: golangci/golangci-lint-action@v3 + # with: + # version: v1.53.2 + # args: --timeout 10m0s + # skip-pkg-cache: true + + # - name: Run golangci-lint on wasp-cli + # uses: golangci/golangci-lint-action@v3 + # with: + # working-directory: tools/wasp-cli + # version: v1.53.2 + # args: --timeout 10m0s + # skip-pkg-cache: true + + # - name: Get the job name + # id: get_job_name + # if: "${{ failure() }}" + # uses: mikefarah/yq@master + # with: + # cmd: yq '.jobs.${{ github.job }}.name' .github/workflows/heavy-tests.yml + + # - name: prepare reporting outputs + # if: "${{ failure() }}" + # id: prepare_outputs + # run: | + # apt install jq -y + # echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e 's:\":\\\":g') >> $GITHUB_OUTPUT + + # echo "::group::Install JQ" + + # apt update && apt install jq -y + + # echo "::endgroup::" + + # echo "job name result ${{ steps.get_job_name.outputs.result }}" + + # if [ "${{ steps.get_job_name.outputs.result }}" != "null" ]; then + # if [ "${{ matrix.TEST_LANG }}" ]; then + # echo job_name="${{ steps.get_job_name.outputs.result }} (${{ matrix.TEST_LANG }})" >> $GITHUB_OUTPUT + # else + # echo job_name="${{ steps.get_job_name.outputs.result }}" >> $GITHUB_OUTPUT + # fi + # else + # echo job_name=${{ github.job }} >> $GITHUB_OUTPUT + # fi + + + # echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e + # 's:\":\\\":g') >> $GITHUB_OUTPUT + + # - name: The job has failed + # if: ${{ failure() }} + # uses: slackapi/slack-github-action@v1.24.0 + # with: + # payload: | + # { + # "job": "${{ github.job }}", + # "job_name" : "${{ steps.prepare_outputs.outputs.job_name }}", + # "steps": "${{ steps.prepare_outputs.outputs.github_steps }}", + # "run_number": "${{ github.run_number }}", + # "run_attempt": "${{ github.run_attempt }}", + # "workflow": "${{ github.workflow }}", + # "sha": "${{ github.sha }}", + # "ref": "${{ github.ref_name }}", + # "run_id": "${{ github.run_id }}", + # "server_url": "${{ github.server_url }}", + # "repository": "${{ github.repository }}" + # } + # env: + # SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}" - contract-test: - name: Wasm contract tests - runs-on: - - self-hosted - - linux - container: ubuntu:22.04 - strategy: - matrix: - TEST_LANG: - - go - - gowasm - - tswasm - - rswasm - steps: - - name: Install dependencies - id: dependencies - run: | - apt update - apt install -y build-essential libstdc++6 software-properties-common make gcc git wget curl tar - - name: checkout to the directory - id: checkout - uses: actions/checkout@v3 - - name: install golang - id: go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - - - name: install tinygo - id: tinygo - run: > - wget - https://github.com/tinygo-org/tinygo/releases/download/v0.27.0/tinygo_0.27.0_amd64.deb - - dpkg -i tinygo_0.27.0_amd64.deb - - export PATH=$PATH:/usr/local/bin - - name: install rust-toolchain - id: rust - uses: actions-rs/toolchain@v1.0.7 - with: - toolchain: stable - - name: install wasm-pack - id: wasm-pack - run: | - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: install Node.js - id: node - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: install schema - id: schema - run: | - git config --global --add safe.directory /__w/wasp/wasp - root_path=$(git rev-parse --show-toplevel) - go install $root_path/tools/schema - schema -go - - - name: run builds - env: - TEST_LANG: ${{matrix.TEST_LANG}} - run: | - cd contracts/wasm/scripts - bash core_build.sh - if [ $TEST_LANG == "gowasm" ]; then - bash go_all.sh - elif [ $TEST_LANG == "tswasm" ]; then - bash ts_all.sh - elif [ $TEST_LANG == "rswasm" ]; then - bash rust_all.sh ci - fi - - - name: run tests - env: - TEST_LANG: ${{matrix.TEST_LANG}} - run: | - cd contracts/wasm - if [ $TEST_LANG == "go" ]; then - go test ./... - elif [ $TEST_LANG == "gowasm" ]; then - go test ./... -gowasm - elif [ $TEST_LANG == "tswasm" ]; then - go test ./... -tswasm - elif [ $TEST_LANG == "rswasm" ]; then - go test ./... -rswasm - fi + # contract-test: + # name: Wasm contract tests + # runs-on: + # - self-hosted + # - linux + # container: ubuntu:22.04 + # strategy: + # matrix: + # TEST_LANG: + # - go + # - gowasm + # - tswasm + # - rswasm + # steps: + # - name: Install dependencies + # id: dependencies + # run: | + # apt update + # apt install -y build-essential libstdc++6 software-properties-common make gcc git wget curl tar + # - name: checkout to the directory + # id: checkout + # uses: actions/checkout@v3 + # - name: install golang + # id: go + # uses: actions/setup-go@v4 + # with: + # go-version: "1.20" + + # - name: install tinygo + # id: tinygo + # run: > + # wget + # https://github.com/tinygo-org/tinygo/releases/download/v0.27.0/tinygo_0.27.0_amd64.deb + + # dpkg -i tinygo_0.27.0_amd64.deb + + # export PATH=$PATH:/usr/local/bin + # - name: install rust-toolchain + # id: rust + # uses: actions-rs/toolchain@v1.0.7 + # with: + # toolchain: stable + # - name: install wasm-pack + # id: wasm-pack + # run: | + # curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + # - name: install Node.js + # id: node + # uses: actions/setup-node@v3 + # with: + # node-version: 18 + # - name: install schema + # id: schema + # run: | + # git config --global --add safe.directory /__w/wasp/wasp + # root_path=$(git rev-parse --show-toplevel) + # go install $root_path/tools/schema + # schema -go + + # - name: run builds + # env: + # TEST_LANG: ${{matrix.TEST_LANG}} + # run: | + # cd contracts/wasm/scripts + # bash core_build.sh + # if [ $TEST_LANG == "gowasm" ]; then + # bash go_all.sh + # elif [ $TEST_LANG == "tswasm" ]; then + # bash ts_all.sh + # elif [ $TEST_LANG == "rswasm" ]; then + # bash rust_all.sh ci + # fi + + # - name: run tests + # env: + # TEST_LANG: ${{matrix.TEST_LANG}} + # run: | + # cd contracts/wasm + # if [ $TEST_LANG == "go" ]; then + # go test ./... + # elif [ $TEST_LANG == "gowasm" ]; then + # go test ./... -gowasm + # elif [ $TEST_LANG == "tswasm" ]; then + # go test ./... -tswasm + # elif [ $TEST_LANG == "rswasm" ]; then + # go test ./... -rswasm + # fi - - name: Get the job name - id: get_job_name - if: "${{ failure() }}" - uses: mikefarah/yq@master - with: - cmd: yq '.jobs.${{ github.job }}.name' .github/workflows/heavy-tests.yml - - - name: prepare reporting outputs - if: "${{ failure() }}" - id: prepare_outputs - run: | - apt install jq -y - echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e 's:\":\\\":g') >> $GITHUB_OUTPUT - - echo "::group::Install JQ" - - apt update && apt install jq -y - - echo "::endgroup::" - - echo "job name result ${{ steps.get_job_name.outputs.result }}" - - if [ "${{ steps.get_job_name.outputs.result }}" != "null" ]; then - if [ "${{ matrix.TEST_LANG }}" ]; then - echo job_name="${{ steps.get_job_name.outputs.result }} (${{ matrix.TEST_LANG }})" >> $GITHUB_OUTPUT - else - echo job_name="${{ steps.get_job_name.outputs.result }}" >> $GITHUB_OUTPUT - fi - else - echo job_name=${{ github.job }} >> $GITHUB_OUTPUT - fi - - - echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e - 's:\":\\\":g') >> $GITHUB_OUTPUT - - - name: The job has failed - if: ${{ failure() }} - uses: slackapi/slack-github-action@v1.24.0 - with: - payload: | - { - "job": "${{ github.job }}", - "job_name" : "${{ steps.prepare_outputs.outputs.job_name }}", - "steps": "${{ steps.prepare_outputs.outputs.github_steps }}", - "run_number": "${{ github.run_number }}", - "run_attempt": "${{ github.run_attempt }}", - "workflow": "${{ github.workflow }}", - "sha": "${{ github.sha }}", - "ref": "${{ github.ref_name }}", - "run_id": "${{ github.run_id }}", - "server_url": "${{ github.server_url }}", - "repository": "${{ github.repository }}" - } - env: - SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}" + # - name: Get the job name + # id: get_job_name + # if: "${{ failure() }}" + # uses: mikefarah/yq@master + # with: + # cmd: yq '.jobs.${{ github.job }}.name' .github/workflows/heavy-tests.yml + + # - name: prepare reporting outputs + # if: "${{ failure() }}" + # id: prepare_outputs + # run: | + # apt install jq -y + # echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e 's:\":\\\":g') >> $GITHUB_OUTPUT + + # echo "::group::Install JQ" + + # apt update && apt install jq -y + + # echo "::endgroup::" + + # echo "job name result ${{ steps.get_job_name.outputs.result }}" + + # if [ "${{ steps.get_job_name.outputs.result }}" != "null" ]; then + # if [ "${{ matrix.TEST_LANG }}" ]; then + # echo job_name="${{ steps.get_job_name.outputs.result }} (${{ matrix.TEST_LANG }})" >> $GITHUB_OUTPUT + # else + # echo job_name="${{ steps.get_job_name.outputs.result }}" >> $GITHUB_OUTPUT + # fi + # else + # echo job_name=${{ github.job }} >> $GITHUB_OUTPUT + # fi + + + # echo github_steps=$(echo '${{ toJSON(steps) }}' | jq -r -c . | sed -e + # 's:\":\\\":g') >> $GITHUB_OUTPUT + + # - name: The job has failed + # if: ${{ failure() }} + # uses: slackapi/slack-github-action@v1.24.0 + # with: + # payload: | + # { + # "job": "${{ github.job }}", + # "job_name" : "${{ steps.prepare_outputs.outputs.job_name }}", + # "steps": "${{ steps.prepare_outputs.outputs.github_steps }}", + # "run_number": "${{ github.run_number }}", + # "run_attempt": "${{ github.run_attempt }}", + # "workflow": "${{ github.workflow }}", + # "sha": "${{ github.sha }}", + # "ref": "${{ github.ref_name }}", + # "run_id": "${{ github.run_id }}", + # "server_url": "${{ github.server_url }}", + # "repository": "${{ github.repository }}" + # } + # env: + # SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}" test: name: Test @@ -357,8 +358,8 @@ jobs: - name: Test id: test run: | - make test GIT_REF_TAG="v0.0.0+${{ github.sha }}" - make test-full GIT_REF_TAG="v0.0.0+${{ github.sha }}" + cd tools/cluster + go test ./... --timeout 60m --count 1 -failfast - name: Get the job name id: get_job_name