From ffcbdb2029fb91a0470bb9dbffdb6427386fcf1e Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 31 May 2020 14:58:08 +0300 Subject: [PATCH] Add lint and compile tests to CI. --- .../workflows/{node-install.yml => ci.yml} | 13 +++++-- .github/workflows/lint.yml | 39 +++++++++++++++++++ package.json | 3 +- 3 files changed, 51 insertions(+), 4 deletions(-) rename .github/workflows/{node-install.yml => ci.yml} (71%) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/node-install.yml b/.github/workflows/ci.yml similarity index 71% rename from .github/workflows/node-install.yml rename to .github/workflows/ci.yml index 9e12b4894..f42930dd0 100644 --- a/.github/workflows/node-install.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Node.js Install Test +name: CI on: pull_request: @@ -26,9 +26,16 @@ jobs: - "windows-latest" steps: - - uses: actions/checkout@v2 + - name: Clone repository + uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - - run: npm ci + + - name: Install npm dependencies + run: npm ci + + - name: Build files + run: npm run compile diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..a19372f4d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +name: Lint + +on: + pull_request: + release: + types: + - created + +env: + CI: true + NODE: 12.x + +jobs: + run: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: "${{ env.NODE }}" + + - name: Set up npm cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-v${{ env.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}} + restore-keys: | + ${{ runner.OS }}-node-v${{ env.node }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} + ${{ runner.OS }}-node-v${{ env.node }}- + + - name: Install npm dependencies + run: npm ci + + - name: Run lint + run: npm run lint diff --git a/package.json b/package.json index 3379af010..00aa2f65a 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,10 @@ "js": "npm-run-all --sequential js-compile js-minify", "js-compile": "rollup --config build/config/rollup.config.js --sourcemap", "js-minify": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/adminlte.js.map,includeSources,url=adminlte.min.js.map\" --output dist/js/adminlte.min.js dist/js/adminlte.js", + "lint": "npm run css-lint", "production": "npm-run-all --sequential compile plugins", "prepare-release": "npm-run-all --sequential production docs", - "test": "npm-run-all css-lint production", + "test": "npm-run-all lint production", "plugins": "node build/npm/Publish.js -v", "sync": "browser-sync start --server --files *.html pages/ dist/", "watch": "npm-run-all --parallel watch-css watch-js",