Skip to content

Launch the performance test #13

Launch the performance test

Launch the performance test #13

Workflow file for this run

name: Launch the performance test
permissions:
contents: write
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
required: true
default: 'master'
type: string
commit_hash:
description: 'Commit hash on the branch, if not specified thent he latest is taken'
required: false
type: string
repository_dispatch:
jobs:
run:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
path: ./PerformanceRegression
- name: Setup environment
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "TEST_BRANCH=${{ inputs.branch }}" | tee -a $GITHUB_ENV
echo "TEST_COMMIT_HASH=${{ inputs.commit_hash }}" | tee -a $GITHUB_ENV
else
echo "TEST_BRANCH=${{ github.event.client_payload.branch }}" | tee -a $GITHUB_ENV
echo "TEST_COMMIT_HASH=${{ github.event.client_payload.commit_hash }}" | tee -a $GITHUB_ENV
fi
- name: Notify commit begin
if: github.event_name == 'repository_dispatch'
shell: bash
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERF_REG_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/sofa-framework/sofa/statuses/${TEST_COMMIT_HASH} \
-d '{"state":"pending","target_url":"https://github.com/sofa-framework/PerformanceRegression/actions/runs/${{ github.run_id }}","description":"Performance tests started...","context":"performance-tests"}'
- name: Run performance tests
id: run_perf_tests
continue-on-error: true
shell: bash
run: |
export RO_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
bash ./PerformanceRegression/main.sh $(pwd) $TEST_BRANCH $TEST_COMMIT_HASH
- name: Move logs around to save them
shell: bash
run: |
mkdir logs
find . -name "*.log" ! -path "logs/*" -exec cp --parents {} logs \;
- name: Upload artifacts
uses: actions/[email protected]
with:
name: action_logs
path: logs
- name: Notify commit end
if: github.event_name == 'repository_dispatch'
shell: bash
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERF_REG_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/sofa-framework/sofa/statuses/${TEST_COMMIT_HASH} \
-d '{"state":"${{ steps.run_perf_tests.outcome }}","target_url":"https://github.com/sofa-framework/PerformanceRegression/actions/runs/${{ github.run_id }}","description":"Performance tests completed with ${{ steps.run_perf_tests.outcome }}","context":"performance-tests"}'
- name: Push results
if: steps.run_perf_tests.outcome == 'success'
run: |
cd PerformanceRegression
git config user.name github-actions
git config user.email [email protected]
git add old_results/*
git commit -m "Add performance stats for $TEST_BRANCH $TEST_COMMIT_HASH"
git pull -r
git push