From 35e81dfbd344bf511419610a0f92f4c77291c233 Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Sun, 24 May 2020 11:47:39 +0200 Subject: [PATCH 1/2] chore: add tests to github-actions workflow --- .github/workflows/{lint.yml => ci.yml} | 48 +++++++++++++++++++++++--- package.json | 1 + 2 files changed, 45 insertions(+), 4 deletions(-) rename .github/workflows/{lint.yml => ci.yml} (50%) diff --git a/.github/workflows/lint.yml b/.github/workflows/ci.yml similarity index 50% rename from .github/workflows/lint.yml rename to .github/workflows/ci.yml index a411a68d..9581510f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/ci.yml @@ -8,20 +8,19 @@ env: NODE_VERSION: "12.x" jobs: - eslint: - name: Eslint + setup: + name: Setup runs-on: ubuntu-latest timeout-minutes: 5 steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 - uses: actions/setup-node@v1 with: node-version: "${{ env.NODE_VERSION }}" - name: Cache node modules + id: cache uses: actions/cache@v1 with: path: node_modules @@ -31,9 +30,50 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: npm ci + eslint: + name: Eslint + runs-on: ubuntu-latest + needs: [setup] + timeout-minutes: 5 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v1 + with: + node-version: "${{ env.NODE_VERSION }}" + - name: Fetch all branches run: | git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + - name: Cache node modules + uses: actions/cache@v1 + with: + path: node_modules + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} + - name: ESLint run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx') + + tests: + name: Tests + runs-on: ubuntu-latest + needs: [setup] + timeout-minutes: 5 + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: "${{ env.NODE_VERSION }}" + + - name: Cache node modules + uses: actions/cache@v1 + with: + path: node_modules + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} + + - name: unit tests + run: npm run ci:test \ No newline at end of file diff --git a/package.json b/package.json index 065a52c4..24e98ad2 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "eslint 'src/**/*.js' --quiet --fix", "clean": "rimraf ./dist ./.cache", "ci:lint": "eslint 'src/**/*.js' -c ./.eslintrc.js", + "ci:test": "jest --ci" , "test": "jest", "test:watch": "jest --watch" }, From 5aec6875aa059a4afbb87e7f61a17dc6e0ed953d Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Sun, 24 May 2020 11:55:49 +0200 Subject: [PATCH 2/2] chore: fix capital letter --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9581510f..5ba78b00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} - - name: ESLint + - name: Run Eslint run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx') tests: @@ -75,5 +75,5 @@ jobs: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} - - name: unit tests + - name: Run Tests run: npm run ci:test \ No newline at end of file