Benchmarks #235
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
name: Benchmarks | |
on: | |
workflow_dispatch: | |
inputs: | |
pr_id: | |
description: 'Pull Request number' | |
required: true | |
default: '' | |
workflow_run: | |
workflows: ["BuildAndReleaseMaster"] | |
types: | |
- completed | |
jobs: | |
invoke_jasmine_tests: | |
name: Invoke Jasmine performance tests | |
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }} || ${{ github.event_name }} == 'workflow_dispatch' | |
runs-on: self-hosted-runner-ubuntu | |
steps: | |
- name: Debug workflow conclusion | |
run: | | |
echo "Workflow name: ${{ github.event_name == 'workflow_run' }}" | |
echo "Workflow run conclusion: ${{ github.event.workflow_run.conclusion }}" | |
- name: Cleanup build folder | |
run: | | |
ls -la ./ | |
rm -rf ./* ./.??* || true | |
ls -la ./ | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: ./scripts/benchmarks/setup_dependencies.sh | |
- name: install node | |
uses: actions/setup-node@master | |
with: | |
node-version: "lts/*" | |
- name: Install Ruby and other dev tools | |
run: ./scripts/benchmarks/setup_dev_tools.sh | |
- name: Install cargo tools | |
run: | | |
cargo install nj-cli wasm-pack | |
npm install -g tslib | |
- name: Run Jasmine performance tests | |
run: | | |
rustc --version | |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && "${{ github.event.inputs.pr_id }}" -le 10 ]]; then | |
echo "Running manually with a PR ID of 10 or less." | |
ruby scripts/benchmarks/process.rb ${{ github.event.inputs.pr_id }} | |
elif [[ "${{ github.event_name }}" == 'workflow_dispatch' && "${{ github.event.inputs.pr_id }}" =~ ^[0-9]+$ ]]; then | |
echo "Running manually with a valid numeric PR ID greater than 10." | |
ruby scripts/benchmarks/process.rb PR~${{ github.event.inputs.pr_id }} | |
elif [[ "${{ github.event_name }}" != 'workflow_dispatch' ]]; then | |
echo "Running on a non-workflow_dispatch event." | |
ruby scripts/benchmarks/process.rb 1 | |
fi | |
- name: List files in the results folder | |
run: ls -la /chipmunk/chipmunk_performance_results | |
push_data_to_chipmunk_docs: | |
name: Move benchmark data to chipmunk-docs repository | |
needs: invoke_jasmine_tests | |
runs-on: self-hosted-runner-ubuntu | |
steps: | |
- name: Checkout chipmunk-docs repository | |
uses: actions/checkout@v2 | |
with: | |
repository: esrlabs/chipmunk-docs | |
path: './chipmunk-docs' | |
token: ${{ secrets.DOCS_PUSH_TOKEN }} | |
- name: Push benchmark data | |
working-directory: ./chipmunk-docs | |
run: | | |
git config user.name "esrlabs" | |
git config user.email "[email protected]" | |
git remote set-url origin "https://esrlabs:${{secrets.DOCS_PUSH_TOKEN}}@github.com/esrlabs/chipmunk-docs" | |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && "${{ github.event.inputs.pr_id }}" -gt 10 ]]; then | |
cp /chipmunk/chipmunk_performance_results/Benchmark_PR_${{ github.event.inputs.pr_id }}.json ./jekyll/benchmarks/data/pull_request/ | |
git add ./jekyll/benchmarks/data/pull_request/Benchmark_PR_${{ github.event.inputs.pr_id }}.json | |
git commit -m "Adding PR benchmark results for chipmunk PR #${{ github.event.inputs.pr_id }}" | |
else | |
cp /chipmunk/chipmunk_performance_results/data.json ./jekyll/benchmarks/data/data.json | |
git add ./jekyll/benchmarks/data/data.json | |
git commit -m "Updating data.json for latest tag" | |
fi | |
git push origin master |