lint-and-test.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. name: "Lint and run tests"
  2. on:
  3. pull_request:
  4. branches: [main]
  5. workflow_dispatch:
  6. jobs:
  7. lint-and-test:
  8. name: Lint and Test
  9. runs-on: ubuntu-latest
  10. timeout-minutes: 4
  11. strategy:
  12. matrix:
  13. node-version: [22]
  14. env:
  15. CI: "true"
  16. STORE_PATH: ""
  17. PNPM_VERSION: 9
  18. steps:
  19. - name: Check out the repository
  20. uses: actions/checkout@v4
  21. with:
  22. submodules: recursive
  23. - name: Set up Node.js v${{ matrix.node-version }}
  24. uses: actions/setup-node@v4
  25. with:
  26. node-version: ${{ matrix.node-version }}
  27. - name: Set up pnpm
  28. uses: pnpm/action-setup@v4
  29. with:
  30. version: ${{ env.PNPM_VERSION }}
  31. run_install: false
  32. - name: Set up pnpm store directory
  33. shell: bash
  34. run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  35. - name: Set up pnpm cache
  36. uses: actions/cache@v4
  37. with:
  38. path: ${{ env.STORE_PATH }}
  39. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  40. restore-keys: ${{ runner.os }}-pnpm-store-
  41. - name: Install dependencies
  42. shell: bash
  43. run: pnpm install
  44. - name: Lint the code
  45. shell: bash
  46. run: pnpm run lint
  47. - name: Run unit tests
  48. shell: bash
  49. run: |
  50. echo "${{ secrets.DOTENV_FILE }}" > .env
  51. pnpm run test