Skip to content

CodeQL

CodeQL #171

Workflow file for this run

name: CodeQL
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '19 15 * * 1'
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
PACKAGE_XCODE_SCHEME: Spices
SWIFTUI_EXAMPLE_XCODE_SCHEME: SwiftUIExample
UIKIT_EXAMPLE_XCODE_SCHEME: UIKitExample
EXAMPLE_XCODE_PROJECT_PATH: Examples/Example.xcodeproj
BUILD_DESTINATION: platform=iOS Simulator,name=iPhone 16,OS=18.5
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-15') || 'ubuntu-latest' }}
permissions:
security-events: write
packages: read
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- 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 }}
- name: Build Swift Package
if: matrix.build-mode == 'manual' && matrix.language == 'swift'
shell: bash
run: |
set -o pipefail &&\
xcodebuild build-for-testing\
-scheme ${{ env.PACKAGE_XCODE_SCHEME }}\
-sdk iphonesimulator\
-destination "${{ env.BUILD_DESTINATION }}"\
| xcbeautify --renderer github-actions
- name: Build SwiftUI Example Project
if: matrix.build-mode == 'manual' && matrix.language == 'swift'
shell: bash
run: |
set -o pipefail &&\
xcodebuild build\
-project ${{ env.EXAMPLE_XCODE_PROJECT_PATH }}\
-scheme ${{ env.SWIFTUI_EXAMPLE_XCODE_SCHEME }}\
-sdk iphonesimulator\
-destination "${{ env.BUILD_DESTINATION }}"\
| xcbeautify --renderer github-actions
- name: Build UIKit Example Project
if: matrix.build-mode == 'manual' && matrix.language == 'swift'
shell: bash
run: |
set -o pipefail &&\
xcodebuild build\
-project ${{ env.EXAMPLE_XCODE_PROJECT_PATH }}\
-scheme ${{ env.UIKIT_EXAMPLE_XCODE_SCHEME }}\
-sdk iphonesimulator\
-destination "${{ env.BUILD_DESTINATION }}"\
| xcbeautify --renderer github-actions
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"