-
Notifications
You must be signed in to change notification settings - Fork 316
122 lines (119 loc) · 3.84 KB
/
Copy path_tests.yml
File metadata and controls
122 lines (119 loc) · 3.84 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
113
114
115
116
117
118
119
120
121
122
name: Unlock Test Suite
on:
workflow_call:
inputs:
# pass none to run all tests
changed:
description: 'The services/apps that changed (JSON array stringified)'
type: string
required: false
default: '[
"locksmith",
"packages/contracts",
"packages/hardhat-plugin",
"packages/unlock-js",
"packages/paywall",
"paywall-app",
"smart-contracts",
"governance",
"subgraph",
"unlock-protocol-com",
"wedlocks",
"provider",
"graph-service",
"unlock-app",
"governance-app",
"packages/core"
]'
export_cache:
description: 'Whether this workflow run may write the shared Docker deps cache'
type: boolean
required: false
default: false
jobs:
unit-tests:
name: Unit Tests ${{ matrix.target }}
runs-on: ubuntu-24.04
if: ${{ inputs.changed != '[]' }}
env:
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
BUILDKIT_STEP_LOG_MAX_SIZE: 50000000
# below env vars are just used by locksmith
DB_USERNAME: locksmith_test
DB_PASSWORD: password
DB_NAME: locksmith_test
DB_HOSTNAME: db
strategy:
matrix:
target: ${{fromJson( inputs.changed )}}
steps:
- uses: actions/checkout@v4
- name: Free runner disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/share/boost
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo apt-get clean
df -h
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Only one matrix entry writes the shared GHA cache; siblings restore from GHA or Docker Hub fallback.
- name: Build and export Docker deps layer
if: ${{ inputs.export_cache && matrix.target == fromJson(inputs.changed)[0] }}
uses: docker/build-push-action@v6
with:
context: .
build-args: BUILDKIT_INLINE_CACHE=1
target: deps
push: false
tags: unlockprotocol/unlock-dev:latest
cache-from: |
type=gha,scope=docker-deps
type=registry,ref=unlockprotocol/unlock-dev:latest
cache-to: type=gha,scope=docker-deps,mode=max
load: true
# All other matrix entries restore the deps image without attempting another cache export.
- name: Restore Docker deps layer
if: ${{ !inputs.export_cache || matrix.target != fromJson(inputs.changed)[0] }}
uses: docker/build-push-action@v6
with:
context: .
build-args: BUILDKIT_INLINE_CACHE=1
target: deps
push: false
tags: unlockprotocol/unlock-dev:latest
cache-from: |
type=gha,scope=docker-deps
type=registry,ref=unlockprotocol/unlock-dev:latest
load: true
- name: Running ${{ matrix.target }} tests
run: ./scripts/tests.sh ${{ matrix.target }}
shell: bash
# integration-tests:
# name: Integration Tests
# runs-on: ubuntu-24.04
# env:
# DOCKER_BUILDKIT: 1
# BUILDKIT_PROGRESS: plain
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# - name: Prepare repo
# run: yarn && yarn build
# - name: Run Integration Tests
# run: scripts/integration-tests.sh
# - name: Archive production artifacts
# uses: actions/upload-artifact@v4
# with:
# name: screenshots
# path: /tmp/screenshots
# - name: Log failing tests
# if: ${{ failure() }}
# run: ./scripts/docker-compose-log.sh