name: Test
on:
  push:
    branches:
      - master
  pull_request:
    types: [opened, reopened, synchronize]
jobs:
  test:
    strategy:
      matrix:
        node-version: [18.x]
        platform: [ubuntu-latest]
    runs-on: ${{ matrix.platform }}
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: 'Install dependencies'
      run: npm ci
    - name: 'Test'
      run: npm run test
    - name: Build vuepress
      run: npm run docs:build
    - name: Codecov
      uses: codecov/codecov-action@v1
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        file: ./coverage/coverage-final.json
    - name: Slack Notification
      uses: rtCamp/action-slack-notify@v2
      env:
        SLACK_COLOR: ${{ job.status }}
        SLACK_CHANNEL: github
        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
