www/.github/workflows/ci-pipeline.yml
Shintaro Jokagi 58af542675
fix(renovate): optimize configuration and update package rules (#683)
* fix(renovate): optimize configuration and update package rules

* chore(ci): update pnpm version to latest in CI pipeline configuration

* chore(ci): remove version specification for pnpm in CI pipeline configuration
2025-06-18 18:20:15 +12:00

197 lines
5.5 KiB
YAML

name: CI Pipeline
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_changes:
name: Check Changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
exists: ${{ steps.filter.outputs.exists }}
steps:
- uses: actions/checkout@v4
- name: Filter changes
uses: yumemi-inc/path-filter@v2
id: filter
with:
patterns: |
**
!**.md
!.gitignore
!.gitattributes
!.vscode/**
!.env.example
setup:
name: Setup Dependencies
needs: check_changes
if: ${{ needs.check_changes.outputs.exists == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if node_modules cache exists
id: check-node-modules-cache
uses: actions/cache@v4
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
lookup-only: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install dependencies
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
- name: Save node_modules cache
if: steps.check-node-modules-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
quality_checks:
name: ${{ matrix.name }}
needs: [check_changes, setup]
if: ${{ needs.check_changes.outputs.exists == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- check: lint
name: Lint
- check: format
name: Format
- check: test
name: Test
- check: spell
name: Spell Check
- check: build
name: Build
steps:
- uses: actions/checkout@v4
- name: Restore Turborepo Cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ matrix.check }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-turbo-${{ matrix.check }}-
- name: Restore node_modules cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node-modules-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Run ${{ matrix.name }}
run: pnpm exec turbo run ${{ matrix.check }}
playwright:
name: Playwright Tests
needs: [check_changes, setup, quality_checks]
if: ${{ needs.check_changes.outputs.exists == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore Turborepo Cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: ${{ runner.os }}-turbo-
- name: Restore node_modules cache
uses: actions/cache/restore@v4
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node-modules-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Cache Playwright Browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-playwright-
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright Tests
run: pnpm exec turbo run test:playwright
verify:
name: Verify
needs: [check_changes, quality_checks, playwright]
runs-on: ubuntu-latest
if: always()
outputs:
success: ${{ steps.set-result.outputs.success }}
steps:
- name: Set Result
id: set-result
run: |
# Check if changes exist but no jobs ran, or if any job failed or was cancelled
if [[ "${{ needs.check_changes.outputs.exists }}" != "true" ]]; then
echo "success=true" >> $GITHUB_OUTPUT
echo "No relevant changes detected - pipeline passed"
elif [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "success=false" >> $GITHUB_OUTPUT
echo "Pipeline failed - some jobs failed or were cancelled"
exit 1
else
echo "success=true" >> $GITHUB_OUTPUT
echo "All jobs completed successfully"
fi