Skip to content

Commit

Permalink
Yaml Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan committed Sep 28, 2024
1 parent 077242a commit 0bcb172
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @andrewjswan
32 changes: 16 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build / CEC Remote
on:
push:
# On Push to Master branch
branches:
branches:
- master
# Ignore all Tags / Release
tags-ignore:
Expand Down Expand Up @@ -68,21 +68,21 @@ jobs:
outputs:
changes: ${{ steps.changes.outputs.xmp }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
xmp:
- '**.xmp2'
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
xmp:
- '**.xmp2'
codeql:
name: CodeQL
if: ${{ needs.changes.outputs.changes == 'true' }}
uses: andrewjswan/MPE/.github/workflows/codeql.yml@master
uses: Mediaportal-Plugin-Team/Mediaportal-Tools/.github/workflows/codeql.yml@master
with:
build-path: CecRemote\Installer
needs:
needs:
- build
- changes
permissions:
Expand All @@ -108,7 +108,7 @@ jobs:
- name: Git Checkout / MPE / XPath
uses: actions/checkout@v4
with:
repository: andrewjswan/MPE
repository: Mediaportal-Plugin-Team/Mediaportal-Tools
path: MPE

- name: MP folder for MPEMaker
Expand Down Expand Up @@ -230,8 +230,8 @@ jobs:
- name: Delete XML Artifact
uses: geekyeggo/delete-artifact@v5
with:
name: CECRemote XML
failOnError: false
name: CECRemote XML
failOnError: false

release:
name: CEC Remote / Release
Expand All @@ -243,9 +243,9 @@ jobs:
contents: write
outputs:
changes: ${{ needs.mpe.outputs.changes }}

runs-on: ubuntu-latest

steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
- name: Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1

cache-clear:
name: Clear cache
runs-on: ubuntu-latest
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/workflow_validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Workflow / Validate

on:
push:
pull_request:

jobs:
changes:
name: 👀 Source / Changed
runs-on: ubuntu-latest
outputs:
python: ${{ steps.changes.outputs.python }}
yaml: ${{ steps.changes.outputs.yaml }}
cpp: ${{ steps.changes.outputs.cpp }}
steps:
- name: ⬇️ Check out Repo
uses: actions/checkout@v4

- name: ⚙️ Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
python:
- '**.py'
- 'requirements.txt'
yaml:
- '**.yaml'
- '**.yml'
cpp:
- '**.cpp'
- '**.h'
python:
name: 🧹 Python Ruff
if: ${{ needs.changes.outputs.python == 'true' }}
needs:
- changes
runs-on: ubuntu-latest
steps:
- name: ⬇️ Check out Repo
uses: actions/checkout@v4

- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: 📦 Install requirements
run: python3 -m pip install -r .github/requirements.txt

- name: ⚙️ Lint
run: python3 -m ruff check .

- name: 💅 Format
run: python3 -m ruff format . --check

- name: 💅 Format Diff
if: failure()
run: python3 -m ruff format . --check --diff

yamllint:
name: 🧹 Yaml Lint
if: ${{ needs.changes.outputs.yaml == 'true' }}
needs:
- changes
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out Repo
uses: actions/checkout@v4

- name: 🚀 Run yamllint
run: yamllint --strict .

cpplinter:
name: 🧹 C++ Lint
if: ${{ needs.changes.outputs.cpp == 'true' }}
needs:
- changes
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out Repo
uses: actions/checkout@v4

- name: 🚀 Run C++ linter
uses: cpp-linter/cpp-linter-action@v2
id: linter
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
files-changed-only: false
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}

- name: Fail fast?!
if: steps.linter.outputs.checks-failed != 0
run: |
echo "some linter checks failed. ${{ steps.linter.outputs.checks-failed }}"
# for actual deployment
# run: exit 1

ci-status:
name: 🎭 Status
runs-on: ubuntu-latest
needs:
- python
- yamllint
- cpplinter
if: always()
steps:
- name: 🎉 Success
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: ❌ Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Build output
[Bb]in
[Oo]bj
[Dd]ebug
[Rr]elease

# Visual Studio
.vs

# User specific files
*.suo
*.user
*.log
*.bak
21 changes: 21 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
extends: default

ignore-from-file: .gitignore

rules:
document-start: disable
empty-lines:
level: error
max: 1
max-start: 0
max-end: 1
indentation:
level: error
spaces: 2
indent-sequences: true
check-multi-line-strings: false
line-length: disable
truthy: disable
new-lines: disable
comments-indentation: disable

0 comments on commit 0bcb172

Please sign in to comment.