Test #157
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
schedule: | |
- cron: "0 0 1 * *" | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_call: | |
jobs: | |
test: | |
name: Test | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- macos-latest | |
- windows-latest | |
- ubuntu-latest | |
node-version: | |
- 14 | |
- 15 | |
- 16 | |
- 17 | |
- 18 | |
runs-on: ${{ matrix.os }} | |
env: | |
OS: ${{ matrix.os }} | |
NODE_VERSION: ${{ matrix.node-version }} | |
REF: ${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ github.ref_name }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
node-modules-${{ matrix.os }}-${{ github.ref_name }}-${{ matrix.node-version }} | |
node-modules-${{ matrix.os }}-main-${{ matrix.node-version }} | |
node-modules-${{ matrix.os }}-${{ github.ref_name }}- | |
node-modules-${{ matrix.os }}-main- | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm i --no-fund | |
- name: Check code styles | |
run: npm run lint | |
- name: Build the project | |
run: npm run build | |
- name: Test the project | |
run: npm run test:ci | |
- name: Upload coverage to CodeCov | |
uses: codecov/codecov-action@v3 | |
if: ${{ github.event_name != 'schedule'}} | |
with: | |
env_vars: OS,NODE_VERSION,REF | |
fail_ci_if_error: true |