Skip to content

Commit

Permalink
MNT Add CI workflow
Browse files Browse the repository at this point in the history
Also add editorconfig
  • Loading branch information
GuySartorelli committed Nov 1, 2023
1 parent a0cc10b commit 8779108
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[composer.json]
indent_size = 4
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
ci:
runs-on: ubuntu-latest
strategy:
# set fail-fast to false prevent one matrix job from cancelling other matrix jobs
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
fail-fast: false
matrix:
script: [ 'lint-md', 'lint-js', 'lint-php' ]
name: ${{ matrix.script }}
steps:

- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Read .nvmrc
id: read-nvm
run: |
NPM_VERSION=$(cat .nvmrc)
echo "version=$NPM_VERSION" >> $GITHUB_OUTPUT
- name: Install NPM
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version: ${{ steps.read-nvm.outputs.version }}

- name: Install yarn and dependencies
run: |
npm install --global yarn
yarn install
- name: Install PHP
if: ${{ matrix.script == 'lint-php' }}
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0
with:
php-version: 8.1

- name: Install composer dependencies
if: ${{ matrix.script == 'lint-php' }}
run: composer install --prefer-dist --no-progress --ansi --no-interaction --no-scripts --no-plugins --optimize-autoloader

- name: Run lint
run: yarn ${{ matrix.script }}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "docs",
"scripts": {
"lint-vale": "vale sync && vale en/00_Getting_Started",
"lint": "yarn lint-md && yarn lint-js && yarn lint-php && yarn lint-language",
"lint-fix": "yarn lint-md --fix; yarn lint-js --fix; yarn lint-php --fix; echo 'Fixed all auto-fixable problems'",
"lint-md": "markdownlint-cli2 en/**/*.md",
"lint-js": "eslint en",
"lint-php": "composer install --prefer-dist --no-progress --ansi --no-interaction --no-scripts --no-plugins --optimize-autoloader && vendor/bin/mdphpcs en"
"lint-php": "vendor/bin/mdphpcs en"
},
"dependencies": {
"@ocular-d/vale-bin": "^2.29.6",
Expand Down

0 comments on commit 8779108

Please sign in to comment.