diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..3904391 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,102 @@ +name: Pull Request Checks + +on: + pull_request: + workflow_dispatch: + +jobs: + quality: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Biome + uses: biomejs/setup-biome@v2 + with: + version: latest + - name: Run Biome + run: biome ci . + + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Git Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Restore Cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.npm + .next/cache + node_modules/.cache + key: cache-${{ hashFiles('package-lock.json') }}- + restore-keys: cache- + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install NPM packages + run: npm ci + + - name: Build Next.js + run: | + node --run build + node --run postbuild + + - name: Save Cache + uses: actions/cache/save@v4 + with: + path: | + ~/.npm + .next/cache + node_modules/.cache + key: cache-${{ hashFiles('package-lock.json') }} + + unit-test: + name: Unit Test + runs-on: ubuntu-latest + + steps: + - name: Git Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Restore Cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.npm + .next/cache + node_modules/.cache + key: cache-${{ hashFiles('package-lock.json') }}- + restore-keys: cache- + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install NPM packages + run: npm ci + + - name: Run Unit Tests + run: node --run test + + - name: Save Cache + uses: actions/cache/save@v4 + with: + path: | + ~/.npm + .next/cache + node_modules/.cache + key: cache-${{ hashFiles('package-lock.json') }} \ No newline at end of file