name: Unit tests & build on: push: branches: - develop - main pull_request: jobs: pr: name: Test and lint - PR runs-on: ubuntu-latest permissions: contents: 'read' actions: 'read' steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Derive appropriate SHAs for base and head for `nx affected` commands uses: nrwl/nx-set-shas@v2 with: main-branch-name: ${{ github.base_ref }} - name: Use Node.js 16 id: Node uses: actions/setup-node@v3 with: node-version: 16.14.0 - name: Restore node_modules from cache uses: actions/cache@v3 with: path: '**/node_modules' key: node_modules-${{ hashFiles('**/yarn.lock') }} - name: Install root dependencies run: yarn install --frozen-lockfile - name: Check formatting run: yarn nx format:check - name: Lint affected run: yarn nx affected:lint --max-warnings=0 - name: Test affected run: yarn nx affected:test - name: Build affected run: yarn nx affected:build - name: Build affected spec run: yarn nx affected --target=build-spec