fix: actions #143
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: Package Manager Benchmarks | |
| on: | |
| push: | |
| workflow_dispatch: | |
| # Prevent multiple runs from interfering with each other | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| setup: | |
| name: 'Setup' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Bins | |
| uses: actions/cache@v4 | |
| with: | |
| path: bins | |
| key: bins | |
| - name: Install Node | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '22' | |
| - name: Install & Setup Tools | |
| run: | | |
| bash ./scripts/setup.sh | |
| benchmark: | |
| name: 'Run Benchmarks' | |
| runs-on: ubuntu-latest | |
| needs: [setup] | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| project: [next, astro, svelte, vue] | |
| cache: [cold, warm] | |
| include: | |
| - project: next | |
| cache: cold | |
| - project: astro | |
| cache: cold | |
| - project: svelte | |
| cache: cold | |
| - project: vue | |
| cache: cold | |
| - project: next | |
| cache: warm | |
| - project: astro | |
| cache: warm | |
| - project: svelte | |
| cache: warm | |
| - project: vue | |
| cache: warm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Node | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '22' | |
| - name: Restore Bins | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: bins | |
| key: bins | |
| - name: Run Project Benchmarks | |
| run: | | |
| if [ "${{ matrix.cache }}" = "warm" ]; then | |
| bash ./scripts/install-warm.sh ${{ matrix.project }} | |
| else | |
| bash ./scripts/install.sh ${{ matrix.project }} | |
| fi | |
| - name: Upload Benchmark Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.project }}-${{ matrix.cache }}-results | |
| path: ./results/${{ matrix.project }}/ | |
| retention-days: 7 | |
| task: | |
| name: 'Benchmark Running Tasks' | |
| runs-on: ubuntu-latest | |
| needs: [setup] | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Node | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '22' | |
| - name: Restore Bins | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: bins | |
| key: bins | |
| - name: Run Task Execution Benchmarks | |
| run: | | |
| bash ./scripts/run.sh | |
| - name: Upload Benchmark Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: task-benchmark-results | |
| path: ./results/run.json | |
| retention-days: 7 | |
| process: | |
| name: 'Process Results' | |
| runs-on: ubuntu-latest | |
| needs: [benchmark, task] | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Node | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '22' | |
| - name: Download Results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: results | |
| merge-multiple: true | |
| - name: Process Results | |
| run: | | |
| bash ./scripts/process-results.sh | |
| - name: Upload Processed Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: processed-results | |
| path: chart/results/ | |
| retention-days: 7 | |
| deploy: | |
| name: 'Deploy Results' | |
| runs-on: ubuntu-latest | |
| needs: [process] | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: processed-results | |
| path: chart/results/ | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: chart/results | |
| force_orphan: true | |
| cleanup: | |
| name: 'Cleanup' | |
| needs: [deploy] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Delete old artifacts | |
| run: | | |
| gh api repos/${{ github.repository }}/actions/artifacts --paginate | jq -r '.artifacts[] | select(.expired) | .id' | xargs -I {} gh api repos/${{ github.repository }}/actions/artifacts/{} -X DELETE |