Filipe/platf 5412 pin dependencies #2114
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull Request | |
| on: | |
| pull_request: | |
| jobs: | |
| prepare: | |
| name: 'Prepare' | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up matrix | |
| id: set-matrix | |
| run: | | |
| chmod +x .github/scripts/set-matrix.sh | |
| .github/scripts/set-matrix.sh | |
| build: | |
| name: 'Install and Build' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Get yarn cache directory | |
| id: yarn-cache-dir | |
| run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
| - name: Cache yarn dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.yarn-cache-dir.outputs.dir }} | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| - name: Cache node_modules | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| */node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install dependencies | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: yarn install --immutable | |
| - name: Cache build outputs | |
| id: cache-build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| */dist | |
| */build | |
| packages/*/dist | |
| packages/*/build | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| - name: Build all packages | |
| run: yarn build | |
| run-tests: | |
| name: 'Run tests - ${{ matrix.folders }}' | |
| needs: [prepare, build] | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| folders: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| files: | | |
| ${{ matrix.folders }}/** | |
| - uses: actions/setup-node@v4 | |
| if: steps.changed-files.outputs.any_modified == 'true' | |
| with: | |
| node-version: 22 | |
| - name: Restore node_modules | |
| if: steps.changed-files.outputs.any_modified == 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| */node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} | |
| fail-on-cache-miss: true | |
| - name: Restore build outputs | |
| if: steps.changed-files.outputs.any_modified == 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| */dist | |
| */build | |
| packages/*/dist | |
| packages/*/build | |
| key: ${{ runner.os }}-build-${{ github.sha }} | |
| fail-on-cache-miss: true | |
| - name: Run lint | |
| if: steps.changed-files.outputs.any_modified == 'true' | |
| working-directory: ${{ matrix.folders }} | |
| run: | | |
| if [ -f "package.json" ] && grep -q '"lint"' package.json; then | |
| yarn lint | |
| else | |
| echo "No lint script found, skipping" | |
| fi | |
| - name: Run tests | |
| if: steps.changed-files.outputs.any_modified == 'true' | |
| working-directory: ${{ matrix.folders }} | |
| run: | | |
| if [ -f "package.json" ] && grep -q '"test"' package.json; then | |
| yarn test | |
| else | |
| echo "No test script found, skipping" | |
| fi |