-
Notifications
You must be signed in to change notification settings - Fork 143
52 lines (47 loc) · 1.61 KB
/
buck2-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
name: Buck2 test
on:
pull_request:
branches: [main]
types: [opened, synchronize, labeled, unlabeled]
jobs:
buck2-test:
name: Buck2 Test
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: actions/checkout@v3
- name: Prepare Buck2 test args from labels
id: prepare_args
run: |
ARGS=""
cat <<EOF > labels.json
${{ toJSON(github.event.pull_request.labels.*.name) }}
EOF
DEFAULT_LABELS=("dashboard" "consent" "pay" "core" "api-keys" "notifications" "admin-panel" "map")
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
for LABEL in "${LABELS[@]}"; do
case "$LABEL" in
dashboard|consent|pay|admin-panel|map)
ARGS+=" //apps/$LABEL:test"
;;
core)
ARGS+=" //core/api:test"
;;
api-keys|notifications)
ARGS+=" //core/$LABEL:$LABEL"
;;
esac
done
echo "Prepared args: $ARGS"
echo "args=$ARGS" >> "$GITHUB_OUTPUT"
- name: Buck2 test
if: steps.prepare_args.outputs.args != ''
run: nix develop -c buck2 test ${{ steps.prepare_args.outputs.args }}