Skip to content

Commit 9417bf6

Browse files
authored
[SBCI-1882] Setup GitHub actions to run tests
* change base branch to main and cleanup commits * change docker test script location
1 parent ec35c25 commit 9417bf6

2 files changed

Lines changed: 116 additions & 9 deletions

File tree

.github/workflows/run-tests-ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# GitHub Actions workflow for testing the SDK example project
2+
# Supports x86_64 architecture
3+
name: Run Tests CI
4+
5+
# Trigger conditions
6+
on:
7+
# Run on pushes to main branch
8+
push:
9+
branches: [ "main"]
10+
paths:
11+
- 'examples/**'
12+
- 'test-scripts/**'
13+
- 'Dockerfile'
14+
- '.github/workflows/run-tests-ci.yml'
15+
# Run on pull requests to main branch
16+
pull_request:
17+
branches: [ "main" ]
18+
paths:
19+
- 'examples/**'
20+
- 'test-scripts/**'
21+
- 'Dockerfile'
22+
- '.github/workflows/run-tests-ci.yml'
23+
# Allow manual triggering with custom parameters
24+
workflow_dispatch:
25+
inputs:
26+
sdk_version:
27+
description: 'SDK Version to test'
28+
required: false
29+
type: string
30+
test_suite:
31+
description: 'Test suite to run'
32+
required: false
33+
default: 'all'
34+
type: choice
35+
options:
36+
- all
37+
- python
38+
- java
39+
- nodejs
40+
- c
41+
42+
# Global environment variables
43+
env:
44+
SDK_VERSION: '0.800.5'
45+
46+
jobs:
47+
test-x86_64:
48+
name: Test x86_64 Architecture
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 30
51+
52+
steps:
53+
# Get the source code
54+
- name: Checkout repository
55+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
56+
57+
# Build the Docker image using the existing Dockerfile
58+
- name: Build Docker image (x86_64)
59+
run: |
60+
docker build \
61+
--build-arg SDK_VERSION=${{ inputs.sdk_version || env.SDK_VERSION }} \
62+
--build-arg ARCH=linux-x86_64 \
63+
--build-arg SCANBOT_LICENSE="${{ secrets.SCANBOT_LICENSE_KEY }}" \
64+
--target all-tests \
65+
-t scanbot-linux-x86_64:latest .
66+
67+
# Run the test suite with secure stdin approach
68+
- name: Run test suite (x86_64)
69+
run: |
70+
case "${{ inputs.test_suite || 'all' }}" in
71+
"python")
72+
echo "Running Python tests..."
73+
docker run --rm \
74+
-e SCANBOT_LICENSE="${{ secrets.SCANBOT_LICENSE_KEY }}" \
75+
scanbot-linux-x86_64:latest \
76+
bash -c '/tests/test-python.sh 2>&1 | tee /tmp/test.log'
77+
;;
78+
"java")
79+
echo "Running Java tests..."
80+
docker run --rm \
81+
-e SCANBOT_LICENSE="${{ secrets.SCANBOT_LICENSE_KEY }}" \
82+
scanbot-linux-x86_64:latest \
83+
bash -c '/tests/test-java.sh 2>&1 | tee /tmp/test.log'
84+
;;
85+
"nodejs")
86+
echo "Running Node.js tests..."
87+
docker run --rm \
88+
-e SCANBOT_LICENSE="${{ secrets.SCANBOT_LICENSE_KEY }}" \
89+
scanbot-linux-x86_64:latest \
90+
bash -c '/tests/test-nodejs.sh 2>&1 | tee /tmp/test.log'
91+
;;
92+
"c")
93+
echo "Running C tests..."
94+
docker run --rm \
95+
-e SCANBOT_LICENSE="${{ secrets.SCANBOT_LICENSE_KEY }}" \
96+
scanbot-linux-x86_64:latest \
97+
bash -c '/tests/test-c.sh 2>&1 | tee /tmp/test.log'
98+
;;
99+
"all"|*)
100+
echo "Running all tests..."
101+
docker run --rm \
102+
-e SCANBOT_LICENSE="${{ secrets.SCANBOT_LICENSE_KEY }}" \
103+
scanbot-linux-x86_64:latest \
104+
bash -c '/tests/run-all-tests.sh 2>&1 | tee /tmp/test.log'
105+
;;
106+
esac

test-scripts/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,22 @@ test-scripts/
2525

2626
## Running Tests
2727

28-
### 1. Build Test Container
28+
### 1. Set License Key & Version
2929

3030
```bash
31-
docker build \
32-
--build-arg SDK_VERSION=0.800.3 \
33-
--build-arg ARCH=linux-aarch64 \
34-
--build-arg SCANBOT_LICENSE=$SCANBOT_LICENSE \
35-
--target sdk-verification \
36-
-t scanbot-test .
31+
export SCANBOT_LICENSE="your-license-key-here"
32+
export SDK_VERSION=0.800.5
3733
```
3834

39-
### 2. Set License Key
35+
### 2. Build Test Container
4036

4137
```bash
42-
export SCANBOT_LICENSE="your-license-key-here"
38+
docker build \
39+
--build-arg SDK_VERSION=$SDK_VERSION \
40+
--build-arg ARCH=linux-aarch64 \
41+
--build-arg SCANBOT_LICENSE=$SCANBOT_LICENSE \
42+
--target base \
43+
-t scanbot-test .
4344
```
4445

4546
### 3. Run Tests

0 commit comments

Comments
 (0)