Cleanup package.json scripts (#5885)
#16036
This file contains hidden or 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: QA | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review, labeled] | |
| jobs: | |
| check-lock: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Validate lock file | |
| run: | | |
| npx lockfile-lint --path package-lock.json --allowed-hosts npm yarn | |
| tsc-and-linters: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-qa-${{ env.cache-name }}- | |
| ${{ runner.os }}-qa- | |
| ${{ runner.os }}- | |
| - name: Install deps | |
| run: | | |
| npm ci | |
| - name: Run tsc | |
| run: | | |
| npm run check-types | |
| - name: Run lint | |
| run: | | |
| npm run lint | |
| git diff --exit-code ./src | |
| - name: Check Prettier formatting | |
| run: | | |
| npm run format:check | |
| jest-tests: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-qa-${{ env.cache-name }}- | |
| ${{ runner.os }}-qa- | |
| ${{ runner.os }}- | |
| - name: Install deps | |
| run: | | |
| npm ci | |
| - name: Run jest | |
| run: | | |
| npm run test:ci | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: saleor/saleor-dashboard | |
| translation-messages: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-qa-${{ env.cache-name }}- | |
| ${{ runner.os }}-qa- | |
| ${{ runner.os }}- | |
| - name: Install deps | |
| run: | | |
| npm ci | |
| - name: Check message extraction | |
| run: | | |
| npm run extract-messages | |
| git diff --exit-code ./locale |