diff --git a/.github/workflows/docker-ubuntu.yml b/.github/workflows/docker-ubuntu.yml new file mode 100644 index 0000000..3369992 --- /dev/null +++ b/.github/workflows/docker-ubuntu.yml @@ -0,0 +1,42 @@ +on: + workflow_dispatch: + push: + paths: + - "ci/docker/ubuntu/**" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}/ubuntu + +jobs: + build-ubuntu-docker: + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: ci/docker/ubuntu/ + file: ci/docker/ubuntu/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index db708b8..ae96a73 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -4,26 +4,20 @@ on: branches: - "**" +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}/ubuntu:fix-ci + jobs: static_analysis: runs-on: ubuntu-latest + container: + image: ghcr.io/${{ github.repository }}/ubuntu:fix-ci steps: - name: Checkout uses: actions/checkout@v2 with: submodules: true - - name: Install package - run: | - sudo apt-get update - sudo apt-get -y install qtbase5-dev qt3d5-dev libqt5svg5-dev freeglut3-dev libabsl-dev libprotobuf-dev libre2-dev libeigen3-dev lcov - - name: Install build wrapper - run: | - wget http://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip - unzip build-wrapper-linux-x86.zip - - name: Install sonar scanner - run: | - wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip - unzip sonar-scanner-cli-4.6.2.2472-linux.zip - name: Build and scan run: ci/buildsonarcloud.sh env: diff --git a/CMakeLists.txt b/CMakeLists.txt index cb42eee..3f1dcab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,7 @@ set(TEMPLATE_DIR ${PROJECT_SOURCE_DIR}/template) find_package(codecov) find_package(PythonInterp REQUIRED) +find_package(ortools CONFIG REQUIRED) find_package(Qt5 COMPONENTS REQUIRED Core diff --git a/ci/buildsonarcloud.sh b/ci/buildsonarcloud.sh index 3a2b175..32c287d 100755 --- a/ci/buildsonarcloud.sh +++ b/ci/buildsonarcloud.sh @@ -34,7 +34,7 @@ cmake "$REPO_ROOT" -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON # Wraps the compilation with the Build Wrapper to generate configuration (used # later by the SonarQube Scanner) into the "bw-output" folder -"$REPO_ROOT"/build-wrapper-linux-x86/build-wrapper-linux-x86-64 \ +/opt/build-wrapper-linux-x86/build-wrapper-linux-x86-64 \ --out-dir bw-output cmake \ --build . # Test project @@ -44,6 +44,6 @@ ctest -VV make gcov # Scan project -"$REPO_ROOT"/sonar-scanner-4.6.2.2472-linux/bin/sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dproject.settings="$REPO_ROOT"/sonar-project.properties -Dsonar.projectBaseDir="$REPO_ROOT" -Dsonar.cfamily.gcov.reportsPath="$BUILD_DIR" +/opt/sonar-scanner-4.6.2.2472-linux/bin/sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dproject.settings="$REPO_ROOT"/sonar-project.properties -Dsonar.projectBaseDir="$REPO_ROOT" -Dsonar.cfamily.gcov.reportsPath="$BUILD_DIR" diff --git a/ci/docker/ubuntu/Dockerfile b/ci/docker/ubuntu/Dockerfile new file mode 100644 index 0000000..e00cce0 --- /dev/null +++ b/ci/docker/ubuntu/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:noble + +RUN apt update && apt install -y qtbase5-dev qt3d5-dev libqt5svg5-dev \ + freeglut3-dev lcov \ + build-essential cmake + +RUN apt update && apt install -y wget unzip git python3-jinja2 + +RUN wget http://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip +RUN unzip build-wrapper-linux-x86.zip -d /opt + +RUN wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip +RUN unzip sonar-scanner-cli-4.6.2.2472-linux.zip -d /opt + +RUN wget https://github.com/google/or-tools/releases/download/v9.10/or-tools_amd64_ubuntu-24.04_cpp_v9.10.4067.tar.gz +RUN tar -C /opt --strip-components=1 -xvf or-tools_amd64_ubuntu-24.04_cpp_v9.10.4067.tar.gz + +RUN git config --global --add safe.directory '*' \ No newline at end of file diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 32f1f0d..c4dea1d 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -4,4 +4,3 @@ add_subdirectory(fmt) add_subdirectory(libdxfrw) add_subdirectory(nanoflann) add_subdirectory(yaml-cpp) -add_subdirectory(or-tools) diff --git a/thirdparty/or-tools b/thirdparty/or-tools deleted file mode 160000 index ed8db90..0000000 --- a/thirdparty/or-tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ed8db9097cdbaa06b40384d3a86164744a606043