YPE-1099: React-Hooks-Add useLanguage hook to get information for a specific language. #419
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run lint | |
| run: pnpm lint | |
| typecheck: | |
| name: Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run typecheck | |
| run: pnpm typecheck | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm build | |
| - name: Run tests with coverage | |
| run: pnpm test:coverage | |
| env: | |
| YVP_API_HOST: ${{ secrets.YVP_API_HOST }} | |
| YVP_APP_KEY: ${{ secrets.YVP_APP_KEY }} | |
| - name: Generate coverage badges JSON | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| mkdir -p .coverage | |
| # Core coverage | |
| # Core coverage | |
| if [ -f packages/core/coverage/coverage-summary.json ]; then | |
| CORE_PCT=$(jq '.total.lines.pct' packages/core/coverage/coverage-summary.json) | |
| CORE_COLOR=$(node -e "const p=$CORE_PCT; console.log(p >= 80 ? 'brightgreen' : p >= 60 ? 'yellow' : 'red')") | |
| echo "{\"schemaVersion\":1,\"label\":\"core coverage\",\"message\":\"${CORE_PCT}%\",\"color\":\"${CORE_COLOR}\"}" > .coverage/core.json | |
| fi | |
| # Hooks coverage | |
| if [ -f packages/hooks/coverage/coverage-summary.json ]; then | |
| HOOKS_PCT=$(jq '.total.lines.pct' packages/hooks/coverage/coverage-summary.json) | |
| HOOKS_COLOR=$(node -e "const p=$HOOKS_PCT; console.log(p >= 80 ? 'brightgreen' : p >= 60 ? 'yellow' : 'red')") | |
| echo "{\"schemaVersion\":1,\"label\":\"hooks coverage\",\"message\":\"${HOOKS_PCT}%\",\"color\":\"${HOOKS_COLOR}\"}" > .coverage/hooks.json | |
| fi | |
| # UI coverage | |
| if [ -f packages/ui/coverage/coverage-summary.json ]; then | |
| UI_PCT=$(jq '.total.lines.pct' packages/ui/coverage/coverage-summary.json) | |
| UI_COLOR=$(node -e "const p=$UI_PCT; console.log(p >= 80 ? 'brightgreen' : p >= 60 ? 'yellow' : 'red')") | |
| echo "{\"schemaVersion\":1,\"label\":\"ui coverage\",\"message\":\"${UI_PCT}%\",\"color\":\"${UI_COLOR}\"}" > .coverage/ui.json | |
| fi | |
| - name: Commit coverage badges | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add .coverage/ | |
| git diff --staged --quiet || git commit -m "chore: update coverage badges [skip ci]" | |
| git push | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: pnpm build |