Skip to content

Commit 2906235

Browse files
authored
Add reusable E2E workflow and PR trigger (#10)
* Add reusable E2E workflow, PR trigger, and latest tag for stellar-cli - Extract E2E logic into reusable workflow_call for cross-repo PR checks - Add pull_request trigger to run E2E on local-dev PRs - Add latest tag to stellar-cli release workflow * Write STELLAR_RPC_URL to provider.env in setup script
1 parent 328d187 commit 2906235

4 files changed

Lines changed: 90 additions & 3 deletions

File tree

.github/workflows/e2e-reusable.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: E2E Tests (Reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
contracts_version:
7+
description: "soroban-core release tag (e.g. v0.1.0)"
8+
type: string
9+
default: "latest"
10+
provider_version:
11+
description: "provider-platform image tag (e.g. 0.2.0)"
12+
type: string
13+
default: "latest"
14+
stellar_cli_version:
15+
description: "stellar-cli image tag (e.g. 0.1.0)"
16+
type: string
17+
default: "latest"
18+
contracts_artifact:
19+
description: "Name of a workflow artifact containing wasms (overrides release download)"
20+
type: string
21+
default: ""
22+
provider_image_override:
23+
description: "Full image ref override for provider-platform (e.g. ghcr.io/org/repo:sha-abc123)"
24+
type: string
25+
default: ""
26+
secrets:
27+
E2E_TRIGGER_TOKEN:
28+
required: true
29+
30+
env:
31+
REGISTRY: ghcr.io
32+
ORG: moonlight-protocol
33+
34+
jobs:
35+
e2e:
36+
runs-on: ubuntu-latest
37+
permissions:
38+
packages: read
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
repository: moonlight-protocol/local-dev
43+
ref: main
44+
token: ${{ secrets.E2E_TRIGGER_TOKEN }}
45+
46+
- name: Log in to GHCR
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ${{ env.REGISTRY }}
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.E2E_TRIGGER_TOKEN }}
52+
53+
- name: Download contract wasms from artifact
54+
if: inputs.contracts_artifact != ''
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: ${{ inputs.contracts_artifact }}
58+
path: e2e/wasms
59+
60+
- name: Download contract wasms from release
61+
if: inputs.contracts_artifact == ''
62+
env:
63+
GH_TOKEN: ${{ secrets.E2E_TRIGGER_TOKEN }}
64+
VERSION: ${{ inputs.contracts_version }}
65+
run: |
66+
mkdir -p e2e/wasms
67+
if [ "$VERSION" = "latest" ]; then
68+
gh release download --repo ${{ env.ORG }}/soroban-core -p '*.wasm' -D e2e/wasms/
69+
else
70+
gh release download "$VERSION" --repo ${{ env.ORG }}/soroban-core -p '*.wasm' -D e2e/wasms/
71+
fi
72+
ls -la e2e/wasms/
73+
74+
- name: Run E2E tests
75+
env:
76+
STELLAR_CLI_IMAGE: ${{ env.REGISTRY }}/${{ env.ORG }}/stellar-cli:${{ inputs.stellar_cli_version }}
77+
PROVIDER_IMAGE: ${{ inputs.provider_image_override != '' && inputs.provider_image_override || format('{0}/{1}/provider-platform:{2}', env.REGISTRY, env.ORG, inputs.provider_version) }}
78+
working-directory: e2e
79+
run: |
80+
docker compose up -d
81+
EXIT_CODE=$(docker wait e2e-test-runner-1)
82+
echo "--- test-runner logs ---"
83+
docker compose logs test-runner
84+
docker compose down
85+
exit $EXIT_CODE

.github/workflows/e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: E2E Tests
22

33
on:
4+
pull_request:
5+
branches: [main]
46
repository_dispatch:
57
types: [module-release]
68
workflow_dispatch:
@@ -85,9 +87,7 @@ jobs:
8587
working-directory: e2e
8688
run: |
8789
docker compose up -d
88-
# Wait for test-runner to finish and capture its exit code
89-
docker wait e2e-test-runner-1
90-
EXIT_CODE=$?
90+
EXIT_CODE=$(docker wait e2e-test-runner-1)
9191
echo "--- test-runner logs ---"
9292
docker compose logs test-runner
9393
docker compose down

.github/workflows/release-stellar-cli.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3333
tags: |
3434
type=match,pattern=stellar-cli-v(.*),group=1
35+
type=raw,value=latest
3536
3637
- name: Build and push
3738
uses: docker/build-push-action@v6

e2e/setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ MODE=development
100100
LOG_LEVEL=TRACE
101101
SERVICE_DOMAIN=localhost
102102
103+
STELLAR_RPC_URL=$STELLAR_RPC_URL
103104
NETWORK=local
104105
NETWORK_FEE=1000000000
105106
CHANNEL_CONTRACT_ID=$CHANNEL_ID

0 commit comments

Comments
 (0)