Skip to content

Fix CI tests

Fix CI tests #205

Workflow file for this run

name: Robot Test images
on:
push:
branches:
- main*
pull_request:
branches:
- main*
jobs:
prepare-sdk:
name: Prepare SDK for Robot Testing
runs-on: ubuntu-latest
outputs:
# Names of every Test Case defined
test_cases: ${{ steps.get_tests.outputs.test_cases }}
container_tag: ${{ steps.ver.outputs.container_tag }}
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
# Import SDK image and initialize workspace
- name: Extract DevContainer Version
id: ver
run: |
CONTAINER_TAG=$(cat .devcontainer/devcontainer.json | grep "ghcr.io" | awk -F ":" '{print $3}' | awk -F "\"" '{print $1}')
echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
# Generate Test Matrix
- name: Generate Test Matrix
id: get_tests
run: |
echo "test_cases=\"$(cat ./robot_tests/ci_tests.json)\"" >> $GITHUB_OUTPUT
Test:
runs-on: ubuntu-latest
needs: prepare-sdk
strategy:
fail-fast: false
matrix:
test_case:
${{ fromJson(needs.prepare-sdk.outputs.test_cases) }}
steps:
- uses: actions/checkout@v4
- run: |
sudo apt-get update && sudo apt-get install -y python3 python3-venv python-is-python3 binfmt-support qemu-user-static
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull DevContainer
id: pull_dev
run: docker pull ghcr.io/elektrobit/ebcl_dev_container:${{ needs.prepare-sdk.outputs.container_tag }}
- name: Run Robot Test in dev container
id: robot
uses: devcontainers/ci@v0.3
with:
runCmd: |
FORCE_CLEAN_REBUILD=1 ./run_tests.sh "${{ matrix.test_case }}"
- name: Upload test report
# Upload artifacts always when Robot Test failed but never when prepare steps fail.
if: ${{ failure() && steps.pull_dev.conclusion == 'success' && steps.sanitize.conclusion == 'success'}}
uses: actions/upload-artifact@v4
with:
name: "report-${{ env.sanitized_test_name }}"
path: |
./robot_tests/test_report*.zip