Unverified Commit 50191fe8 authored by Michael Underwood's avatar Michael Underwood Committed by GitHub
Browse files

Merge pull request #288 from mikeu/master

Update github actions with tests and linting
parents 2f9ee9cd df2906b9
Loading
Loading
Loading
Loading
+49 −6
Original line number Diff line number Diff line
@@ -7,17 +7,60 @@ name: CI
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  publish:

  setup:
    name: Install and build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - name: Check out code
        uses: actions/checkout@v3

      - name: Set up Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
      - run: yarn
      - run: yarn build
      - uses: JS-DevTools/npm-publish@v1

      - name: Install dependencies
        run: yarn install --frozen-lockfile
      
      - name: Verify linting
        run: yarn lint-only --max-warnings=0

      - name: Build vue-leaflet
        run: yarn build

      - name: Cache results
        uses: actions/cache@v3
        with:
          path: ./*
          key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
  
  unit_tests:
    name: Run unit tests
    runs-on: ubuntu-latest
    needs: setup
    steps:
      - name: Restore cache
        uses: actions/cache@v3
        with:
          path: ./*
          key: ${{ runner.os }}-${{ github.ref }}-${{ github.sha }}-setup
      
      - name: Run tests
        run: yarn test

  publish:
    name: Publish if applicable
    runs-on: ubuntu-latest
    if: github.repository_owner == '@vue-leaflet'
    needs: 
      - unit_tests
    steps:
      - name: Publish to NPM
        uses: JS-DevTools/npm-publish@v1
        with:
          token: ${{ secrets.NPM_TOKEN }}
+3 −2
Original line number Diff line number Diff line
@@ -23,8 +23,9 @@
    "build": "run-p type-check build-only",
    "build-only": "vite build",
    "type-check": "vue-tsc --noEmit",
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
    "prepublishOnly": "npm run lint && npm run build",
    "lint": "yarn lint-cmd --fix src",
    "lint-only": "eslint src --ext .ts,.vue --ignore-path .gitignore",
    "prepublishOnly": "yarn lint && yarn run build",
    "postversion": "git push --follow-tags",
    "docs:dev": "vitepress dev docs",
    "docs:build": "vitepress build docs"