mirror of
https://github.com/zhigang1992/react-content-loader.git
synced 2026-01-12 22:50:00 +08:00
ci(gh-actions): create CI action for testing and linting
This commit is contained in:
50
.github/workflows/ci.yml
vendored
Normal file
50
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Continuous Integration
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: ['10', '12', '14']
|
||||
name: "[v${{ matrix.node-version }}] lint and test"
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
# Check if cache exists, based on the hash of the lockfile
|
||||
- name: Cache node_modules
|
||||
id: cache-node_modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node-${{matrix.node-version}}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-${{matrix.node-version}}-
|
||||
${{ runner.os }}-node-
|
||||
${{ runner.os }}-
|
||||
|
||||
# If there is no cache available, we run npm installation in CI mode
|
||||
- name: Install dependencies
|
||||
if: steps.cache-node_modules.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
|
||||
# Build and check if it builds ok.
|
||||
- name: Build
|
||||
env:
|
||||
BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE }}
|
||||
run: npm run build
|
||||
Reference in New Issue
Block a user