Skip to content
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
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: /
schedule:
interval: "weekly"
target-branch: "master"
groups:
github-actions-dependency:
applies-to: version-updates
patterns:
- "*"
- package-ecosystem: pip
directory: /src/python
schedule:
interval: weekly
target-branch: "master"
48 changes: 48 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "CodeQL Scan"

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
schedule:
- cron: "37 3 * * 0"

permissions: {} # No permissions by default on workflow level

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write # required to publish sarif

strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: python
build-mode: none
- language: c-cpp
build-mode: none

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
category: "/language:${{matrix.language}}"
21 changes: 15 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build Docs
permissions: read-all
permissions: {} # No permissions by default on workflow level

on:
workflow_dispatch: # run on request (no need for PR)
Expand All @@ -14,20 +14,29 @@ jobs:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
- name: Install dependencies
run: pip install 'src/python/.[docs]'
- name: Install and Generate Doxygen
uses: mattnotmitt/[email protected]
uses: mattnotmitt/doxygen-action@b84fe17600245bb5db3d6c247cc274ea98c15a3b # v1.12.0
- name: Build Docs
run: |
cd docs
make html
- name: Branch name
id: branch_name
shell: bash
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
- name: Create gh-pages branch
env:
SOURCE: ${{steps.branch_name.outputs.SOURCE_NAME}}
run: |
if [[ ${{github.event_name}} == 'workflow_dispatch' ]]; then
echo RELEASE_VERSION="test_build" >> $GITHUB_ENV
Expand All @@ -52,7 +61,7 @@ jobs:
git add .nojekyll
git commit -m "Initializing gh-pages branch"
git push origin gh-pages
git checkout ${{steps.branch_name.outputs.SOURCE_NAME}}
git checkout "${SOURCE}"
echo "Created gh-pages branch"
else
echo "Branch gh-pages already exists"
Expand All @@ -77,7 +86,7 @@ jobs:
git add index.html
git commit -m "Update documentation" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
11 changes: 8 additions & 3 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#####
# This workflow is triggered by pull_request_target event.
# Never checkout the PR and run ANY local code on it.
#####

name: "Pull Request Labeler"
permissions: read-all
permissions: {} # No permissions by default on workflow level
on:
- pull_request_target
- pull_request_target # zizmor: ignore[dangerous-triggers]

jobs:
labeler:
Expand All @@ -10,6 +15,6 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
49 changes: 43 additions & 6 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Pre-Commit Checks
permissions: read-all
permissions: {} # No permissions by default on workflow level

on:
push:
Expand All @@ -18,13 +18,15 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
- name: Set up Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
- name: Install clang-format
Expand All @@ -37,12 +39,47 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.9"
- name: Install dependencies
run: pip install 'src/python/.[tests,ovms]'
- name: Run python unit tests
run: pytest tests/python/unit
Zizmor-Scan-PR:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Run Zizmor scan
uses: open-edge-platform/anomalib/.github/actions/security/zizmor@fadfedd5150eb8cd39dfb659ae9bd0eb1c06720d
with:
scan-scope: "changed"
severity-level: "MEDIUM"
confidence-level: "HIGH"
fail-on-findings: true
Bandit-Scan-PR:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Run Bandit scan
uses: open-edge-platform/anomalib/.github/actions/security/bandit@fadfedd5150eb8cd39dfb659ae9bd0eb1c06720d
with:
scan-scope: "changed"
severity-level: "LOW"
confidence-level: "LOW"
config_file: "src/python/pyproject.toml"
fail-on-findings: true
26 changes: 13 additions & 13 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ on:
release:
types: [published]

# Declare default permissions as read only.
permissions: read-all
permissions: {} # No permissions by default on workflow level

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python 3.10
uses: actions/setup-python@v5
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
- name: Install pypa/build
Expand All @@ -25,14 +26,14 @@ jobs:
- name: Build sdist
run: |
python -m build --sdist src/python/
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-sdist
path: src/python/dist/*.tar.gz
- name: Build wheel
run: |
python -m build --wheel src/python/
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-wheel
path: src/python/dist/*.whl
Expand All @@ -43,9 +44,8 @@ jobs:
environment: pypi
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
id-token: write
contents: write # required by svenstaro/upload-release-action
id-token: write # required by trusted publisher
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
Expand All @@ -56,13 +56,13 @@ jobs:
# to determine where to publish the package distribution to PyPI or TestPyPI
- name: Check tag
id: check-tag
uses: actions-ecosystem/action-regex-match@v2
uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b # v2.0.2
with:
text: ${{ github.ref }}
regex: '^refs/tags/[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)+(\.[0-9]+rc[0-9]+|rc[0-9]+)?$'
- name: Upload package distributions to github
if: ${{ steps.check-tag.outputs.match != '' }}
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
uses: svenstaro/upload-release-action@ebd922b779f285dafcac6410a0710daee9c12b82 # v2.10.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
Expand All @@ -71,10 +71,10 @@ jobs:
file_glob: true
- name: Publish package distributions to PyPI
if: ${{ steps.check-tag.outputs.match != '' }}
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
- name: Publish package distributions to TestPyPI
if: ${{ steps.check-tag.outputs.match == '' }}
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
40 changes: 40 additions & 0 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Scorecards supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
schedule:
# Run security checks every day at 2 AM UTC
- cron: "0 2 * * *"
workflow_dispatch:

permissions: {}

jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard
security-events: write
# Needed to publish results and get a badge
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
with:
results_file: results.sarif
results_format: sarif
publish_results: true

# Upload the results to GitHub's code scanning dashboard
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
with:
sarif_file: results.sarif
Loading