chore(deps): update safe digest/patch updates #383
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: Continuous Integration | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Read Node version from .nvmrc (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| if [ -f "$GITHUB_WORKSPACE/.nvmrc" ]; then | |
| NODE_VERSION=$(cat "$GITHUB_WORKSPACE/.nvmrc") | |
| echo "NODE_VERSION=$NODE_VERSION" >> $GITHUB_ENV | |
| else | |
| echo ".nvmrc not found on Unix-like OS" | |
| exit 1 | |
| fi | |
| - name: Read Node version from .nvmrc (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| if (Test-Path "$env:GITHUB_WORKSPACE\.nvmrc") { | |
| $NODE_VERSION = Get-Content "$env:GITHUB_WORKSPACE\.nvmrc" | |
| "NODE_VERSION=$NODE_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| } else { | |
| Write-Host ".nvmrc not found on Windows" | |
| exit 1 | |
| } | |
| - name: Detect package manager | |
| id: detect-package-manager | |
| shell: bash | |
| run: | | |
| if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then | |
| echo "manager=pnpm" >> $GITHUB_OUTPUT | |
| echo "command=install --frozen-lockfile" >> $GITHUB_OUTPUT | |
| echo "runner=pnpm" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [ -f "${{ github.workspace }}/yarn.lock" ]; then | |
| echo "manager=yarn" >> $GITHUB_OUTPUT | |
| echo "command=install --frozen-lockfile --non-interactive" >> $GITHUB_OUTPUT | |
| echo "runner=yarn" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [ -f "${{ github.workspace }}/package.json" ]; then | |
| echo "manager=npm" >> $GITHUB_OUTPUT | |
| echo "command=ci" >> $GITHUB_OUTPUT | |
| echo "runner=npm" >> $GITHUB_OUTPUT | |
| exit 0 | |
| else | |
| echo "Unable to determine package manager" | |
| exit 1 | |
| fi | |
| - name: Setup pnpm | |
| if: steps.detect-package-manager.outputs.manager == 'pnpm' | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: ${{ steps.detect-package-manager.outputs.manager }} | |
| - name: Read Playwright version from package.json | |
| id: detect-playwright | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p "require('./package.json').devDependencies?.['playwright'] || require('./package.json').dependencies?.['playwright']") | |
| echo "PLAYWRIGHT_VERSION=${VERSION#^}" >> $GITHUB_ENV | |
| - name: Restore cache - Playwright binaries | |
| uses: actions/cache/restore@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
| - name: Install dependencies | |
| env: | |
| CI: true | |
| run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - name: Save cache - Playwright binaries | |
| if: always() && steps.playwright-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
| - name: Run Lint | |
| run: ${{ steps.detect-package-manager.outputs.runner }} run lint | |
| - name: Run Test | |
| run: ${{ steps.detect-package-manager.outputs.runner }} run test | |
| - name: Run Unit Tests with Coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| run: ${{ steps.detect-package-manager.outputs.runner }} run test:coverage:unit | |
| - name: Upload Unit Test Coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| slug: soroush-tech/soroush.tech | |
| flags: unit | |
| name: Unit | |
| - name: Run Storybook Tests with Coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| run: ${{ steps.detect-package-manager.outputs.runner }} run test:coverage:storybook | |
| - name: Upload Coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| slug: soroush-tech/soroush.tech | |
| flags: storybook | |
| name: Storybook |