-
Notifications
You must be signed in to change notification settings - Fork 7
118 lines (108 loc) · 4.15 KB
/
ci.yml
File metadata and controls
118 lines (108 loc) · 4.15 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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
changed-files-job:
name: Get changed packages
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.detect.outputs.packages }}
aws_packages: ${{ steps.detect.outputs.aws_packages }}
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
with:
files: packages/**
- name: Detect changed packages
id: detect
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
declare -A PATH_TO_NAME=(
["packages/amqp"]="@message-queue-toolkit/amqp"
["packages/core"]="@message-queue-toolkit/core"
["packages/gcp-pubsub"]="@message-queue-toolkit/gcp-pubsub"
["packages/gcs-payload-store"]="@message-queue-toolkit/gcs-payload-store"
["packages/kafka"]="@message-queue-toolkit/kafka"
["packages/metrics"]="@message-queue-toolkit/metrics"
["packages/outbox-core"]="@message-queue-toolkit/outbox-core"
["packages/redis-message-deduplication-store"]="@message-queue-toolkit/redis-message-deduplication-store"
["packages/s3-payload-store"]="@message-queue-toolkit/s3-payload-store"
["packages/schemas"]="@message-queue-toolkit/schemas"
["packages/sns"]="@message-queue-toolkit/sns"
["packages/sqs"]="@message-queue-toolkit/sqs"
)
AWS_PACKAGE_PATHS=("packages/sqs" "packages/sns")
PACKAGES=()
AWS_PACKAGES=()
for path in "${!PATH_TO_NAME[@]}"; do
if echo "$ALL_CHANGED_FILES" | grep -q "$path/"; then
is_aws=false
for aws_path in "${AWS_PACKAGE_PATHS[@]}"; do
if [ "$path" = "$aws_path" ]; then
is_aws=true
break
fi
done
if [ "$is_aws" = true ]; then
AWS_PACKAGES+=("\"${PATH_TO_NAME[$path]}\"")
else
PACKAGES+=("\"${PATH_TO_NAME[$path]}\"")
fi
fi
done
if [ ${#PACKAGES[@]} -eq 0 ]; then
echo 'packages=[]' >> $GITHUB_OUTPUT
echo "No non-AWS packages changed"
else
JSON="[$(IFS=,; echo "${PACKAGES[*]}")]"
echo "packages=$JSON" >> $GITHUB_OUTPUT
echo "Changed packages: $JSON"
fi
if [ ${#AWS_PACKAGES[@]} -eq 0 ]; then
echo 'aws_packages=[]' >> $GITHUB_OUTPUT
echo "No AWS packages changed"
else
AWS_JSON="[$(IFS=,; echo "${AWS_PACKAGES[*]}")]"
echo "aws_packages=$AWS_JSON" >> $GITHUB_OUTPUT
echo "Changed AWS packages: $AWS_JSON"
fi
general:
needs: [changed-files-job]
if: needs.changed-files-job.outputs.packages != '[]'
strategy:
matrix:
node-version: [22.x, 24.x]
package-name: ${{ fromJson(needs.changed-files-job.outputs.packages) }}
uses: ./.github/workflows/ci.common.yml
with:
node_version: ${{ matrix.node-version }}
package_name: ${{ matrix.package-name }}
aws-packages:
needs: [changed-files-job]
if: needs.changed-files-job.outputs.aws_packages != '[]'
strategy:
matrix:
node-version: [22.x, 24.x]
package-name: ${{ fromJson(needs.changed-files-job.outputs.aws_packages) }}
queue-backend: [fauxqs, localstack]
uses: ./.github/workflows/ci.common.yml
with:
node_version: ${{ matrix.node-version }}
package_name: ${{ matrix.package-name }}
queue_backend: ${{ matrix.queue-backend }}
automerge:
needs: [general, aws-packages]
if: always() && (needs.general.result == 'success' || needs.general.result == 'skipped') && (needs.aws-packages.result == 'success' || needs.aws-packages.result == 'skipped')
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}