-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6955e19
commit 8ed024d
Showing
14 changed files
with
149 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,24 @@ on: | |
- main | ||
|
||
jobs: | ||
checks: | ||
component-tests: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
- name: Checkout source | ||
uses: actions/[email protected] | ||
|
||
- name: Component tests for essential checks | ||
uses: ./essentials | ||
- name: Check typos on source files and docs | ||
uses: ./quality/typos | ||
|
||
- name: Lint Bash scripts | ||
uses: ./quality/bash | ||
|
||
- name: Lint Markdown files | ||
uses: ./quality/markdown | ||
|
||
- name: Check MIT license on source files | ||
uses: ./foss/check-licenses | ||
with: | ||
file-patterns: "*.sh" | ||
license: "mit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "check-licenses" | ||
description: "Check open-source licence on source code headers" | ||
|
||
inputs: | ||
file-patterns: | ||
description: “Patterns to look in source files, comma separated” | ||
required: true | ||
|
||
license: | ||
description: “Open-source license to enforce” | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Check licenses on source files | ||
shell: bash | ||
run: ${{ github.action_path }}/license-checker.sh $GITHUB_WORKSPACE ${{ inputs.file-patterns }} ${{ inputs.license }} |
19 changes: 15 additions & 4 deletions
19
src/license-enforcer.sh → foss/check-licenses/license-checker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: "bash-linter" | ||
description: "Lint all Bash scripts" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Lint Bash Scripts | ||
shell: bash | ||
run: ${{ github.action_path }}/bash-linter.sh $GITHUB_WORKSPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: "markdown-linter" | ||
description: "Check structure for markdown file and enforce valid links" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Lint Markdown files | ||
shell: bash | ||
run: ${{ github.action_path }}/markdown-linter.sh $GITHUB_WORKSPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2024 Dotanuki Labs | ||
# SPDX-License-Identifier: MIT | ||
|
||
# shellcheck disable=SC1091 | ||
|
||
set -eo pipefail | ||
|
||
readonly target_folder="$1" | ||
|
||
# https://github.com/igorshubovych/markdownlint-cli | ||
readonly markdownlint="ghcr.io/igorshubovych/markdownlint-cli:latest" | ||
|
||
# https://github.com/lycheeverse/lychee | ||
readonly lychee="lycheeverse/lychee:latest" | ||
|
||
require_docker_daemon() { | ||
if (! docker stats --no-stream >/dev/null); then | ||
echo "Docker is required for this execution" | ||
echo | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_docker_image() { | ||
local image_spec="$1" | ||
echo "Pulling Docker image : $image_spec" | ||
docker pull "$image_spec" >/dev/null 2>&1 | ||
} | ||
|
||
lint_markdown() { | ||
echo | ||
echo "→ Linting markdown files (markdownlint)" | ||
docker run --rm -v "$target_folder:/workdir" "$markdownlint" "**/*.md" | ||
} | ||
|
||
check_broken_links() { | ||
echo | ||
echo "→ Checking broken links (lychee)" | ||
docker run --rm -w /input -v "$target_folder:/input" "$lychee" "**/*.md" | ||
} | ||
|
||
echo | ||
echo "🔥 Linting Markdown files" | ||
echo | ||
|
||
require_docker_daemon | ||
require_docker_image "$markdownlint" | ||
require_docker_image "$lychee" | ||
|
||
lint_markdown | ||
check_broken_links | ||
|
||
echo | ||
echo "✅ All good!" | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: "typos-checker" | ||
description: "Inspect source files for typos and spelling" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Check typos everywhere | ||
uses: crate-ci/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.