├── .codspeed-runner-version ├── .vscode └── settings.json ├── .prettierrc.json ├── CHANGELOG.md ├── examples ├── nodejs-typescript-codspeed.yml ├── go-codspeed.yml ├── cpp-cmake-codspeed.yml ├── python-pytest-codspeed.yml └── rust-cargo-codspeed.yml ├── LICENSE ├── scripts └── release.sh ├── .github └── workflows │ ├── bump-runner-version.yml │ └── ci.yml ├── .gitignore ├── README.md └── action.yml /.codspeed-runner-version: -------------------------------------------------------------------------------- 1 | 4.5.1 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnSave": true 4 | } 5 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false, 4 | "bracketSpacing": false, 5 | "arrowParens": "avoid" 6 | } 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | This project is kept in sync with the [CodSpeedHQ/runner](https://github.com/CodSpeedHQ/runner) project. 4 | 5 | Checkout the [CodSpeedHQ/runner Changelog](https://github.com/CodSpeedHQ/runner/blob/main/CHANGELOG.md) for more details. 6 | -------------------------------------------------------------------------------- /examples/nodejs-typescript-codspeed.yml: -------------------------------------------------------------------------------- 1 | name: CodSpeed 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" # or "master" 7 | pull_request: # required to have reports on PRs 8 | # `workflow_dispatch` allows CodSpeed to trigger backtest 9 | # performance analysis in order to generate initial data. 10 | workflow_dispatch: 11 | 12 | permissions: # optional for public repositories 13 | contents: read 14 | id-token: write # for OpenID Connect authentication with CodSpeed 15 | 16 | jobs: 17 | codspeed: 18 | name: Run benchmarks 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - uses: actions/setup-node@v3 24 | 25 | - name: Install dependencies 26 | run: npm install 27 | 28 | - name: Run benchmarks 29 | uses: CodSpeedHQ/action@v4 30 | with: 31 | mode: simulation 32 | run: node -r esbuild-register benches/bench.ts 33 | -------------------------------------------------------------------------------- /examples/go-codspeed.yml: -------------------------------------------------------------------------------- 1 | name: CodSpeed 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" # or "master" 7 | pull_request: # required to have reports on PRs 8 | # `workflow_dispatch` allows CodSpeed to trigger backtest 9 | # performance analysis in order to generate initial data. 10 | workflow_dispatch: 11 | 12 | permissions: # optional for public repositories 13 | contents: read 14 | id-token: write # for OpenID Connect authentication with CodSpeed 15 | 16 | jobs: 17 | codspeed: 18 | name: Run benchmarks 19 | runs-on: codspeed-macro 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Setup Go 24 | uses: actions/setup-go@v5 25 | with: 26 | go-version: stable 27 | 28 | - name: Run Go benchmarks 29 | uses: CodSpeedHQ/action@main 30 | with: 31 | mode: walltime # go only supports walltime mode 32 | run: go test -bench=. -benchtime=5s 33 | -------------------------------------------------------------------------------- /examples/cpp-cmake-codspeed.yml: -------------------------------------------------------------------------------- 1 | name: CodSpeed 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" # or "master" 7 | pull_request: # required to have reports on PRs 8 | # `workflow_dispatch` allows CodSpeed to trigger backtest 9 | # performance analysis in order to generate initial data. 10 | workflow_dispatch: 11 | 12 | permissions: # optional for public repositories 13 | contents: read 14 | id-token: write # for OpenID Connect authentication with CodSpeed 15 | 16 | jobs: 17 | codspeed: 18 | name: Run benchmarks 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Build C++ benchmarks 24 | run: | 25 | mkdir -p build && cd build 26 | cmake -DCODSPEED_MODE=simulation .. 27 | make -j 28 | 29 | - name: Run C++ benchmarks 30 | uses: CodSpeedHQ/action@v4 31 | with: 32 | mode: simulation 33 | run: ./path/to/built/benchmark 34 | -------------------------------------------------------------------------------- /examples/python-pytest-codspeed.yml: -------------------------------------------------------------------------------- 1 | name: CodSpeed 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" # or "master" 7 | pull_request: # required to have reports on PRs 8 | # `workflow_dispatch` allows CodSpeed to trigger backtest 9 | # performance analysis in order to generate initial data. 10 | workflow_dispatch: 11 | 12 | permissions: # optional for public repositories 13 | contents: read 14 | id-token: write # for OpenID Connect authentication with CodSpeed 15 | 16 | jobs: 17 | codspeed: 18 | name: Run benchmarks 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - uses: actions/setup-python@v3 24 | with: 25 | python-version: "3.9" 26 | 27 | - name: Install dependencies 28 | run: pip install -r requirements.txt 29 | 30 | - name: Run benchmarks 31 | uses: CodSpeedHQ/action@v4 32 | with: 33 | mode: simulation 34 | run: pytest tests/ --codspeed 35 | -------------------------------------------------------------------------------- /examples/rust-cargo-codspeed.yml: -------------------------------------------------------------------------------- 1 | name: CodSpeed 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" # or "master" 7 | pull_request: # required to have reports on PRs 8 | # `workflow_dispatch` allows CodSpeed to trigger backtest 9 | # performance analysis in order to generate initial data. 10 | workflow_dispatch: 11 | 12 | permissions: # optional for public repositories 13 | contents: read 14 | id-token: write # for OpenID Connect authentication with CodSpeed 15 | 16 | jobs: 17 | codspeed: 18 | name: Run benchmarks 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Setup rust toolchain, cache and cargo-codspeed binary 24 | uses: moonrepo/setup-rust@v0 25 | with: 26 | channel: stable 27 | cache-target: release 28 | bins: cargo-codspeed 29 | 30 | - name: Build the benchmark target(s) 31 | run: cargo codspeed build 32 | 33 | - name: Run the benchmarks 34 | uses: CodSpeedHQ/action@v4 35 | with: 36 | mode: simulation 37 | run: cargo codspeed run 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2022 CodSpeed and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /scripts/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Usage: ./scripts/release.sh 3 | set -ex 4 | 5 | # Prechecks 6 | if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then 7 | echo "You must be on the main branch to release" 8 | exit 1 9 | fi 10 | git diff --exit-code 11 | 12 | # Bump version 13 | NEW_VERSION=$(cat .codspeed-runner-version) 14 | # verify that NEW_VERSION is a valid semver 15 | if ! [[ "$NEW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 16 | echo "Version must be a valid semver (e.g. 1.2.3)" 17 | exit 1 18 | fi 19 | MAJOR_VERSION=$(echo $NEW_VERSION | cut -d. -f1) 20 | 21 | # Ask for confirmation 22 | read -p "Are you sure you want to release v$NEW_VERSION? Bumping the v$MAJOR_VERSION major version ?(y/n) " -n 1 -r 23 | echo 24 | if [[ ! $REPLY =~ ^[Yy]$ ]]; then 25 | exit 1 26 | fi 27 | 28 | # Fail if there are any unstaged changes left 29 | git diff --exit-code 30 | git commit -m "Release v$NEW_VERSION 🚀" --allow-empty 31 | git tag -s -fa v$NEW_VERSION -m "Release v$NEW_VERSION 🚀" 32 | git tag -s -fa v$MAJOR_VERSION -m "Release v$NEW_VERSION 🚀" 33 | git push origin tag v$NEW_VERSION 34 | git push -f origin tag v$MAJOR_VERSION 35 | git push --follow-tags 36 | 37 | RUNNER_NOTES=$(gh release view v$NEW_VERSION -R CodSpeedHQ/runner --json body | jq -r .body) 38 | RUNNER_NOTES="$RUNNER_NOTES 39 | 40 | 41 | **Full Runner Changelog**: https://github.com/CodSpeedHQ/runner/blob/main/CHANGELOG.md" 42 | gh release create v$NEW_VERSION --title "v$NEW_VERSION" --notes "$RUNNER_NOTES" -d 43 | -------------------------------------------------------------------------------- /.github/workflows/bump-runner-version.yml: -------------------------------------------------------------------------------- 1 | name: Bump the runner version 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: "Runner version" 8 | required: true 9 | 10 | permissions: 11 | contents: write 12 | pull-requests: write 13 | 14 | jobs: 15 | main: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v4 19 | with: 20 | fetch-depth: 0 21 | - name: Bump 22 | env: 23 | GH_TOKEN: ${{ github.token }} 24 | run: | 25 | # Check that the version is a valid semver 26 | if ! echo "${{ github.event.inputs.version }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'; then 27 | echo "Invalid version" 28 | exit 1 29 | fi 30 | # Check that this release exists in the CodSpeedHQ/runner repository 31 | if ! gh release view v${{ github.event.inputs.version }} -R CodSpeedHQ/runner; then 32 | echo "Release ${{ github.event.inputs.version }} does not exist in CodSpeedHQ/runner" 33 | exit 1 34 | fi 35 | 36 | git config --global user.email "github-actions[bot]@users.noreply.github.com" 37 | git config --global user.name "github-actions[bot]" 38 | echo "Bumping runner version to ${{ github.event.inputs.version }}" 39 | BRANCH_NAME=bump-runner-version/${{ github.event.inputs.version }} 40 | git checkout -b $BRANCH_NAME 41 | echo ${{ github.event.inputs.version }} > .codspeed-runner-version 42 | git add .codspeed-runner-version 43 | git commit -m "chore: bump runner version to ${{ github.event.inputs.version }}" 44 | git push origin $BRANCH_NAME 45 | gh pr create --title "chore: bump runner version to ${{ github.event.inputs.version }}" --body "Bump runner version to ${{ github.event.inputs.version }}" --base main --head $BRANCH_NAME 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | node_modules 3 | 4 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 15 | 16 | # Runtime data 17 | pids 18 | *.pid 19 | *.seed 20 | *.pid.lock 21 | 22 | # Directory for instrumented libs generated by jscoverage/JSCover 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | coverage 27 | *.lcov 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | jspm_packages/ 46 | 47 | # TypeScript v1 declaration files 48 | typings/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional REPL history 60 | .node_repl_history 61 | 62 | # Output of 'npm pack' 63 | *.tgz 64 | 65 | # Yarn Integrity file 66 | .yarn-integrity 67 | 68 | # dotenv environment variables file 69 | .env 70 | .env.test 71 | 72 | # parcel-bundler cache (https://parceljs.org/) 73 | .cache 74 | 75 | # next.js build output 76 | .next 77 | 78 | # nuxt.js build output 79 | .nuxt 80 | 81 | # vuepress build output 82 | .vuepress/dist 83 | 84 | # Serverless directories 85 | .serverless/ 86 | 87 | # FuseBox cache 88 | .fusebox/ 89 | 90 | # DynamoDB Local files 91 | .dynamodb/ 92 | 93 | # OS metadata 94 | .DS_Store 95 | Thumbs.db 96 | 97 | # Ignore built ts files 98 | __tests__/runner/* 99 | lib/**/* -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths-ignore: 8 | - "**.md" 9 | pull_request: 10 | paths-ignore: 11 | - "**.md" 12 | workflow_dispatch: 13 | 14 | jobs: 15 | test-action: 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | os: 20 | - ubuntu-22.04 21 | - ubuntu-24.04 22 | - ubuntu-latest 23 | - codspeedhq-arm64-ubuntu-22.04 24 | - codspeedhq-arm64-ubuntu-24.04 25 | mode: 26 | - simulation 27 | - instrumentation 28 | - walltime 29 | 30 | runs-on: ${{ matrix.os }} 31 | env: 32 | CODSPEED_SKIP_UPLOAD: true 33 | steps: 34 | - uses: actions/checkout@v4 35 | - name: Check basic action execution 36 | uses: ./ 37 | with: 38 | allow-empty: true 39 | mode: ${{ matrix.mode }} 40 | run: echo "Working!" 41 | - name: Check action execution with env variables 42 | uses: ./ 43 | env: 44 | MY_ENV_VAR: "Hello" 45 | with: 46 | allow-empty: true 47 | mode: ${{ matrix.mode }} 48 | run: | 49 | output=$(echo "$MY_ENV_VAR") 50 | if [ "$output" != "Hello" ]; then 51 | echo "Assertion failed: Expected 'Hello' but got '$output'" 52 | exit 1 53 | fi 54 | - name: Check action in a custom directory 55 | uses: ./ 56 | with: 57 | allow-empty: true 58 | mode: ${{ matrix.mode }} 59 | working-directory: examples 60 | # Check that the directory is actually changed 61 | run: if [ $(basename $(pwd)) != "examples" ]; then exit 1; fi 62 | - name: Check action with multiline command 63 | uses: ./ 64 | with: 65 | allow-empty: true 66 | mode: ${{ matrix.mode }} 67 | run: | 68 | echo "Working"; 69 | echo "with"; 70 | echo "multiple lines"; 71 | test-version-formats: 72 | strategy: 73 | fail-fast: false 74 | matrix: 75 | version: 76 | - "latest" 77 | - "4.4.1" 78 | - "v4.4.1" 79 | 80 | runs-on: ubuntu-latest 81 | env: 82 | CODSPEED_SKIP_UPLOAD: true 83 | steps: 84 | - uses: actions/checkout@v4 85 | - name: Check action with version format ${{ matrix.version }} 86 | uses: ./ 87 | with: 88 | allow-empty: true 89 | runner-version: ${{ matrix.version }} 90 | mode: simulation 91 | run: echo "Testing version format ${{ matrix.version }}!" 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |