-
Notifications
You must be signed in to change notification settings - Fork 114
111 lines (98 loc) · 3.39 KB
/
integration-tests-api.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
name: Integration test - API
on: pull_request
jobs:
build-docker-images:
name: Build ${{ matrix.name }}
strategy:
matrix:
include:
- image: matterlabs/block-explorer-app:pr
dockerfile: ./packages/app/Dockerfile
name: docker-block-explorer-app
- image: matterlabs/block-explorer-worker:pr
dockerfile: ./packages/worker/Dockerfile
name: docker-block-explorer-worker
- image: matterlabs/block-explorer-data-fetcher:pr
dockerfile: ./packages/data-fetcher/Dockerfile
name: docker-block-explorer-data-fetcher
- image: matterlabs/block-explorer-api:pr
dockerfile: ./packages/api/Dockerfile
name: docker-block-explorer-api
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push block-explorer-app
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
tags: ${{ matrix.image }}
cache-from: type=gha,scope=${{ matrix.name }}
cache-to: type=gha,mode=max,scope=matrix.name
outputs: type=docker,dest=/tmp/${{ matrix.name }}.tar
# cache-to: ${{ github.event_name == 'push' && 'type=gha,mode=max,scope=matrix.name' || '' }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: /tmp/${{ matrix.name }}.tar
run-tests:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: build-docker-images
strategy:
matrix:
node-version: ['lts/*'] # 18.17.1 or lts/*
test-pattern:
- accounts.test.ts
- addresses.test.ts
- batches.test.ts
- blocks.test.ts
- contracts.test.ts
- logs.test.ts
- stats.test.ts
- tokens.test.ts
- transactions.test.ts
name: 'API test set: ${{ matrix.test-pattern}} / Node: ${{ matrix.node-version}}'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Download prebuilt docker images
uses: actions/download-artifact@v4
with:
pattern: docker-*
path: /tmp
- name: Load image
run: |
ls -1 /tmp/**/*.tar | xargs --no-run-if-empty -L 1 docker load --input
docker image ls -a
- uses: alexkainzinger/compose-action@v2
with:
compose-file: docker-compose-prebuilt.yaml
down-flags: "--volumes"
- name: Cache npm dependencies
uses: actions/cache@v4
env:
HUSKY: 0
with:
path: '~/.npm'
key: ${{ runner.os }}-integration-tests-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-integration-tests-
${{ runner.os }}-
- name: Prepare test env
run: |
npm ci --no-audit
npx playwright install --with-deps chromium
- name: Run ${{ matrix.test-pattern }}
working-directory: packages/integration-tests
run: |
npx jest --verbose --testPathPattern=${{ matrix.test-pattern }}