2021-08-26 15:21:43 +00:00
|
|
|
name: Tests
|
2020-06-26 22:26:55 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-06-09 08:11:23 +00:00
|
|
|
- main
|
2021-08-26 15:21:43 +00:00
|
|
|
- release/**
|
2020-06-26 22:26:55 +00:00
|
|
|
|
2021-08-26 15:21:43 +00:00
|
|
|
jobs:
|
|
|
|
cleanup-runs:
|
2020-06-26 22:26:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: rokroskar/workflow-run-cleanup-action@master
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
2020-06-26 22:26:55 +00:00
|
|
|
|
2021-08-26 15:21:43 +00:00
|
|
|
install-tparse:
|
2020-06-26 22:26:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: actions/setup-go@v2.1.4
|
2021-04-17 10:00:07 +00:00
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2021-08-26 15:21:43 +00:00
|
|
|
- name: Display Go Version
|
|
|
|
run: go version
|
|
|
|
- name: Install tparse
|
2020-06-26 22:26:55 +00:00
|
|
|
run: |
|
2022-10-04 18:39:50 +00:00
|
|
|
export GO111MODULE="on" && go install github.com/mfridman/tparse@latest
|
2022-03-21 10:45:52 +00:00
|
|
|
- uses: actions/cache@v3
|
2020-06-26 22:26:55 +00:00
|
|
|
with:
|
2021-08-26 15:21:43 +00:00
|
|
|
path: ~/go/bin
|
|
|
|
key: ${{ runner.os }}-go-tparse-binary
|
2020-06-26 22:26:55 +00:00
|
|
|
|
2021-08-26 15:21:43 +00:00
|
|
|
test-unit-cover:
|
2020-06-26 22:26:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: actions/setup-go@v2.1.4
|
2021-04-17 10:00:07 +00:00
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2022-03-03 17:07:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-05 10:34:28 +00:00
|
|
|
- uses: technote-space/get-diff-action@v6.0.1
|
2020-06-26 22:26:55 +00:00
|
|
|
with:
|
2021-08-26 15:21:43 +00:00
|
|
|
PATTERNS: |
|
2021-09-07 07:54:53 +00:00
|
|
|
**/**.sol
|
2021-08-26 15:21:43 +00:00
|
|
|
**/**.go
|
|
|
|
go.mod
|
|
|
|
go.sum
|
|
|
|
- name: Test and Create Coverage Report
|
2020-06-26 22:26:55 +00:00
|
|
|
run: |
|
2021-08-26 15:21:43 +00:00
|
|
|
make test-unit-cover
|
|
|
|
if: env.GIT_DIFF
|
2021-09-14 10:15:12 +00:00
|
|
|
- uses: codecov/codecov-action@v2.1.0
|
2020-06-26 22:26:55 +00:00
|
|
|
with:
|
|
|
|
file: ./coverage.txt
|
|
|
|
fail_ci_if_error: true
|
2021-08-26 15:21:43 +00:00
|
|
|
if: env.GIT_DIFF
|
2020-07-24 18:54:25 +00:00
|
|
|
|
2021-10-22 10:20:23 +00:00
|
|
|
test-importer:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v2.1.4
|
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2022-03-03 17:07:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-05 10:34:28 +00:00
|
|
|
- uses: technote-space/get-diff-action@v6.0.1
|
2021-10-22 10:20:23 +00:00
|
|
|
id: git_diff
|
|
|
|
with:
|
|
|
|
SUFFIX_FILTER: |
|
|
|
|
.go
|
|
|
|
.mod
|
|
|
|
.sum
|
|
|
|
- name: test-importer
|
|
|
|
run: |
|
|
|
|
make test-import
|
2022-02-09 13:56:12 +00:00
|
|
|
if: env.GIT_DIFF
|
2020-09-18 16:50:08 +00:00
|
|
|
|
|
|
|
test-solidity:
|
|
|
|
runs-on: ubuntu-latest
|
2021-10-21 11:06:20 +00:00
|
|
|
timeout-minutes: 240
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
batch: ['1-3', '2-3', '3-3']
|
2020-09-18 16:50:08 +00:00
|
|
|
steps:
|
2022-03-03 17:07:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-20 19:00:17 +00:00
|
|
|
- uses: actions/setup-go@v2
|
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2022-01-05 10:34:28 +00:00
|
|
|
- uses: technote-space/get-diff-action@v6.0.1
|
2020-09-18 16:50:08 +00:00
|
|
|
id: git_diff
|
|
|
|
with:
|
2021-09-07 07:54:53 +00:00
|
|
|
PATTERNS: |
|
|
|
|
**/**.sol
|
|
|
|
**/**.go
|
2021-10-08 13:38:42 +00:00
|
|
|
tests/solidity/**/*.js
|
|
|
|
tests/solidity/**/*.sh
|
2021-09-07 07:54:53 +00:00
|
|
|
go.mod
|
|
|
|
go.sum
|
2020-09-18 16:50:08 +00:00
|
|
|
- name: test-solidity
|
|
|
|
run: |
|
2021-10-21 11:06:20 +00:00
|
|
|
./scripts/run-solidity-tests.sh --batch=${{ matrix.batch }}
|
2022-02-09 13:56:12 +00:00
|
|
|
if: env.GIT_DIFF
|
2021-08-26 15:21:43 +00:00
|
|
|
|
|
|
|
liveness-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
2022-03-03 17:07:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: actions/setup-go@v2.1.4
|
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2022-01-05 10:34:28 +00:00
|
|
|
- uses: technote-space/get-diff-action@v6.0.1
|
2021-08-26 15:21:43 +00:00
|
|
|
id: git_diff
|
|
|
|
with:
|
|
|
|
PATTERNS: |
|
|
|
|
**/**.go
|
|
|
|
go.mod
|
|
|
|
go.sum
|
|
|
|
- name: Install Starport
|
|
|
|
run: |
|
|
|
|
curl https://get.starport.network/starport! | bash
|
|
|
|
if: env.GIT_DIFF
|
|
|
|
- name: Start Local Network via Starport
|
|
|
|
run: |
|
|
|
|
starport chain serve --reset-once -v -c ./starport.yml > starport.out 2>&1 &
|
|
|
|
if: env.GIT_DIFF
|
|
|
|
- name: Test Local Network Liveness
|
|
|
|
run: |
|
|
|
|
sleep 2m
|
|
|
|
./contrib/scripts/test_localnet_liveness.sh 100 5 50 localhost
|
|
|
|
if: env.GIT_DIFF
|
2021-10-07 16:41:27 +00:00
|
|
|
|
|
|
|
test-rpc:
|
|
|
|
runs-on: ubuntu-latest
|
2021-10-08 13:38:42 +00:00
|
|
|
timeout-minutes: 15
|
2021-10-07 16:41:27 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v2.1.4
|
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2022-03-03 17:07:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-05 10:34:28 +00:00
|
|
|
- uses: technote-space/get-diff-action@v6.0.1
|
2021-10-07 16:41:27 +00:00
|
|
|
with:
|
|
|
|
PATTERNS: |
|
|
|
|
**/**.sol
|
|
|
|
**/**.go
|
|
|
|
go.mod
|
|
|
|
go.sum
|
|
|
|
- name: Test rpc endpoint
|
|
|
|
run: |
|
|
|
|
make test-rpc
|
|
|
|
if: env.GIT_DIFF
|
2022-02-09 13:56:12 +00:00
|
|
|
|
|
|
|
test-e2e:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v2.1.4
|
|
|
|
with:
|
2022-10-04 18:21:32 +00:00
|
|
|
go-version: 1.18
|
2022-03-03 17:07:19 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-09 13:56:12 +00:00
|
|
|
- uses: technote-space/get-diff-action@v6.0.1
|
|
|
|
with:
|
|
|
|
PATTERNS: |
|
|
|
|
**/**.sol
|
|
|
|
**/**.go
|
|
|
|
go.mod
|
|
|
|
go.sum
|
|
|
|
- name: Test e2e
|
|
|
|
run: |
|
|
|
|
make test-integration
|
2022-10-04 18:21:32 +00:00
|
|
|
if: env.GIT_DIFF
|