Modify scripts #30
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
| # Playwrightスモークテスト自動実行ワークフロー | |
| # package-lock.jsonのハッシュをキャッシュキーに使用する | |
| name: Playwright Tests (Cache v2 - lockfile hash) | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: リポジトリのコードをチェックアウト | |
| - uses: actions/checkout@v4 | |
| # Step 2: Node.jsの環境をセットアップ | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| # Step 3: package.jsonに定義された依存関係をインストール | |
| - name: Install dependencies | |
| run: npm ci | |
| # Step 4: Playwrightブラウザのキャッシュを復元(package-lock.jsonハッシュ版) | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-browsers-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| restore-keys: | | |
| playwright-browsers-${{ runner.os }}- | |
| # Step 6: システム依存関係をインストール(キャッシュ復元時も必要) | |
| - name: Install Playwright system dependencies | |
| run: npm run install-playwright | |
| # Step 7: 実際のPlaywrightテストを実行 | |
| - name: Run Playwright tests | |
| run: npm run test | |
| # Step 8: publicディレクトリとテスト結果を統合 | |
| - name: Run Build for GitHub Pages | |
| run: npm run build-for-pages | |
| # Step 9: GitHub Pagesの設定 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| if: always() | |
| # Step 10: distディレクトリをアーティファクトとして保存 | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 30 | |
| # Step 11: GitHub Pagesにアーティファクトをアップロード | |
| - name: Upload Artifacts to GitHub Pages | |
| uses: actions/upload-pages-artifact@v3 | |
| if: always() | |
| with: | |
| path: ./dist | |
| # Step 12: GitHub Pagesにデプロイ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| if: always() |