From 96c515fb4efe632dbece37d0d558ffa1b32d7dea Mon Sep 17 00:00:00 2001 From: Marten Rebane Date: Fri, 9 Oct 2026 18:40:28 +0300 Subject: [PATCH] Add CodeQL scanning --- .github/workflows/codeql.yml | 99 +++++++++++++++++++++++++++++++++ .github/workflows/copyright.yml | 2 + 2 files changed, 101 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..5be667d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,99 @@ +# SPDX-FileCopyrightText: Estonian Information System Authority +# SPDX-License-Identifier: LGPL-2.1-or-later + +name: CodeQL +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 3 * * 1" # Weekly + +jobs: + swift: + name: CodeQL (swift) + if: contains(github.repository, 'open-eid/nfc-iOS-lib') + runs-on: macos-26 + timeout-minutes: 120 + permissions: + contents: read + actions: read + security-events: write + concurrency: + group: codeql-swift-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + strategy: + matrix: + xcode: + - 26.6 + platform: + - iOS + steps: + - name: Checkout + uses: actions/checkout@v7 + - name: Setup environment + run: | + export LANG=en_US.UTF-8 + + sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: Resolve package dependencies + run: | + cd ${{ github.workspace }} + + rm -rf "${{ runner.temp }}/codeql-build" + rm -rf ${{ github.workspace }}/.build + + swift package resolve \ + --scratch-path "${{ runner.temp }}/codeql-build" + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: swift + build-mode: manual + - name: Build + run: | + cd ${{ github.workspace }} + + swift build \ + --triple arm64-apple-ios18.0 \ + --sdk "$(xcrun --sdk iphoneos --show-sdk-path)" \ + --scratch-path "${{ runner.temp }}/codeql-build" + - name: Perform CodeQL analysis + uses: github/codeql-action/analyze@v4 + - name: Clean up + if: ${{ always() }} + run: | + rm -rf "${{ runner.temp }}/codeql-build" + rm -rf ${{ github.workspace }}/.build + + scripts: + name: CodeQL (${{ matrix.language }}) + if: contains(github.repository, 'open-eid/nfc-iOS-lib') + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + actions: read + security-events: write + concurrency: + group: codeql-${{ matrix.language }}-${{ github.ref }} + cancel-in-progress: true + strategy: + fail-fast: false + matrix: + language: + - actions + steps: + - name: Checkout + uses: actions/checkout@v7 + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + - name: Perform CodeQL analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml index 2b30c81..daf3f6f 100644 --- a/.github/workflows/copyright.yml +++ b/.github/workflows/copyright.yml @@ -3,6 +3,8 @@ name: Copyright headers on: [push, pull_request] +permissions: + contents: read jobs: copyright: name: Check copyright headers