Skip to content

Commit b7b3aac

Browse files
committed
Use matrix to build all examples
Signed-off-by: Marvin Froeder <marvin@datasqrl.com>
1 parent ff24147 commit b7b3aac

File tree

1 file changed

+36
-59
lines changed

1 file changed

+36
-59
lines changed

.github/workflows/build-config.yml

Lines changed: 36 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
11
name: Build and test DataSQRL Examples
2+
23
on:
3-
workflow_dispatch:
4-
inputs:
5-
repo:
6-
description: Test runner
7-
required: true
8-
default: 'zharec'
9-
type: string
10-
note:
11-
description: Test note
12-
required: true
13-
default: 'Smoke test'
14-
type: string
15-
example:
16-
description: Example to test
17-
required: true
18-
type: choice
19-
default: healthcare
20-
options:
21-
- finance
22-
- healthcare
23-
- logistics
24-
- iot-sensor
25-
- retail
26-
- recommendation
27-
- law
28-
pull_request:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
297
branches: [ "main" ]
308

319
jobs:
3210
build:
3311
runs-on: ubuntu-latest
3412
timeout-minutes: 30
13+
14+
strategy:
15+
matrix:
16+
example: [finance, healthcare, logistics, iot-sensor, retail, recommendation, law]
17+
3518
env:
3619
TZ: 'America/Los_Angeles'
20+
3721
steps:
3822
- uses: actions/checkout@v4
23+
3924
- name: Setup Timezone
4025
uses: szenius/set-timezone@v1.1
4126
with:
@@ -46,101 +31,93 @@ jobs:
4631

4732
- name: Set up QEMU
4833
uses: docker/setup-qemu-action@v2
34+
4935
- name: Set up Docker Buildx
5036
uses: docker/setup-buildx-action@v2
37+
5138
- name: Login to Docker Hub
5239
uses: docker/login-action@v2
5340
with:
5441
username: ${{ secrets.DOCKER_USERNAME }}
5542
password: ${{ secrets.DOCKER_PASSWORD }}
5643

