Skip to content

chore: update global workflows #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 46 additions & 17 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
# This action is centrally managed in https://github.com/<organization>/.github/
# This workflow is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

# This workflow will analyze all supported languages in the repository using CodeQL Analysis.

name: "CodeQL"
permissions:
contents: read

on:
push:
branches: ["master"]
branches:
- master
pull_request:
branches: ["master"]
branches:
- master
schedule:
- cron: '00 12 * * 0' # every Sunday at 12:00 UTC

Expand All @@ -22,14 +26,17 @@ concurrency:
jobs:
languages:
name: Get language matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.lang.outputs.result }}
continue: ${{ steps.continue.outputs.result }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get repo languages
uses: actions/github-script@v7
id: lang
uses: actions/github-script@v7
with:
script: |
// CodeQL supports ['cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift']
Expand All @@ -54,6 +61,22 @@ jobs:
// Track languages we've already added to avoid duplicates
const addedLanguages = new Set()

// Check if workflow files exist to determine if we should add actions language
const fs = require('fs');
const hasYmlFiles = fs.existsSync('.github/workflows') &&
fs.readdirSync('.github/workflows').some(file => file.endsWith('.yml') || file.endsWith('.yaml'));

// Add actions language if workflow files exist
if (hasYmlFiles) {
console.log('Found GitHub Actions workflow files. Adding actions to the matrix.');
matrix['include'].push({
"category": "/language:actions",
"language": "actions",
"name": "actions",
"os": "ubuntu-latest"
});
}

for (let [key, value] of Object.entries(response.data)) {
// remap language
if (remap_languages[key.toLowerCase()]) {
Expand All @@ -78,11 +101,18 @@ jobs:
// set name for matrix
let name = osList.length === 1 ? normalizedKey : `${normalizedKey}, ${os}`

// set category for matrix
let category = `/language:${normalizedKey}`
if (normalizedKey === 'cpp') {
category = `/language:cpp-${os.split('-')[0]}`
}

// add to matrix
matrix['include'].push({
"category": category,
"language": normalizedKey,
"os": os,
"name": name
"name": name,
"os": os
})
}
}
Expand All @@ -94,8 +124,8 @@ jobs:
return matrix

- name: Continue
uses: actions/github-script@v7
id: continue
uses: actions/github-script@v7
with:
script: |
// if matrix['include'] is an empty list return false, otherwise true
Expand All @@ -109,24 +139,22 @@ jobs:

analyze:
name: Analyze (${{ matrix.name }})
if: ${{ needs.languages.outputs.continue == 'true' }}
if: needs.languages.outputs.continue == 'true'
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
env:
GITHUB_CODEQL_BUILD: true
needs: [languages]
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
needs: languages
permissions:
actions: read
contents: read
security-events: write

runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.languages.outputs.matrix) }}

timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
steps:
- name: Maximize build space
if: >-
Expand Down Expand Up @@ -174,8 +202,7 @@ jobs:
- third-party

# Pre autobuild
# create a file named .codeql-prebuild-${{ matrix.language }}.sh in the root of your repository
# create a file named .codeql-build-${{ matrix.language }}.sh in the root of your repository
# create a file named .codeql-prebuild-${{ matrix.language }}-${{ runner.os }}.sh in the root of your repository
- name: Prebuild
id: prebuild
run: |
Expand All @@ -194,7 +221,7 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
category: "${{ matrix.category }}"
output: sarif-results
upload: failure-only

Expand All @@ -211,11 +238,13 @@ jobs:
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
category: "${{ matrix.category }}"
sarif_file: sarif-results/${{ matrix.language }}.sarif

- name: Upload loc as a Build Artifact
uses: actions/upload-artifact@v4
with:
name: sarif-results-${{ matrix.language }}-${{ runner.os }}
path: sarif-results
if-no-files-found: error
retention-days: 1
18 changes: 12 additions & 6 deletions .github/workflows/common-lint.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
---
# This action is centrally managed in https://github.com/<organization>/.github/
# This workflow is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

# Common linting.

name: common lint
permissions:
contents: read

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
branches:
- master
types:
- opened
- synchronize
- reopened

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
Expand Down Expand Up @@ -77,9 +83,10 @@ jobs:
- name: C++ - Clang format lint
if: always() && steps.cpp_files.outputs.found_files
uses: DoozyX/clang-format-lint-action@v0.18
uses: DoozyX/clang-format-lint-action@v0.20
with:
source: ${{ steps.cpp_files.outputs.found_files }}
clangFormatVersion: '20'
extensions: 'c,cpp,h,hpp,m,mm'
style: file
inplace: false
Expand Down Expand Up @@ -263,5 +270,4 @@ jobs:

- name: YAML - log
if: always() && steps.yamllint.outcome == 'failure'
run: |
cat "${{ steps.yamllint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY
run: cat "${{ steps.yamllint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY
11 changes: 8 additions & 3 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
---
# This action is centrally managed in https://github.com/<organization>/.github/
# This workflow is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.

# Label and un-label actions using `../label-actions.yml`.

name: Issues
permissions: {}

on:
issues:
types: [labeled, unlabeled]
types:
- labeled
- unlabeled
discussion:
types: [labeled, unlabeled]
types:
- labeled
- unlabeled

jobs:
label:
Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/update-pages.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
name: Update
permissions:
contents: read

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
branches:
- master
types:
- opened
- synchronize
- reopened
push:
branches: [master]
branches:
- master
schedule:
- cron: '0 * * * *' # every hour
workflow_dispatch:
Expand Down Expand Up @@ -46,8 +53,7 @@ jobs:
python -m pip install -r requirements.txt

- name: Install npm dependencies
run: |
npm install
run: npm install

- name: Get current date
id: date
Expand Down Expand Up @@ -89,8 +95,7 @@ jobs:
./notebook/dashboard.ipynb

- name: Cat log
run: |
cat ./logs/updater.log
run: cat ./logs/updater.log

- name: Check notebook for tracebacks
run: |
Expand All @@ -100,26 +105,27 @@ jobs:
grep -i -E 'Traceback \(most recent call last\):' ./gh-pages/index.html && exit 1 || true

- name: Archive gh-pages
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
shell: bash
run: |
7z \
"-xr!*.git*" \
a "./gh-pages.zip" "./gh-pages"

- name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: gh-pages
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
if-no-files-found: error
path: |
${{ github.workspace }}/gh-pages.zip

- name: Deploy to gh-pages
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
Expand Down