diff --git a/.github/workflows/runtime-test.yaml b/.github/workflows/runtime-test.yaml new file mode 100644 index 00000000..f7849331 --- /dev/null +++ b/.github/workflows/runtime-test.yaml @@ -0,0 +1,49 @@ +name: Runtime test +on: + pull_request: + branches: + - develop + - main + paths: # we only include paths critical for building to avoid unnecessary runs + - src/** + - include/** + - scripts/cmake/** + - tests/** + - .github/workflows/** + + # execute on every push made targeting the branches bellow + push: + branches: + - master + - develop # can be removed on master merge + paths: # we only include paths critical for building to avoid unnecessary runs + - src/** + - include/** + - scripts/cmake/** + - .github/workflows/** +jobs: + build-containers: + name: Build Containers + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 2 + matrix: + os: [ubuntu-22.04, windows-2019] + include: + - os: ubuntu-22.04 + base: ubuntu-22.04 + file: docker/Dockerfile.linux + - os: windows-2019 + base: windows-2019 + file: docker/Dockerfile.windows + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker Build + run: | + docker build -f ${{ matrix.file }} --target runtime_test -t runtime_test-${{ matrix.os }} . + - name: Test execution + run: | + docker run --rm --name runtime_test-${{ matrix.os }} runtime_test-${{ matrix.os }} + \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile.linux similarity index 100% rename from docker/Dockerfile rename to docker/Dockerfile.linux diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows new file mode 100644 index 00000000..3de61891 --- /dev/null +++ b/docker/Dockerfile.windows @@ -0,0 +1,34 @@ +FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 as runtime_test + +# Set the environment variables for the paths +ENV CMAKE_VERSION=3.29.3 +ENV CMAKE_INSTALL_DIR="C:\\CMake" + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;"] + +# Download and install CMake +RUN Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v${env:CMAKE_VERSION}/cmake-${env:CMAKE_VERSION}-windows-x86_64.zip" -OutFile "cmake.zip"; Expand-Archive -Path "cmake.zip" -DestinationPath $env:CMAKE_INSTALL_DIR; Remove-Item -Force cmake.zip + + +# Add CMake to PATH +RUN setx /M PATH $($Env:PATH + ';C:\CMake\cmake-3.29.3-windows-x86_64\bin') + +ENV QT_VERSION=5.15.2 \ + QT_INSTALL_DIR="C:\\Qt" + +# Install Chocolatey and Qt +RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12;iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); choco install -y qt5-default --version=5.15.2 + +ENV GTEST_INSTALL_DIR="C:\\gtest-Out" + +# Download and install git +RUN choco install -y git + +# Verify installation +RUN cmake --version + +# Set the working directory +WORKDIR /app + +# Set entrypoint +ENTRYPOINT ["cmd"] \ No newline at end of file diff --git a/docker/test_runtime.sh b/docker/test_runtime.sh index 9f6bb87e..91ae0ae3 100755 --- a/docker/test_runtime.sh +++ b/docker/test_runtime.sh @@ -7,7 +7,7 @@ cd .. DOCKER_BUILDKIT=1 \ docker build \ - -f docker/Dockerfile \ + -f docker/Dockerfile.linux \ --target runtime_test \ -t runtime_test .