|
| 1 | +name: Performance Test |
| 2 | + |
| 3 | +# Replaces the CircleCI manual approval gate. Trigger this workflow |
| 4 | +# manually from the Actions tab on the branch you want to benchmark. |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + performance: |
| 10 | + runs-on: performance |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + submodules: recursive |
| 15 | + |
| 16 | + - name: Back up benchmark and mix.exs |
| 17 | + run: | |
| 18 | + cp -r benchmark/ $HOME/benchmark_backup/ |
| 19 | + cp mix.exs $HOME/benchmark_backup/ |
| 20 | +
|
| 21 | + - name: Pull Docker image |
| 22 | + run: docker pull membraneframeworklabs/docker_membrane |
| 23 | + |
| 24 | + - name: Run benchmarks on feature branch |
| 25 | + run: | |
| 26 | + mkdir -p $HOME/results |
| 27 | + docker run \ |
| 28 | + -e MIX_ENV=benchmark \ |
| 29 | + -v $PWD:/root/app \ |
| 30 | + -v $HOME/results:/root/results \ |
| 31 | + -w /root/app \ |
| 32 | + membraneframeworklabs/docker_membrane \ |
| 33 | + mix do deps.get, deps.compile --force --all, compile --force, run benchmark/run.exs /root/results/feature_branch_results |
| 34 | +
|
| 35 | + - name: Switch to master and restore benchmark |
| 36 | + run: | |
| 37 | + git checkout -f master |
| 38 | + cp $HOME/benchmark_backup/mix.exs . |
| 39 | +
|
| 40 | + - name: Run benchmarks on master |
| 41 | + run: | |
| 42 | + docker run \ |
| 43 | + -e MIX_ENV=benchmark \ |
| 44 | + -v $PWD:/root/app \ |
| 45 | + -v $HOME/results:/root/results \ |
| 46 | + -v $HOME/benchmark_backup/benchmark:/root/app/benchmark \ |
| 47 | + -w /root/app \ |
| 48 | + membraneframeworklabs/docker_membrane \ |
| 49 | + mix do deps.get, deps.compile --force --all, compile --force, run benchmark/run.exs /root/results/master_results |
| 50 | +
|
| 51 | + - name: Compare results |
| 52 | + run: | |
| 53 | + docker run \ |
| 54 | + -e MIX_ENV=benchmark \ |
| 55 | + -v $PWD:/root/app \ |
| 56 | + -v $HOME/results:/root/results \ |
| 57 | + -v $HOME/benchmark_backup/benchmark:/root/app/benchmark \ |
| 58 | + -w /root/app \ |
| 59 | + membraneframeworklabs/docker_membrane \ |
| 60 | + mix run benchmark/compare.exs /root/results/feature_branch_results /root/results/master_results |
| 61 | +
|
| 62 | + - name: Clean up results |
| 63 | + if: always() |
| 64 | + run: rm -f $HOME/results/* |
0 commit comments