mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 14:03:24 +00:00
130 lines
3.4 KiB
YAML
130 lines
3.4 KiB
YAML
---
|
|
name: Lint Code Base
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- dev_2.0
|
|
paths-ignore:
|
|
- 'archive/**'
|
|
pull_request:
|
|
branches:
|
|
- dev_2.0
|
|
paths-ignore:
|
|
- 'archive/**'
|
|
|
|
jobs:
|
|
pythonlint:
|
|
name: pythonlint
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45
|
|
with:
|
|
files: |
|
|
src/mscp/**.py
|
|
|
|
- name: Set up Python
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12.1'
|
|
|
|
- name: Install dependencies
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
run: |
|
|
python3 -m pip install --upgrade flake8 flake8-bugbear
|
|
|
|
- name: Lint Python files
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
run: flake8 --config .github/linters/tox.ini src/mscp
|
|
|
|
yamllint:
|
|
name: yamllint
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45
|
|
with:
|
|
files: |
|
|
**.yml
|
|
**.yaml
|
|
|
|
- name: Set up Python
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
|
|
- name: Install yamllint
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
shell: bash
|
|
run: |
|
|
pip install --user yamllint
|
|
|
|
- name: Run yamllint
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
run: |
|
|
yamllint --config-file .github/linters/.yamllint.yaml --format github ${{ steps.changed-files.outputs.all_changed_files }}
|
|
|
|
markdownlint:
|
|
name: markdownlint
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45
|
|
with:
|
|
files: |
|
|
**.md
|
|
|
|
- name: Run markdownlint-cli2
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
uses: bjw-s/action-markdownlint-cli2@c3c44cc6f77516007f1a85d982ed6276e840dcec # v0.1
|
|
with:
|
|
markdownlint_config: .github/linters/.markdownlint.yaml
|
|
file_pattern: ${{ steps.changed-files.outputs.all_changed_files }}
|
|
|
|
lint_success:
|
|
needs:
|
|
- pythonlint
|
|
- yamllint
|
|
- markdownlint
|
|
if: |
|
|
always()
|
|
name: Lint successful
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check job status
|
|
if: >-
|
|
${{
|
|
(
|
|
contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
|
|
)
|
|
}}
|
|
run: exit 1
|