-
Notifications
You must be signed in to change notification settings - Fork 13
194 lines (167 loc) · 6.54 KB
/
build.yml
File metadata and controls
194 lines (167 loc) · 6.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Build and test DataSQRL Examples
on:
push:
branches: [ "main" ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- example: recommendation
path: clickstream-ai-recommendation
test_commands: |
compile -c recommendation_package_api.json
compile -c recommendation_package_kafka.json
- example: credit-card-analytics
path: finance-credit-card-chatbot/credit-card-analytics
tag: credit-card-analytics
test_commands: |
compile -c creditcard_analytics_package_test.json
compile -c creditcard_analytics_package_kafka.json
test -c creditcard_analytics_package_test.json creditcard_analytics_package_jwt.json
- example: credit-card-rewards
path: finance-credit-card-chatbot/credit-card-rewards
tag: credit-card-rewards
test_commands: |
compile -c creditcard_rewards_package_test.json
compile -c creditcard_rewards_package_kafka.json
test -c creditcard_rewards_package_test.json creditcard_rewards_package_jwt.json
- example: credit-card-views
path: finance-credit-card-chatbot/credit-card-views
tag: credit-card-views
test_commands: |
compile -c creditcard_views_package_test.json
test -c creditcard_views_package_test.json
- example: healthcare-study-analytics
path: healthcare-study/healthcare-study-analytics
tag: healthcare-study-analytics
test_commands: |
compile -c study_analytics_package_test.json
test -c study_analytics_package_test.json
# FIXME https://github.com/DataSQRL/sqrl/issues/1140 compile -c study_analytics_package_snowflake.json
- example: healthcare-study-api
path: healthcare-study/healthcare-study-api
tag: healthcare-study-api
test_commands: |
compile -c study_api_package_api.json
compile -c study_api_package_test.json
test -c study_api_package_test.json
- example: healthcare-study-stream
path: healthcare-study/healthcare-study-stream
tag: healthcare-study-stream
test_commands: |
compile -c study_stream_package_kafka.json
compile -c study_stream_package_test.json
test -c study_stream_package_test.json
- example: iot-sensor
path: iot-sensor-metrics
test_commands: |
compile -c sensors_package_api.json
compile -c sensors_package_test.json
test -c sensors_package_test.json
test -c sensors_package_api.json
- example: law-enforcement
path: law-enforcement
test_commands: |
compile -c baseball_card_package_test.json
test -c baseball_card_package_test.json
- example: logistics
path: logistics-shipping-geodata
test_commands: |
compile -c logistics_package_test.json
test -c logistics_package_test.json
- example: oil-gas-monitoring
path: oil-gas-agent-automation/oil-gas-agent-monitoring
tag: oil-gas-agent-monitoring
test_commands: |
compile -c monitoring_agent_package_test.json
- example: oil-gas-operations
path: oil-gas-agent-automation/oil-gas-agent-operations
tag: oil-gas-agent-operations
test_commands: |
compile -c operations_agent_package_test.json
test -c operations_agent_package_test.json
- example: usage-analytics
path: usage-analytics
test_commands: |
compile -c usertokens_package_test.json
test -c usertokens_package_test.json
env:
TZ: 'America/Los_Angeles'
SQRL_VERSION: 'latest'
steps:
- uses: actions/checkout@v4
- name: Setup Timezone
uses: szenius/set-timezone@v1.1
with:
timezoneLinux: "America/Los_Angeles"
- name: Cache Docker images
uses: ScribeMD/docker-cache@0.5.0
with:
# one cache entry per SQRL version & OS
key: sqrl-${{ runner.os }}-${{ env.SQRL_VERSION }}
- name: Pull SQRL Docker image
run: docker pull datasqrl/cmd:${{ env.SQRL_VERSION }}
- name: Run ${{ matrix.example }} Tests
working-directory: ${{ matrix.path }}
run: |
# Read raw lines from the matrix value
mapfile -t raw_cmds <<< "${{ matrix.test_commands }}"
# Keep only non‑empty lines
cmds=()
for c in "${raw_cmds[@]}"; do
[[ -z "${c//[[:space:]]/}" ]] && continue # skip blanks
cmds+=("$c")
done
if (( ${#cmds[@]} == 0 )); then
echo "ERROR: No test commands specified for ${{ matrix.example }}"
exit 1
fi
for cmd in "${cmds[@]}"; do
echo "::group::Running: $cmd"
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 \
--rm -v "$PWD":/build "datasqrl/cmd:${SQRL_VERSION}" $cmd
echo "::endgroup::"
done
- name: Write Dockerfile
run: |
cat <<EOF > ${{ matrix.path }}/Dockerfile
FROM datasqrl/cmd:${SQRL_VERSION}
ENV TZ="UTC"
COPY . /build
WORKDIR /build
EOF
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish ${{ matrix.example }}
uses: docker/build-push-action@v3
with:
context: ./${{ matrix.path }}
file: ./${{ matrix.path }}/Dockerfile
push: true
tags: datasqrl/examples:${{ matrix.tag && matrix.tag != '' && matrix.tag || matrix.path }}
platforms: linux/amd64,linux/arm64
ci-summary:
name: build ✅ summary
needs: build
runs-on: ubuntu-latest
if: always()
steps:
- name: Fail if any build job failed
run: |
failed=$(jq -r '.[] | select(.result=="failure")' <<< '${{ toJson(needs) }}' | wc -l)
if [[ "$failed" -gt 0 ]]; then
echo "::error ::${failed} matrix job(s) failed"
exit 1
fi