From 2ffff0fa618ece5bec901f1ba59a284d426b1fad Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 30 Jul 2021 12:56:31 +0900 Subject: [PATCH] ci: use `npm ci` to improve CI performance --- .github/workflows/lint.yml | 30 +++++++++++++++++--------- .github/workflows/test.yml | 44 +++++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 25 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ff8a1c4535..cdf6d202e0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,13 +8,23 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 16.x - - name: Install - run: npm i - - name: Lint - run: npm run lint + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 16.5.0 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: npm- + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 630ee1cf59..75d38af78a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,21 +16,35 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [16.5.0] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install - run: npm i - - name: Build - run: npm run build - - name: Test - run: npm run test - - name: Upload Coverage - uses: codecov/codecov-action@v1 + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: npm- + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Test + run: npm test + env: + CI: true + + - name: Upload Coverage + uses: codecov/codecov-action@v1