5744
- name: Run Healthcare Analytics Test
58-
if: ${{ github.event.inputs.example == 'healthcare' }}
45+
if: ${{ matrix.example == 'healthcare' }}
5946
working-directory: ./healthcare-study-monitoring
6047
run: |
6148
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build -e LOCAL_WAREHOUSE_DIR=/tmp/warehouse datasqrl/cmd:v0.5.6 test -c study_analytics_package.json study_analytics.sqrl --snapshot snapshots-study-analytics
62-
continue-on-error: false
6349
6450
- name: Run Healthcare Study Api Test
65-
if: ${{ github.event.inputs.example == 'healthcare' }}
51+
if: ${{ matrix.example == 'healthcare' }}
6652
working-directory: ./healthcare-study-monitoring
6753
run: |
6854
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test -c study_api_test_package.json --tests tests-api --snapshot snapshots-study-api
69-
continue-on-error: false
7055
7156
- name: Run Healthcare Study Stream Test
72-
if: ${{ github.event.inputs.example == 'healthcare' }}
57+
if: ${{ matrix.example == 'healthcare' }}
7358
working-directory: ./healthcare-study-monitoring
7459
run: |
7560
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test -c study_stream_local_package.json study_stream.sqrl --snapshot snapshots-study-stream
76-
continue-on-error: false
7761
7862
- name: Run Healthcare Create Api Test
79-
if: ${{ github.event.inputs.example == 'healthcare' }}
63+
if: ${{ matrix.example == 'healthcare' }}
8064
working-directory: ./healthcare-study-monitoring
8165
run: |
8266
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 compile study_create_api.sqrl
83-
continue-on-error: false
8467
8568
- name: Run Finance Analytics Test
69+
if: ${{ matrix.example == 'finance' }}
8670
working-directory: finance-credit-card-chatbot/
8771
run: |
8872
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test -c package-analytics-local.json --snapshot snapshots-analytics
89-
continue-on-error: false
9073
9174
- name: Run Finance Rewards Test
75+
if: ${{ matrix.example == 'finance' }}
9276
working-directory: finance-credit-card-chatbot/
9377
run: |
94-
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test test -c package-rewards-local.json --snapshot snapshots-rewards
95-
continue-on-error: false
96-
97-
- name: Publish finance
98-
uses: docker/build-push-action@v3
99-
with:
100-
context: finance-credit-card-chatbot
101-
file: finance-credit-card-chatbot/Dockerfile
102-
push: true
103-
tags: datasqrl/examples:finance
104-
platforms: linux/amd64,linux/arm64
78+
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test -c package-rewards-local.json --snapshot snapshots-rewards
10579
10680
- name: Run Clickstream Recommendation Test
107-
if: ${{ github.event.inputs.example == 'recommendation' }}
81+
if: ${{ matrix.example == 'recommendation' }}
10882
working-directory: ./clickstream-ai-recommendation
10983
run: |
110-
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test test -c package.json --snapshot snapshots
111-
continue-on-error: false
84+
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test -c package.json --snapshot snapshots
11285
11386
- name: Run IoT Sensor Test
114-
if: ${{ github.event.inputs.example == 'iot-sensor' }}
87+
if: ${{ matrix.example == 'iot-sensor' }}
11588
working-directory: ./iot-sensor-metrics
11689
run: |
11790
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test sensors.sqrl --snapshot snapshots
118-
continue-on-error: false
119-
91+
12092
- name: Run Logistics Test
121-
if: ${{ github.event.inputs.example == 'logistics' }}
93+
if: ${{ matrix.example == 'logistics' }}
12294
working-directory: ./logistics-shipping-geodata
12395
run: |
12496
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test logistics.sqrl --snapshot snapshots
125-
continue-on-error: false
12697
12798
- name: Run Retail Test
128-
if: ${{ github.event.inputs.example == 'retail' }}
99+
if: ${{ matrix.example == 'retail' }}
129100
working-directory: ./retail-customer360-nutshop
130101
run: |
131102
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test customer360.sqrl --snapshot snapshots
132-
continue-on-error: false
133103
134104
- name: Run Law Enforcement Test
135-
if: ${{ github.event.inputs.example == 'law' }}
105+
if: ${{ matrix.example == 'law' }}
136106
working-directory: ./law-enforcement
137107
run: |
138108
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 test -c baseball-card-local.json --snapshot snapshots
139-
continue-on-error: false
140109
141110
- name: Run anyway
142-
if: ${{ github.event.inputs.example != 'healthcare' }}
111+
if: ${{ matrix.example != 'healthcare' }}
143112
run: |
144113
echo "This ran, I guess that is a good thing"
145114
continue-on-error: true
146115

116+
- name: Publish ${{ matrix.example }}
117+
uses: docker/build-push-action@v3
118+
with:
119+
context: ${{ matrix.example == 'finance' && 'finance-credit-card-chatbot' || matrix.example == 'healthcare' && 'healthcare-study-monitoring' || matrix.example == 'logistics' && 'logistics-shipping-geodata' || matrix.example == 'iot-sensor' && 'iot-sensor-metrics' || matrix.example == 'retail' && 'retail-customer360-nutshop' || matrix.example == 'recommendation' && 'clickstream-ai-recommendation' || matrix.example == 'law' && 'law-enforcement' }}
120+
file: ${{ matrix.example == 'finance' && 'finance-credit-card-chatbot' || matrix.example == 'healthcare' && 'healthcare-study-monitoring' || matrix.example == 'logistics' && 'logistics-shipping-geodata' || matrix.example == 'iot-sensor' && 'iot-sensor-metrics' || matrix.example == 'retail' && 'retail-customer360-nutshop' || matrix.example == 'recommendation' && 'clickstream-ai-recommendation' || matrix.example == 'law' && 'law-enforcement' }}/Dockerfile
121+
push: true
122+
tags: datasqrl/examples:${{ matrix.example }}
123+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)