From 2f05f14a4c758f038acf05d0862674fd53afd131 Mon Sep 17 00:00:00 2001 From: tyankatsu Date: Sun, 22 Aug 2021 13:17:11 +0900 Subject: [PATCH] ci: add test workflow (#89) * ci: add test workflow * empty commit * ci: change cache strategy * empty commit * ci: use npm install * empty commit * ci: use npm ci --- .github/workflows/release.yml | 12 +++--------- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/type-check.yml | 28 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/type-check.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7f3872..e9440aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,21 +14,15 @@ jobs: ref: main fetch-depth: 0 - - uses: actions/cache@v2 - id: cache - with: - path: node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - name: Use Node.js 12 - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: + cache: 'npm' + cache-dependency-path: package-lock.json registry-url: "https://registry.npmjs.org" node-version: "12.x" - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' run: npm ci - run: npx shipjs trigger diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..91df4e4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Test + +on: push + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + # Follow package.json engine field + node-version: [12.x, 13.x, 14.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + cache: 'npm' + cache-dependency-path: package-lock.json + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm ci + + - name: Test + run: npm run test diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml new file mode 100644 index 0000000..7259f1a --- /dev/null +++ b/.github/workflows/type-check.yml @@ -0,0 +1,28 @@ +name: Type check + +on: push + +jobs: + type-check: + runs-on: ubuntu-latest + + strategy: + matrix: + # Follow package.json engine field + node-version: [12.x, 13.x, 14.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + cache: 'npm' + cache-dependency-path: package-lock.json + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm ci + + - name: Typecheck + run: npm run typecheck