chore: ... #54
This file contains 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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Deno Benchmark CI | |
on: | |
push: | |
branches: [main] | |
paths: | |
- '*.ts' | |
- '*.js' | |
- '*.json' | |
- '*.jsonc' | |
- '*.yaml' | |
- 'src/**/*' | |
- '.github/**/deno-benchmark.yml' | |
- 'benchmark/**/*.ts' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
# File containing the version Spec of the version to use. Examples: .nvmrc, .node-version, .tool-versions. | |
node-version-file: '.nvmrc' # optional | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
# Version of pnpm to install | |
version: latest # optional | |
# If specified, run `pnpm install` | |
run_install: false # optional, default is null | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run Benchmark | |
run: pnpm benchmark:deno:all | |
# - name: Add benchmark/results/* to Git | |
# if: ${{ github.ref == 'refs/heads/main' }} | |
# run: | | |
# git pull --tags origin main | |
# git add --force benchmark/results/ | |
# - name: Commit files | |
# if: ${{ github.ref == 'refs/heads/main' }} | |
# run: | | |
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
# git config --local user.name "github-actions[bot]" | |
# git commit -m "chore(gh-bot): update deno benchmark results" -a | |
# - name: Push changes | |
# if: ${{ github.ref == 'refs/heads/main' }} | |
# uses: ad-m/github-push-action@master | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# branch: ${{ github.ref }} | |
- name: Add benchmark/results to Git | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "chore(gh-bot): update deno benchmark results" | |
# Optional. Options used by `git-commit`. | |
# See https://git-scm.com/docs/git-commit#_options | |
commit_options: '--all --no-verify --signoff' | |
# Optional glob pattern of files which should be added to the commit | |
# Defaults to all (.) | |
# See the `pathspec`-documentation for git | |
# - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203 | |
# - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec | |
file_pattern: 'benchmark/results/*.md' | |
# Optional. Options used by `git-add`. | |
# See https://git-scm.com/docs/git-add#_options | |
add_options: '-u --force' | |