-
Notifications
You must be signed in to change notification settings - Fork 7
132 lines (120 loc) · 4.54 KB
/
Copy pathci.yml
File metadata and controls
132 lines (120 loc) · 4.54 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
123
124
125
126
127
128
129
130
131
132
name: CI
on:
push:
branches:
- main
pull_request:
permissions: {}
jobs:
changed-files-job:
name: Get changed packages
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
packages: ${{ steps.detect.outputs.packages }}
aws_packages: ${{ steps.detect.outputs.aws_packages }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
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 != '[]'
permissions:
contents: read
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 != '[]'
permissions:
contents: read
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: github.event_name == 'pull_request' && 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@30c3f8f14a4f7b315ba38dbc1b793d27128fef82 # v3.12.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}