name: CI
on:
  pull_request:
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    permissions: write-all
    steps:
      - name: Checkout repository
        uses: actions/checkout@master
      - name: Install pnpm
        run: npm i -g pnpm
        # todo this needs investigating fixing
      - run: pnpm install
      - run: pnpm lint
      - run: pnpm check-build
      - run: nohup pnpm prod-start &
      - run: nohup node cypress/minecraft-server.mjs &
      - uses: cypress-io/github-action@v5
        with:
          install: false
      - uses: actions/upload-artifact@v3
        if: failure()
        with:
          name: cypress-images
          path: cypress/integration/__image_snapshots__/
