-
Notifications
You must be signed in to change notification settings - Fork 158
158 lines (130 loc) · 5.28 KB
/
reusable-test.yaml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
#
# Reusable workflow that runs the whole test suite, linter and build
#
# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ / / \ \ / / \ \ / / \
# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-' `-`-' `-`-'
name: Vape Tests
on:
workflow_call:
# We'll default the NPM_TOKEN to an empty value since we use it
# in .npmrc file and if undefined, the node setup would fail
env:
NPM_TOKEN: ""
jobs:
build:
name: Build & Lint
runs-on: ubuntu-latest-4xlarge
permissions:
contents: read
packages: read
# We'll run the job on the prebuilt base image
container:
image: ghcr.io/layerzero-labs/devtools-dev-base:main
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: "true"
- name: Setup environment
uses: ./.github/workflows/actions/setup-environment
- name: Install dependencies
uses: ./.github/workflows/actions/install-dependencies
- name: Setup build cache
uses: ./.github/workflows/actions/setup-build-cache
- name: Lint
run: pnpm lint
# We'll run the build in series to avoid race conditions
# when compiling hardhat projects in monorepo setups
- name: Build
run: pnpm build
test:
name: Test
runs-on: ubuntu-latest-4xlarge
permissions:
contents: read
packages: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: "true"
- name: Setup environment
uses: ./.github/workflows/actions/setup-environment
- name: Setup build cache
uses: ./.github/workflows/actions/setup-build-cache
# There is a small bug in docker compose that will cause 401 if we don't pull the base image manually
#
# See more here https://github.com/docker/compose-cli/issues/1545
- name: Authenticate to GHCR
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Test
run: pnpm test:ci
env:
# We'll use the prebuilt base image
DEVTOOLS_BASE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-base:main
# And the prebuilt hardhat EVM node image
DEVTOOLS_EVM_NODE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-node-evm-hardhat:main
# And the prebuilt TON node image
DEVTOOLS_TON_NODE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-node-ton-my-local-ton:main
# Provided we have good quality Solana RPCs, we can enable Solana tests
#
# FIXME The Solana tests need to be ported to either use a stable deployment
# or a local node. Until then, we disable the tests
# LZ_DEVTOOLS_ENABLE_SOLANA_TESTS: 1
RPC_URL_SOLANA_MAINNET: ${{ secrets.RPC_URL_SOLANA_MAINNET || 'https://rpc.ankr.com/solana' }}
RPC_URL_SOLANA_TESTNET: ${{ secrets.RPC_URL_SOLANA_TESTNET || 'https://api.devnet.solana.com' }}
# We'll collect the docker compose logs from all containers on failure
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
dest: "./logs"
# We'll collect the docker compose logs from all containers on failure
- name: Store docker logs
if: failure()
uses: actions/upload-artifact@v4
with:
path: ./logs
test-user:
name: User test
runs-on: ubuntu-latest-16xlarge
permissions:
contents: read
packages: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: "true"
- name: Setup environment
uses: ./.github/workflows/actions/setup-environment
# There is a small bug in docker compose that will cause 401 if we don't pull the base image manually
#
# See more here https://github.com/docker/compose-cli/issues/1545
- name: Authenticate to GHCR
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Test
run: pnpm test:user
env:
LAYERZERO_EXAMPLES_REPOSITORY_URL: https://github.com/${{ github.repository }}.git
LAYERZERO_EXAMPLES_REPOSITORY_REF: ${{ github.ref }}
# We'll use the prebuilt base image
DEVTOOLS_BASE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-base:main
# And the prebuilt hardhat EVM node image
DEVTOOLS_EVM_NODE_IMAGE: ghcr.io/layerzero-labs/devtools-dev-node-evm-hardhat:main
# We'll collect the docker compose logs from all containers on failure
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
dest: "./logs"
# We'll collect the docker compose logs from all containers on failure
- name: Store docker logs
if: failure()
uses: actions/upload-artifact@v4
with:
path: ./logs