|
| 1 | +name: Backend Quality Assurance |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
| 6 | + branches: [main, develop] |
| 7 | + paths: |
| 8 | + - '.github/workflows/backend-unit-tests.yml' |
| 9 | + - 'apps/backend-services/src/**' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + get-environment: |
| 14 | + name: Prepare Environment |
| 15 | + runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + environment: ${{ steps.env.outputs.environment }} |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + - name: Get Environment |
| 22 | + id: env |
| 23 | + uses: ./.github/actions/get-environment |
| 24 | + - name: Setup Node |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node_version: '24' |
| 28 | + - name: Cache node modules |
| 29 | + uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: ./node_modules |
| 32 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 33 | + restore-keys: | |
| 34 | + ${{ runner.os }}-node- |
| 35 | + - name: Install dependencies |
| 36 | + run: npm ci |
| 37 | + |
| 38 | + unit-tests: |
| 39 | + name: Unit Tests |
| 40 | + needs: get-environment |
| 41 | + runs-on: ubuntu-latest |
| 42 | + defaults: |
| 43 | + run: |
| 44 | + working-directory: apps/backend |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v4 |
| 48 | + - name: Setup Node.js |
| 49 | + uses: actions/setup-node@v4 |
| 50 | + with: |
| 51 | + node-version: '24' |
| 52 | + - name: Restore Node.js modules cache |
| 53 | + uses: actions/cache@v4 |
| 54 | + with: |
| 55 | + path: ./node_modules |
| 56 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 57 | + restore-keys: | |
| 58 | + ${{ runner.os }}-node- |
| 59 | + - name: Generate Prisma Client |
| 60 | + run: npm run db:generate |
| 61 | + - name: Run tests |
| 62 | + run: npm test |
| 63 | + # - name: Run lint |
| 64 | + # run: npm run lint || true |
| 65 | + |
| 66 | + |
| 67 | + # test-frontend: |
| 68 | + # name: Test Frontend |
| 69 | + # needs: get-environment |
| 70 | + # runs-on: ubuntu-latest |
| 71 | + # defaults: |
| 72 | + # run: |
| 73 | + # working-directory: apps/frontend |
| 74 | + # steps: |
| 75 | + # - name: Checkout |
| 76 | + # uses: actions/checkout@v4 |
| 77 | + # - name: Setup Node.js |
| 78 | + # uses: actions/setup-node@v4 |
| 79 | + # with: |
| 80 | + # node-version: '24' |
| 81 | + # cache: 'npm' |
| 82 | + # cache-dependency-path: apps/frontend/package-lock.json |
| 83 | + # - name: Install dependencies |
| 84 | + # run: npm ci |
| 85 | + # - name: Run lint |
| 86 | + # run: npm run lint |
| 87 | + # - name: Type check |
| 88 | + # run: npx tsc --noEmit |
| 89 | + |
0 commit comments