From 1c6271321953ca1cdeec37e6bbb7d8b697033eab Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Thu, 11 May 2023 22:42:00 +0200 Subject: [PATCH] Enable CodeQL static code analyze/automated build tests --- .github/workflows/build-macos.yml | 34 +++++++++++++++++++ .github/workflows/build-ubuntu-deb.yml | 22 ++++++++++++ .github/workflows/codeql.yml | 47 ++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 .github/workflows/build-macos.yml create mode 100644 .github/workflows/build-ubuntu-deb.yml create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 0000000..d7af6b5 --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,34 @@ +name: Build MacOS + +on: + push: + branches: [ "qml" ] + pull_request: + branches: [ "qml" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + runs-on: macos-latest + + defaults: + run: + working-directory: src + + steps: + - uses: actions/checkout@v3 + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/build-ubuntu-deb.yml b/.github/workflows/build-ubuntu-deb.yml new file mode 100644 index 0000000..cde42e0 --- /dev/null +++ b/.github/workflows/build-ubuntu-deb.yml @@ -0,0 +1,22 @@ +name: Build Ubuntu .deb + +on: + push: + branches: [ "qml" ] + pull_request: + branches: [ "qml" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: sudo apt install -y --no-install-recommends build-essential devscripts debhelper cmake git libarchive-dev libcurl4-gnutls-dev + qtbase5-dev qtbase5-dev-tools qtdeclarative5-dev libqt5svg5-dev qttools5-dev libgnutls28-dev + qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtgraphicaleffects + + - name: Build + run: debuild -uc -us diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..8ebfc18 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,47 @@ +name: "CodeQL" + +on: + push: + branches: [ "qml" ] + pull_request: + branches: [ "qml" ] + schedule: + - cron: '44 19 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: 'ubuntu-latest' + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'cpp' ] + + steps: + - name: Install dependencies + run: sudo apt install -y --no-install-recommends build-essential devscripts debhelper cmake git libarchive-dev libcurl4-gnutls-dev + qtbase5-dev qtbase5-dev-tools qtdeclarative5-dev libqt5svg5-dev qttools5-dev libgnutls28-dev + qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtgraphicaleffects + + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}"