lint-and-test.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. environment: "Unit Tests"
  19. steps:
  20. - name: Check out the repository
  21. uses: actions/checkout@v4
  22. with:
  23. submodules: recursive
  24. - name: Set up Node.js v${{ matrix.node-version }}
  25. uses: actions/setup-node@v4
  26. with:
  27. node-version: ${{ matrix.node-version }}
  28. - name: Set up pnpm
  29. uses: pnpm/action-setup@v4
  30. with:
  31. version: ${{ env.PNPM_VERSION }}
  32. run_install: false
  33. - name: Set up pnpm store directory
  34. shell: bash
  35. run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  36. - name: Set up pnpm cache
  37. uses: actions/cache@v4
  38. with:
  39. path: ${{ env.STORE_PATH }}
  40. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  41. restore-keys: ${{ runner.os }}-pnpm-store-
  42. - name: Install dependencies
  43. shell: bash
  44. run: pnpm install
  45. - name: Lint the code
  46. shell: bash
  47. run: pnpm run lint
  48. - name: Run unit tests
  49. shell: bash
  50. run: |
  51. echo "${{ secrets.DOTENV_FILE }}" > .env
  52. pnpm run test