|
| 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 |
0 commit comments