-
Notifications
You must be signed in to change notification settings - Fork 143
178 lines (148 loc) · 5.48 KB
/
e2e-test2.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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: "E2e test"
on:
pull_request:
branches: [main]
jobs:
build:
name: clustered buck2 builds
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
cluster:
- name: core-apis
targets: "//core/api //core/api-ws-server //core/api-trigger //core/api-exporter"
- name: core-apps
targets: "//apps/dashboard //apps/consent //apps/admin-panel"
- name: apps
targets: "//apps/pay //apps/map //apps/voucher"
- name: core-services
targets: "//core/api-keys //core/notifications"
- name: bats-helpers
targets: "//bats/helpers/callback:run //bats/helpers/subscriber:run //bats/helpers/totp:generate"
fail-fast: false
steps:
- id: vars
run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 15360
temp-reserve-mb: 12288
remove-dotnet: "true"
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Create cache directories
run: |
mkdir -p ~/.buck2 ~/.cache/buck2 buck-out/v2
- name: Build cluster
run: |
nix develop -c buck2 build ${{ matrix.cluster.targets }}
- name: Prepare cache directory
run: |
# Create a cluster-specific directory
mkdir -p cluster-cache/${{ matrix.cluster.name }}
# Move buck-out contents to cluster-specific directory
cp -r buck-out/* cluster-cache/${{ matrix.cluster.name }}/
- name: Debug cache content
run: |
echo "Cluster ${{ matrix.cluster.name }} cache size:"
du -sh cluster-cache/${{ matrix.cluster.name }}
- uses: actions/cache/save@v4
with:
path: cluster-cache/${{ matrix.cluster.name }}
key: b2-${{ matrix.cluster.name }}-${{ env.short_sha }}
enableCrossOsArchive: true
tests:
name: execute via bats
runs-on: ubuntu-latest
timeout-minutes: 25
needs: build
steps:
- id: vars
run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 15360
temp-reserve-mb: 12288
remove-dotnet: "true"
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Create cache directories
run: |
mkdir -p ~/.buck2 ~/.cache/buck2 buck-out/v2 cluster-cache
# Restore each cluster cache separately
- name: Restore core-apis cache
uses: actions/cache/restore@v4
with:
path: cluster-cache/core-apis
key: b2-core-apis-${{ env.short_sha }}
fail-on-cache-miss: true
- name: Restore core-apps cache
uses: actions/cache/restore@v4
with:
path: cluster-cache/core-apps
key: b2-core-apps-${{ env.short_sha }}
fail-on-cache-miss: true
- name: Restore apps cache
uses: actions/cache/restore@v4
with:
path: cluster-cache/apps
key: b2-apps-${{ env.short_sha }}
fail-on-cache-miss: true
- name: Restore core-services cache
uses: actions/cache/restore@v4
with:
path: cluster-cache/core-services
key: b2-core-services-${{ env.short_sha }}
fail-on-cache-miss: true
- name: Restore bats-helpers cache
uses: actions/cache/restore@v4
with:
path: cluster-cache/bats-helpers
key: b2-bats-helpers-${{ env.short_sha }}
fail-on-cache-miss: true
- name: Merge cluster caches
run: |
# Create buck-out directory
mkdir -p buck-out
# Copy contents from each cluster cache to buck-out
for cluster in core-apis core-apps apps core-services bats-helpers; do
if [ -d "cluster-cache/$cluster" ]; then
echo "Merging cache from $cluster"
cp -r cluster-cache/$cluster/* buck-out/
fi
done
- name: Debug restored caches
run: |
echo "Individual cluster cache sizes:"
du -sh cluster-cache/*
echo "Combined buck-out size:"
du -sh buck-out
echo "Buck-out structure:"
find buck-out -type d
- name: Run bats tests
run: |
echo "Buck build status before tests:"
nix develop -c buck2 build --show-output \
//core/api //core/api-ws-server //core/api-trigger //core/api-exporter \
//apps/dashboard //apps/consent //apps/pay //apps/admin-panel //apps/map //apps/voucher \
//core/api-keys //core/notifications \
//bats/helpers/callback:run //bats/helpers/subscriber:run //bats/helpers/totp:generate
nix develop -c bats --setup-suite-file bats/ci_setup_suite.bash -t bats/core/**
- name: Rename Tilt log
if: always()
run: mv bats/.e2e-tilt.log bats/e2e-tilt.log
- name: Upload Tilt log
if: always()
uses: actions/upload-artifact@v4
with:
name: Tilt log
path: bats/e2e-tilt.log