Skip to content

Commit

Permalink
ci: add checking of the code and security scorecard
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sanders <marksanders194@gmail.com>
  • Loading branch information
sandersms committed Mar 11, 2024
1 parent 1186773 commit 3576c78
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- "@commitlint/config-conventional"
20 changes: 20 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Commitlint

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ahmadnassri/action-commit-lint@v2.1.17
with:
config: ./.github/commitlintrc.yml
56 changes: 56 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Linters

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: docker run -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest --ignore=minutes --disable=MD013 "**/*.md"

# - uses: avto-dev/markdown-lint@v1.5.0
# with:
# args: './*.md'

docker-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0
with:
recursive: true
ignore: DL3018

shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azohra/shell-linter@v0.6.0

YAMLlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: docker-compose.yml
config_data: "{extends: default, rules: {line-length: disable}}"

golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: golangci/golangci-lint-action@v3
with:
working-directory: .
50 changes: 50 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: OpenSSF
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

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
id-token: write
actions: read
contents: read

steps:
- name: 'Checkout code'
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false

- name: 'Run analysis'
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true
repo-token: ${{ secrets.SCORECARD_TOKEN }}.

# Upload the results as artifacts.
- name: 'Upload artifact'
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@1813ca74c3faaa3a2da2070b9b8a0b3e7373a0d8 # v2.21.0
with:
sarif_file: results.sarif
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Protos

[![Linters](https://github.com/opiproject/pydpu/actions/workflows/linters.yml/badge.svg)](https://github.com/opiproject/pydpu/actions/workflows/linters.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/opiproject/pydpu/badge)](https://securityscorecards.dev/viewer/?platform=github.com&org=opiproject&repo=pydpu)

Prototyping files for varying solutions

- Python GRPC Gateway for Inventory and Networking API - grpc_gw
Expand Down

0 comments on commit 3576c78

Please sign in to comment.