From cb164b82555bada9dee4eeef7228cbb7ae8fb6e4 Mon Sep 17 00:00:00 2001 From: Derek Slenk Date: Sun, 29 Jun 2025 17:49:20 -0400 Subject: [PATCH] Add build check workflow for non-master branches - Runs on all pushes except to master branch - Also runs on pull requests - Performs linting, building, and optional testing - Provides fast feedback for development branches - Uses concurrency groups to cancel outdated runs --- .github/workflows/build-check.yml | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/build-check.yml diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml new file mode 100644 index 0000000..be9b9f5 --- /dev/null +++ b/.github/workflows/build-check.yml @@ -0,0 +1,66 @@ +# Workflow for building and testing Next.js site on non-master branches +name: Build Check + +on: + # Runs on pushes to any branch except master + push: + branches-ignore: ["master"] + + # Runs on pull requests targeting any branch + pull_request: + branches: ["*"] + +# Allow multiple concurrent build checks +concurrency: + group: "build-check-${{ github.ref }}" + cancel-in-progress: true + +jobs: + build-check: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Restore Next.js cache + uses: actions/cache@v4 + with: + path: | + .next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + + - name: Run linting + run: npm run lint + + - name: Build Next.js site + run: npm run build + + - name: Run tests (if available) + run: | + if npm run test --if-present; then + echo "✅ Tests passed" + else + echo "â„šī¸ No tests found or tests skipped" + fi + continue-on-error: true + + - name: Build verification complete + run: | + echo "🎉 Build verification successful!" + echo "✅ Dependencies installed" + echo "✅ Linting passed" + echo "✅ Build completed successfully" + echo "Ready for review and merge!"