fix #255
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
name: "Front-end" | |
# ECMAScript version: ES5 (2009), ES6 (2015), ECMAScript 2016, 2017, 2018 ... | |
# Node.js version: 18.12 | |
# npm version: 9.2 | |
# | |
# https://github.com/tc39/proposals/blob/main/finished-proposals.md | |
# https://kangax.github.io/compat-table/es6/ | |
# https://nodejs.dev/en/about/releases/ | |
# https://www.npmjs.com/package/npm?activeTab=versions | |
# Set engine versions in package.json | |
# { | |
# "engines": { | |
# "node": "^18.12", | |
# "npm": "please-use-yarn", | |
# "yarn": "^1.22.19" | |
# } | |
# } | |
# Yarn is a better package manager. | |
on: # yamllint disable-line rule:truthy | |
pull_request: null | |
push: | |
branches: | |
- "master" | |
# Add [skip ci] to commit message to skip CI. | |
permissions: {} # yamllint disable-line rule:braces | |
#permissions: "read-all" | |
#permissions: | |
# contents: "read" # Private repositories need read permission | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
js_syntax_errors: | |
name: "𝟏 JavaScript Syntax Errors" | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- | |
name: "Checkout repository" | |
uses: "actions/[email protected]" | |
- | |
name: "Set up Node.js" | |
uses: "actions/[email protected]" | |
with: | |
node-version: "18" | |
check-latest: true | |
cache: "npm" | |
# cache: "yarn" | |
- | |
name: "Enable strict engine checking" | |
run: "npm config set engine-strict true" | |
#run: "yarn config set engine-strict true" | |
- | |
name: "Install all dependencies" | |
run: "npm ci" | |
#run: "yarn install --non-interactive --pure-lockfile" | |
- | |
name: "Check JavaScript files for syntax errors" | |
run: | | |
git ls-files --cached -z -- 'resources/js/*.js' \ | |
| xargs --null -- npx acorn --ecma2015 --module --silent | |
js_coding_standards: | |
name: "𝟐 JavaScript Coding Standards" | |
permissions: | |
checks: "write" | |
contents: "read" | |
pull-requests: "read" | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- | |
name: "Checkout repository" | |
uses: "actions/[email protected]" | |
- | |
name: "Set up Node.js" | |
uses: "actions/[email protected]" | |
with: | |
node-version: "18" | |
cache: "npm" | |
# cache: "yarn" | |
- | |
name: "Enable strict engine checking" | |
run: "npm config set engine-strict true" | |
#run: "yarn config set engine-strict true" | |
- | |
name: "Install all dependencies" | |
run: "npm ci" | |
#run: "yarn install --non-interactive --pure-lockfile" | |
- | |
name: "Run ESLint" | |
run: "npm run js:eslint -- --format json --output-file '${{ runner.temp }}/eslint-report.json'" | |
#run: "yarn run js:eslint --format json --output-file '${{ runner.temp }}/eslint-report.json'" | |
continue-on-error: true | |
- | |
name: "Annotate ESLint Results" | |
uses: "ataylorme/[email protected]" | |
with: | |
check-name: "𝕩 ESLint Annotations" | |
repo-token: "${{ github.token }}" | |
report-json: "${{ runner.temp }}/eslint-report.json" | |
scss_coding_standards: | |
name: "𝟑 Sassy CSS Coding Standards" | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- | |
name: "Checkout repository" | |
uses: "actions/[email protected]" | |
- | |
name: "Set up Node.js" | |
uses: "actions/[email protected]" | |
with: | |
node-version: "18" | |
cache: "npm" | |
# cache: "yarn" | |
- | |
name: "Enable strict engine checking" | |
run: "npm config set engine-strict true" | |
#run: "yarn config set engine-strict true" | |
- | |
name: "Install all dependencies" | |
run: "npm ci" | |
#run: "yarn install --non-interactive --pure-lockfile" | |
- | |
name: "Detect coding standards violations" | |
run: "npm run scss:cs -- --formatter github" | |
#run: "yarn run scss:cs --formatter github" | |
build: | |
name: "𝟒 Build" | |
needs: | |
- "js_syntax_errors" | |
- "js_coding_standards" | |
- "scss_coding_standards" | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- | |
name: "Checkout repository" | |
uses: "actions/[email protected]" | |
- | |
name: "Set up Node.js" | |
uses: "actions/[email protected]" | |
with: | |
node-version: "18" | |
cache: "npm" | |
# cache: "yarn" | |
- | |
name: "Enable strict engine checking" | |
run: "npm config set engine-strict true" | |
#run: "yarn config set engine-strict true" | |
- | |
name: "Install production dependencies" | |
run: "npm ci --omit=dev" | |
#run: "yarn install --non-interactive --pure-lockfile --production=true" | |
- | |
name: "Checks for security vulnerability advisories" | |
run: "npm audit --omit=dev" | |
#run: "yarn audit" | |
- | |
name: "Build front-end" | |
run: "npm run prod:build" | |
#run: "yarn run prod:build" | |
- | |
name: "Check differences to repository" | |
run: "git diff --exit-code" | |
svg: | |
name: "𝟓 SVG validity" | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 1 | |
steps: | |
- | |
name: "Checkout repository" | |
uses: "actions/[email protected]" | |
- | |
name: "Validate SVG files" | |
uses: "szepeviktor/[email protected]" | |
with: | |
svg_path: "public/**/*.svg" | |
# Job numbers: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols | |
# JavaScript documentation: https://jsdoc.app/ https://www.npmjs.com/package/eslint-plugin-jsdoc | |
# Validate HTML: https://www.npmjs.com/package/html-validate | |
# Validate JSON schema: https://www.npmjs.com/package/ajv |