-
Notifications
You must be signed in to change notification settings - Fork 274
112 lines (106 loc) · 3.7 KB
/
Copy pathtest-e2e.yaml
File metadata and controls
112 lines (106 loc) · 3.7 KB
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
name: E2E Tests
on:
workflow_call:
jobs:
run-e2e-tests:
runs-on: ubuntu-latest
steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: thor-pipeline-image-${{ github.sha }}
path: /tmp
- name: Load image
run: docker load --input /tmp/thor-pipeline.tar
- name: Checkout code
uses: actions/checkout@v4
- name: Set e2e repo reference
id: set-ref
env:
EVENT_NAME: ${{ github.event_name }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
# Default fallback commit
DEFAULT_COMMIT="c87b8c55ace0d48112a65e8a0659d3af4ef2f1cf"
REF="$DEFAULT_COMMIT"
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
# For pull_request events, we only look at the PR's base branch
if [[ "$PR_BASE_REF" == release/* ]]; then
REF="$PR_BASE_REF"
fi
else
# For push events, we check the branch or tag that was pushed
if [[ "$GITHUB_REF_NAME" == release/* ]]; then
REF="$GITHUB_REF_NAME"
fi
fi
# Verify if branch exists
if ! git ls-remote --heads https://github.com/vechain/thor-e2e-tests.git "$REF"; then
echo "Branch does not exist, using default commit"
echo "ref=$DEFAULT_COMMIT" >> "$GITHUB_OUTPUT"
else
echo "ref=$REF" >> "$GITHUB_OUTPUT"
fi
- name: Checkout e2e tests
uses: actions/checkout@v5
with:
repository: vechain/thor-e2e-tests
ref: ${{ steps.set-ref.outputs.ref }}
- name: Setup Node JS
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Run E2E Tests
run: |
export THOR_IMAGE=thor-pipeline:${{ github.sha }}
yarn install
yarn docker:up
yarn test
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: e2e-test-results-${{ github.sha }}
path: ./junit.xml
retention-days: 14
run-hayabusa-tests:
uses: vechain/hayabusa-e2e/.github/workflows/run-tests.yaml@main
with:
codebuild-name: codebuild-ThorGHA
thor-branch: ${{ github.ref }}
thor-repo: ${{ github.repository }}
permissions:
contents: read
secrets: inherit
detect-interstellar:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
enabled: ${{ steps.check.outputs.enabled }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: thor/fork_config.go
sparse-checkout-cone-mode: false
- name: Check for INTERSTELLAR fork definition
id: check
run: |
# INTERSTELLAR is considered defined when the SoloFork block in
# thor/fork_config.go contains an INTERSTELLAR field, regardless of value.
# Its presence indicates the fork has been implemented and is ready for e2e testing.
if awk '/var SoloFork/,/^}/' thor/fork_config.go | grep -q 'INTERSTELLAR'; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
fi
run-interstellar-tests:
needs: detect-interstellar
if: needs.detect-interstellar.outputs.enabled == 'true'
uses: vechain/interstellar-e2e/.github/workflows/test.yml@main
with:
thor-branch: ${{ github.head_ref || github.ref_name }}
thor-repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
permissions:
contents: read
secrets: inherit