-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (128 loc) · 3.87 KB
/
e2e-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: E2E Test
on:
pull_request:
branches:
- main
- release/**
push:
branches:
- release/**
permissions: read-all
jobs:
test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/[email protected]
with:
PATTERNS: |
go.mod
go.sum
**/*.go
*.toml
tests/e2e/*
Dockerfile
.github/workflows/e2e-test*
- name: Test E2E
run: |
make test-e2e
if: env.GIT_DIFF
test-files-matrix:
runs-on: ubuntu-latest
outputs:
test_matrix: ${{ steps.set_matrix.outputs.test_matrix }}
steps:
- uses: actions/checkout@v4
- name: Set up test file matrix to run nix tests in parallel
id: set_matrix
run: |
cd ./tests/nix_tests || exit 1
# Define parallel test files
PARALLEL_TESTS=(
"test_account.py"
"test_filters.py"
"test_fee_history.py"
"test_grpc_only.py"
"test_ibc.py"
"test_ics20_precompile.py"
"test_no_abci_resp.py"
"test_precompiles.py"
"test_priority.py"
"test_pruned_node.py"
"test_rollback.py"
"test_storage_proof.py"
"test_zero_fee.py"
)
# Get all test files
# shellcheck disable=SC2207
ALL_FILES=($(ls test_*.py))
# Determine remaining test files
# (the test files that will run all together in one process)
REMAINING_FILES=()
for file in "${ALL_FILES[@]}"; do
if [[ ! " ${PARALLEL_TESTS[*]} " =~ $file ]]; then
REMAINING_FILES+=("$file")
fi
done
# Construct test matrix
# shellcheck disable=SC2076,SC2124,SC2048,SC2086,SC2089,SC2027
TEST_FILES="[$(printf '"%s",' ${PARALLEL_TESTS[*]}) \"${REMAINING_FILES[*]}\"]"
echo "test_matrix=${TEST_FILES}" >> "$GITHUB_OUTPUT"
echo "Test matrix: ${TEST_FILES}"
test-nix:
needs: test-files-matrix
permissions:
contents: write
runs-on: ubuntu-latest
strategy:
matrix:
test_files: ${{fromJson(needs.test-files-matrix.outputs.test_matrix)}}
steps:
- name: Determine token
id: token_check
run: |
if [ -n "${{ secrets.E2E_PAT }}" ]; then
TOKEN=${{ secrets.E2E_PAT }}
else
TOKEN=${{ secrets.GITHUB_TOKEN }}
fi
echo "token=${TOKEN}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
token: ${{ steps.token_check.outputs.token }}
- name: Install Nix
uses: cachix/install-nix-action@V27
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: evmosd
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.sol
**/**.go
go.mod
go.sum
*.toml
tests/nix_tests/**
.github/workflows/e2e-test*
- name: Run nix tests
env:
ARGS: "${{ matrix.test_files }}"
run: make run-nix-tests
if: env.GIT_DIFF
# Commit gomod2nix changes files back to the repository if necessary
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: update gomod2nix.toml file
file_pattern: '*.toml'