7edf8038创建于 2022年12月15日历史提交
name: Test commit or pull request

on: [push, pull_request]

jobs:
  eslint:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version-file: .nvmrc
          cache: npm

      - name: Setup NPM
        run: |
          NPM_VERSION=$(jq -r .engines.npm package.json)
          NPM_VERSION=${NPM_VERSION/\^/}
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
            npm install -g npm@$NPM_VERSION && npm --version
          else
            echo "NPM version is same as package.json engines.npm"
          fi

      - name: Install dependencies
        run: npm ci

      - name: Test with eslint
        run: npm run test:eslint

  stylelint:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version-file: .nvmrc
          cache: npm

      - name: Setup NPM
        run: |
          NPM_VERSION=$(jq -r .engines.npm package.json)
          NPM_VERSION=${NPM_VERSION/\^/}
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
            npm install -g npm@$NPM_VERSION && npm --version
          else
            echo "NPM version is same as package.json engines.npm"
          fi

      - name: Install dependencies
        run: npm ci

      - name: Test with stylelint
        run: npm run test:stylelint

  i18n-packs:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version-file: .nvmrc
          cache: npm

      - name: Setup NPM
        run: |
          NPM_VERSION=$(jq -r .engines.npm package.json)
          NPM_VERSION=${NPM_VERSION/\^/}
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
            npm install -g npm@$NPM_VERSION && npm --version
          else
            echo "NPM version is same as package.json engines.npm"
          fi

      - name: Install dependencies
        run: npm ci

      - name: Test i18n packs integrity
        run: npm run test:i18n-packs