lint-and-test.yml 1.4 KB

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