diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 000000000..3103d8701 --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,2 @@ +paths-ignore: + - Examples diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fbcc01b4..9048811fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,15 @@ name: Build and Test SDK +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: pull_request: - branches: "**" + branches: ["**"] env: - DIFF_COVERAGE_THRESHOLD: '80' + DIFF_COVERAGE_THRESHOLD: "80" permissions: contents: read @@ -14,7 +18,7 @@ permissions: jobs: build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: "[Checkout] Repo" uses: actions/checkout@v4 @@ -63,14 +67,14 @@ jobs: fi COVERAGE_EXIT_CODE=$? set -e # Re-enable exit on error - + # Check if markdown report was generated if [ -f "diff_coverage.md" ]; then echo "✅ Coverage report generated" else echo "⚠️ Coverage report not generated" fi - + # Only fail the build if coverage is below threshold AND not bypassed if [ "${{ steps.coverage_bypass.outputs.bypass }}" != "true" ] && [ $COVERAGE_EXIT_CODE -ne 0 ]; then echo "❌ Coverage check failed - build will fail" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..48a1ff99d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,63 @@ +name: "CodeQL" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + schedule: + - cron: "27 1 * * 0" + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: java-kotlin + build-mode: none + dependency-caching: true + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + dependency-caching: ${{ matrix.dependency-caching }} + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + config-file: ./.github/codeql/codeql-config.yml + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 000000000..164f72fe5 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,14 @@ +# Checks if the PR title follows semantic commit message conventions +name: Lint PR +permissions: + contents: read + pull-requests: write + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + call: + uses: OneSignal/sdk-actions/.github/workflows/lint-pr-title.yml@main + secrets: inherit