Skip to content

Fix CI test jobs fail to detect build failure #2

Fix CI test jobs fail to detect build failure

Fix CI test jobs fail to detect build failure #2

name: Run Tests Build
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
packages:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.packages.outputs.packages }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Find Next.js packages
id: find-packages
run: |
echo "packages=$(ls -d examples/*)" >> $GITHUB_ENV
shell: bash
- name: Set packages output
id: set-packages-output
run: |
echo "packages=$(printf '%s\n' ${{ env.packages }} | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_ENV
shell: bash
env:
packages: ${{ env.packages }}
build:
needs: packages
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.packages.outputs.packages) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Ensure this matches your Node.js version
- name: Install Yarn
run: |
corepack enable
corepack prepare [email protected] --activate
- name: Install dependencies
run: yarn install
- name: Build Next.js project
working-directory: ${{ matrix.package }}
run: yarn build