Skip to content

Commit 252259e

Browse files
authored
Merge pull request #41 from DataSQRL/publish
Publish examples so they can be reused
2 parents 0772a4f + 3d43ad2 commit 252259e

File tree

1 file changed

+83
-101
lines changed

1 file changed

+83
-101
lines changed

.github/workflows/build-config.yml

Lines changed: 83 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,110 @@
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+
fail-fast: false
16+
matrix:
17+
include:
18+
- example: finance
19+
path: finance-credit-card-chatbot
20+
test_commands: |
21+
test -c package-analytics-local.json --snapshot snapshots-analytics
22+
test -c package-rewards-local.json --snapshot snapshots-rewards
23+
24+
- example: healthcare
25+
path: healthcare-study-monitoring
26+
test_commands: |
27+
test -c study_analytics_package.json study_analytics.sqrl --snapshot snapshots-study-analytics
28+
test -c study_api_test_package.json --tests tests-api --snapshot snapshots-study-api
29+
test -c study_stream_local_package.json study_stream.sqrl --snapshot snapshots-study-stream
30+
compile study_create_api.sqrl
31+
32+
- example: logistics
33+
path: logistics-shipping-geodata
34+
test_commands: |
35+
test logistics.sqrl --snapshot snapshots
36+
37+
# - example: iot-sensor
38+
# path: iot-sensor-metrics
39+
# test_commands: |
40+
# test sensors.sqrl --snapshot snapshots
41+
42+
- example: retail
43+
path: retail-customer360-nutshop
44+
test_commands: |
45+
test customer360.sqrl --snapshot snapshots
46+
47+
- example: recommendation
48+
path: clickstream-ai-recommendation
49+
test_commands: |
50+
test -c package.json --snapshot snapshots
51+
52+
- example: law
53+
path: law-enforcement
54+
test_commands: |
55+
test -c baseball-card-local.json --snapshot snapshots
56+
3557
env:
3658
TZ: 'America/Los_Angeles'
59+
SQRL_VERSION: 'v0.5.6'
60+
3761
steps:
62+
- uses: actions/checkout@v4
63+
3864
- name: Setup Timezone
3965
uses: szenius/set-timezone@v1.1
4066
with:
4167
timezoneLinux: "America/Los_Angeles"
4268

4369
- name: Pull SQRL Docker image
44-
run: docker pull datasqrl/cmd:v0.5.6
45-
46-
- name: Run Healthcare Analytics Test
47-
if: ${{ github.event.inputs.example == 'healthcare' }}
48-
working-directory: ./healthcare-study-monitoring
49-
run: |
50-
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
51-
continue-on-error: false
70+
run: docker pull datasqrl/cmd:${{ env.SQRL_VERSION }}
5271

53-
- name: Run Healthcare Study Api Test
54-
if: ${{ github.event.inputs.example == 'healthcare' }}
55-
working-directory: ./healthcare-study-monitoring
56-
run: |
57-
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
58-
continue-on-error: false
59-
60-
- name: Run Healthcare Study Stream Test
61-
if: ${{ github.event.inputs.example == 'healthcare' }}
62-
working-directory: ./healthcare-study-monitoring
63-
run: |
64-
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
65-
continue-on-error: false
66-
67-
- name: Run Healthcare Create Api Test
68-
if: ${{ github.event.inputs.example == 'healthcare' }}
69-
working-directory: ./healthcare-study-monitoring
70-
run: |
71-
docker run -i -p 8888:8888 -p 8081:8081 --rm -v $PWD:/build datasqrl/cmd:v0.5.6 compile study_create_api.sqrl
72-
continue-on-error: false
73-
74-
- name: Run Finance Analytics Test
75-
if: ${{ github.event.inputs.example == 'finance' }}
76-
working-directory: ./finance-credit-card-chatbot
77-
run: |
78-
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
79-
continue-on-error: false
72+
- name: Set up QEMU
73+
uses: docker/setup-qemu-action@v2
8074

81-
- name: Run Finance Rewards Test
82-
if: ${{ github.event.inputs.example == 'finance' }}
83-
working-directory: ./finance-credit-card-chatbot
84-
run: |
85-
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
86-
continue-on-error: false
75+
- name: Set up Docker Buildx
76+
uses: docker/setup-buildx-action@v2
8777

88-
- name: Run Clickstream Recommendation Test
89-
if: ${{ github.event.inputs.example == 'recommendation' }}
90-
working-directory: ./clickstream-ai-recommendation
91-
run: |
92-
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
93-
continue-on-error: false
78+
- name: Login to Docker Hub
79+
uses: docker/login-action@v2
80+
with:
81+
username: ${{ secrets.DOCKER_USERNAME }}
82+
password: ${{ secrets.DOCKER_PASSWORD }}
9483

95-
- name: Run IoT Sensor Test
96-
if: ${{ github.event.inputs.example == 'iot-sensor' }}
97-
working-directory: ./iot-sensor-metrics
98-
run: |
99-
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
100-
continue-on-error: false
101-
102-
- name: Run Logistics Test
103-
if: ${{ github.event.inputs.example == 'logistics' }}
104-
working-directory: ./logistics-shipping-geodata
84+
- name: Run ${{ matrix.example }} Tests
85+
working-directory: ${{ matrix.path }}
10586
run: |
106-
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
107-
continue-on-error: false
87+
while IFS= read -r cmd; do
88+
echo "Running: $cmd"
89+
docker run -i -p 8888:8888 -p 8081:8081 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:${SQRL_VERSION} $cmd
90+
done <<< "${{ matrix.test_commands }}"
10891
109-
- name: Run Retail Test
110-
if: ${{ github.event.inputs.example == 'retail' }}
111-
working-directory: ./retail-customer360-nutshop
92+
- name: Write Dockerfile
11293
run: |
113-
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
114-
continue-on-error: false
94+
cat <<EOF > ${{ matrix.path }}/Dockerfile
95+
FROM datasqrl/cmd:${SQRL_VERSION}
11596
116-
- name: Run Law Enforcement Test
117-
if: ${{ github.event.inputs.example == 'law' }}
118-
working-directory: ./law-enforcement
119-
run: |
120-
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
121-
continue-on-error: false
97+
ENV TZ="UTC"
12298
123-
- name: Run anyway
124-
if: ${{ github.event.inputs.example != 'healthcare' }}
125-
run: |
126-
echo "This ran, I guess that is a good thing"
127-
continue-on-error: true
99+
COPY . /build
100+
WORKDIR /build
101+
EOF
128102
103+
- name: Publish ${{ matrix.example }}
104+
uses: docker/build-push-action@v3
105+
with:
106+
context: ./${{ matrix.path }}
107+
file: ./${{ matrix.path }}/Dockerfile
108+
push: true
109+
tags: datasqrl/examples:${{ matrix.example }}
110+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)