mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-27 20:19:16 +01:00
* Remove public folder to prepare for submodule * Add submodule and update licensing * Stop serving non-asset files during build * Update pull request template * Update CODEOWNERS * Add locales submodule * Update pull request template regarding locales * remove post-checkout lefthook in favor of git config * chore: add license info to new script * Update gh pages workflow * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * update assets
123 lines
3.5 KiB
YAML
123 lines
3.5 KiB
YAML
name: Linting
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- beta
|
|
- release
|
|
- "hotfix*"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- beta
|
|
- release
|
|
- "hotfix*"
|
|
merge_group:
|
|
types: [checks_requested]
|
|
|
|
jobs:
|
|
run-linters:
|
|
name: Run all linters
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: "recursive"
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
cache: "pnpm"
|
|
|
|
- name: Install Node modules
|
|
run: pnpm i
|
|
|
|
# Lint files with Biome-Lint - https://biomejs.dev/linter/
|
|
- name: Run Biome-Lint
|
|
run: pnpm biome-ci
|
|
id: biome_lint
|
|
continue-on-error: true
|
|
|
|
# Validate dependencies with dependency-cruiser - https://github.com/sverweij/dependency-cruiser
|
|
- name: Run Dependency-Cruise
|
|
run: pnpm depcruise
|
|
id: depcruise
|
|
continue-on-error: true
|
|
|
|
# Validate types with tsc - https://www.typescriptlang.org/docs/handbook/compiler-options.html#using-the-cli
|
|
- name: Run Typecheck
|
|
run: pnpm typecheck
|
|
id: typecheck
|
|
continue-on-error: true
|
|
|
|
# The exact same thing
|
|
- name: Run Typecheck (scripts)
|
|
run: pnpm typecheck:scripts
|
|
id: typecheck-scripts
|
|
continue-on-error: true
|
|
|
|
# NOTE: This step *must* run as the last linter; it deletes files in `assets/`
|
|
# Files in assets/ do not yet have full licensing information, so remove them before checking for reuse compliance
|
|
- name: Prepare for reuse compliance
|
|
run: rm -rf assets/* LICENSES/LicenseRef-*
|
|
|
|
- name: Check for reuse compliance
|
|
id: reuse-lint
|
|
uses: fsfe/reuse-action@v5
|
|
continue-on-error: true
|
|
|
|
- name: Evaluate for Errors
|
|
env:
|
|
BIOME_LINT_OUTCOME: ${{ steps.biome_lint.outcome }}
|
|
DEPCRUISE_OUTCOME: ${{ steps.depcruise.outcome }}
|
|
TYPECHECK_OUTCOME: ${{ steps.typecheck.outcome }}
|
|
TYPECHECK_SCRIPTS_OUTCOME: ${{ steps.typecheck-scripts.outcome }}
|
|
REUSE_OUTCOME: ${{ steps.reuse-lint.outcome }}
|
|
run: |
|
|
# Check for Errors
|
|
|
|
# Make text red.
|
|
red () {
|
|
printf "\e[31m%s\e[0m" "$1"
|
|
}
|
|
|
|
# Make text green.
|
|
green () {
|
|
printf "\e[32m%s\e[0m" "$1"
|
|
}
|
|
|
|
print_result() {
|
|
local name=$1
|
|
local outcome=$2
|
|
if [ "$outcome" == "success" ]; then
|
|
printf "$(green "✅ $name: $outcome")\n"
|
|
else
|
|
printf "$(red "❌ $name: $outcome")\n"
|
|
fi
|
|
}
|
|
|
|
print_result "Biome" "$BIOME_LINT_OUTCOME"
|
|
print_result "Depcruise" "$DEPCRUISE_OUTCOME"
|
|
print_result "Typecheck" "$TYPECHECK_OUTCOME"
|
|
print_result "Typecheck scripts" "$TYPECHECK_SCRIPTS_OUTCOME"
|
|
print_result "Reuse Compliance" "$REUSE_OUTCOME"
|
|
|
|
if [[ "$BIOME_LINT_OUTCOME" != "success" || \
|
|
"$DEPCRUISE_OUTCOME" != "success" || \
|
|
"$TYPECHECK_OUTCOME" != "success" || \
|
|
"$TYPECHECK_SCRIPTS_OUTCOME" != "success" || \
|
|
"$REUSE_OUTCOME" != "success" ]]; then
|
|
printf "$(red "❌ One or more checks failed!")\n" >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf "$(green "✅ All checks passed!")\n"
|