From e0c24917f251473f05bb7563996bd25ab55b7290 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Wed, 3 Sep 2025 23:46:21 -0700 Subject: [PATCH] Add codeql workflow (#655) * Add codeql workflow * Disable signing on codeql workflow Updated build command to disable code signing. * Archive * Temporarily disable previews * Try disabling hardening * Release mode * Previews * Temporarily disable. * Update xcodebuild command in codeql.yml * Try swift build output * Fix * Revert "Fix" This reverts commit 064172779a4fde99a8557f743de4b0a8ba646b9b. * Revert "Try swift build output" This reverts commit a3aa98222301246bcbe1762e4b50d030189c8c9d. * Reset most stuff back to main * Cleanup workflows and limit a few jobs to read. * . --- .github/workflows/codeql.yml | 47 +++++++++++++++++++++++++++++++++++ .github/workflows/nightly.yml | 1 - .github/workflows/release.yml | 6 ++--- .github/workflows/test.yml | 3 ++- 4 files changed, 52 insertions(+), 5 deletions(-) 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..d5fb7f3 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,47 @@ +name: "CodeQL Advanced" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '26 15 * * 3' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + security-events: write + packages: read + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + # Disable this until CodeQL supports Xcode 26 builds. + # - language: swift + # build-mode: manual + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + - if: matrix.build-mode == 'manual' + name: "Select Xcode" + run: sudo xcrun xcode-select -s /Applications/Xcode_26.0.app + - if: matrix.build-mode == 'manual' + name: "Build" + run: xcrun xcodebuild -project Sources/Secretive.xcodeproj -scheme Secretive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index dc61369..16b8178 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,7 +7,6 @@ on: jobs: build: -# runs-on: macOS-latest runs-on: macos-15 permissions: id-token: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da81788..9d69dfa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,8 @@ on: - '*' jobs: test: -# runs-on: macOS-latest + permissions: + contents: read runs-on: macos-15 timeout-minutes: 10 steps: @@ -25,12 +26,11 @@ jobs: - name: Test run: swift test --build-system swiftbuild --package-path Sources/Packages build: -# runs-on: macOS-latest - runs-on: macos-15 permissions: id-token: write contents: write attestations: write + runs-on: macos-15 timeout-minutes: 10 steps: - uses: actions/checkout@v5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e790e2f..2fb5150 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,8 @@ name: Test on: [push, pull_request] jobs: test: -# runs-on: macOS-latest + permissions: + contents: read runs-on: macos-15 timeout-minutes: 10 steps: