-
Notifications
You must be signed in to change notification settings - Fork 143
125 lines (111 loc) · 3.82 KB
/
integration-test.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
name: "Integration test"
on:
pull_request:
branches: [main]
types: [opened, synchronize, labeled, unlabeled]
jobs:
tests:
name: execute via tilt
runs-on: ubuntu-latest
steps:
- 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: Prepare tilt args from labels
id: prepare_args
run: |
ARGS=""
BUILD_ARGS=""
cat <<EOF > labels.json
${{ toJSON(github.event.pull_request.labels.*.name) }}
EOF
DEFAULT_LABELS=("dashboard" "consent" "pay" "core" "admin-panel" "map" "voucher")
LABELS=($(jq -r '.[]' < labels.json))
if [ ${#LABELS[@]} -eq 0 ]; then
LABELS=("${DEFAULT_LABELS[@]}")
elif [ ${#LABELS[@]} -eq 1 ] && [ "${LABELS[0]}" = "ci" ]; then
LABELS=("${DEFAULT_LABELS[@]}")
fi
# Handle 'core' dependency
for LABEL in "${LABELS[@]}"; do
case "$LABEL" in
core|dashboard|consent|pay|admin-panel|map|voucher)
BUILD_ARGS+=" //core/api:prod_build"
BUILD_ARGS+=" //core/notifications:notifications"
break
;;
esac
done
# Handle root 'node_modules' dependency
for LABEL in "${LABELS[@]}"; do
case "$LABEL" in
dashboard|consent|pay|admin-panel|map|voucher)
BUILD_ARGS+=" "//:node_modules""
break
;;
esac
done
# Handle 'consent' dependencies
for LABEL in "${LABELS[@]}"; do
case "$LABEL" in
dashboard|voucher)
BUILD_ARGS+=" //apps/consent:consent"
BUILD_ARGS+=" //core/api-keys:api-keys"
break
;;
esac
done
# Handle other labels
for LABEL in "${LABELS[@]}"; do
case "$LABEL" in
core)
ARGS+=" $LABEL"
;;
esac
case "$LABEL" in
dashboard|consent|admin-panel|map|voucher)
ARGS+=" $LABEL"
BUILD_ARGS+=" //apps/$LABEL:$LABEL"
;;
pay)
ARGS+=" $LABEL"
BUILD_ARGS+=" //apps/$LABEL:$LABEL-ci"
;;
esac
done
echo "Prepared args: $ARGS"
echo "Prepared build_args: $BUILD_ARGS"
echo "args=$ARGS" >> "$GITHUB_OUTPUT"
echo "build_args=$BUILD_ARGS" >> "$GITHUB_OUTPUT"
- name: Build via buck2
if: steps.prepare_args.outputs.build_args != ''
run: nix develop -c buck2 build ${{ steps.prepare_args.outputs.build_args }}
- name: Start deps and run tests via tilt
if: steps.prepare_args.outputs.args != ''
run: nix develop -c xvfb-run ./dev/bin/tilt-ci.sh ${{ steps.prepare_args.outputs.args }}
- name: Prepare Tilt log
id: prepare_tilt_log
if: always()
run: |
TILT_LOG="dev/.e2e-tilt.log"
TARGET="dev/e2e-tilt.log"
if [ -f "$TILT_LOG" ]; then
mv "$TILT_LOG" "$TARGET"
echo "prepared=true" >> "$GITHUB_OUTPUT"
else
echo "prepared=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Tilt log
if: steps.prepare_tilt_log.outputs.prepared == 'true'
uses: actions/upload-artifact@v4
with:
name: Tilt log
path: dev/e2e-tilt.log