Skip to content

CI: add code quality workflows #30

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
Dec 6, 2024
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
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # pyproject.toml
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "dependencies"
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "dependencies"
67 changes: 67 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# https://codeql.github.com/
name: CodeQL

on:
push:
paths:
- "**.js"
- "**.py"
pull_request:
branches: [main]
paths:
- "**.js"
- "**.py"
schedule:
- cron: "24 9 * * 6"

jobs:
setup:
name: Set up CodeQL analysis
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
outputs:
# changes is a JSON array with names of all filters matching any of the changed files
languages: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
javascript: "**.js"
python: "**.py"

codeql:
name: CodeQL Analyze
runs-on: ubuntu-latest
needs: setup
if: ${{ needs.setup.outputs.languages != '[]' }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['javascript', 'python'] if both file types had changes
language: ${{ fromJSON(needs.setup.outputs.languages) }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#specifying-configuration-details-using-the-config-input
config: |
paths-ignore:
- tests

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
24 changes: 24 additions & 0 deletions .github/workflows/dependency-triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Dependency PR triage"

on:
pull_request:
types: [opened]

jobs:
dependency-triage:
runs-on: ubuntu-latest
# see https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#responding-to-events
if: github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]'
steps:
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/compiler/projects/${{ vars.GH_PROJECT }}
github-token: ${{ secrets.GH_PROJECTS_TOKEN }}

- uses: EndBug/project-fields@v2
with:
operation: set
fields: Effort,Status
values: 1,In review
project_url: https://github.com/orgs/compiler/projects/${{ vars.GH_PROJECT }}
github_token: ${{ secrets.GH_PROJECTS_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/labeler-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Label actions

on:
pull_request:
types: [opened]
paths:
- ".github/dependabot.yml"
- ".github/workflows/**"

jobs:
label-actions:
runs-on: ubuntu-latest
steps:
- name: add-label
uses: andymckay/labeler@master
with:
add-labels: "actions"
19 changes: 19 additions & 0 deletions .github/workflows/labeler-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Label docs

on:
pull_request:
branches: [main]
types: [opened]
paths:
- "docs/**"
- "mkdocs.yml"
- ".github/workflows/mkdocs.yml"

jobs:
label-docs:
runs-on: ubuntu-latest
steps:
- name: add-label
uses: andymckay/labeler@master
with:
add-labels: "documentation"