From 1bfa1368d797efce34622dc7e9607e4459443b8a Mon Sep 17 00:00:00 2001 From: "C.A.P. Linssen" Date: Wed, 6 Nov 2024 23:05:42 +0100 Subject: [PATCH] fix continuous benchmarking --- .../continuous_benchmarking_master_branch.yml | 82 ++++++++++++++++++ ...continuous_benchmarking_pull_requests.yml} | 84 ------------------- 2 files changed, 82 insertions(+), 84 deletions(-) create mode 100644 .github/workflows/continuous_benchmarking_master_branch.yml rename .github/workflows/{continuous_benchmarking.yml => continuous_benchmarking_pull_requests.yml} (52%) diff --git a/.github/workflows/continuous_benchmarking_master_branch.yml b/.github/workflows/continuous_benchmarking_master_branch.yml new file mode 100644 index 000000000..08307940c --- /dev/null +++ b/.github/workflows/continuous_benchmarking_master_branch.yml @@ -0,0 +1,82 @@ +on: + push: + branches: master + +jobs: + benchmark_base_branch: + name: Continuous Benchmarking Fork PRs with Bencher + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + + - uses: bencherdev/bencher@main + + # Setup Python version + - name: Setup Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: 3.8 + + # Install dependencies + - name: Install apt dependencies + run: | + sudo apt-get update + sudo apt-get install libltdl7-dev libgsl0-dev libncurses5-dev libreadline6-dev pkg-config + sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3 + + # Install Python dependencies + - name: Python dependencies + run: | + python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy pandas pytest-benchmark + python -m pip install -r requirements.txt + + # Install NEST simulator + - name: NEST simulator + run: | + python -m pip install cython + echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE" + NEST_SIMULATOR=$(pwd)/nest-simulator + NEST_INSTALL=$(pwd)/nest_install + echo "NEST_SIMULATOR = $NEST_SIMULATOR" + echo "NEST_INSTALL = $NEST_INSTALL" + + git clone --depth=1 https://github.com/nest/nest-simulator + mkdir nest_install + echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV + cd nest_install + cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR + make && make install + cd .. + + # Install NESTML (repeated) + - name: Install NESTML + run: | + export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.8/site-packages + #echo PYTHONPATH=`pwd` >> $GITHUB_ENV + echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV + python setup.py install + + - name: Track Fork PR Benchmarks with Bencher + env: + LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest + run: | + echo "NEST_INSTALL = $NEST_INSTALL" + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest bencher run \ + --project nestml \ + --token '${{ secrets.BENCHER_API_TOKEN }}' \ + --branch master \ + --threshold-measure latency \ + --threshold-test t_test \ + --threshold-max-sample-size 64 \ + --threshold-upper-boundary 0.99 \ + --thresholds-reset \ + --github-actions "${{ secrets.GITHUB_TOKEN }}" \ + --testbed ubuntu-latest \ + --adapter python_pytest \ + --file results.json \ + --err \ + 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest python3 -m pytest --benchmark-json results.json -s $GITHUB_WORKSPACE/tests/nest_continuous_benchmarking/test_nest_continuous_benchmarking.py' diff --git a/.github/workflows/continuous_benchmarking.yml b/.github/workflows/continuous_benchmarking_pull_requests.yml similarity index 52% rename from .github/workflows/continuous_benchmarking.yml rename to .github/workflows/continuous_benchmarking_pull_requests.yml index 05216365b..9afc730f1 100644 --- a/.github/workflows/continuous_benchmarking.yml +++ b/.github/workflows/continuous_benchmarking_pull_requests.yml @@ -85,87 +85,3 @@ jobs: --file results.json \ --err \ 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest python3 -m pytest --benchmark-json results.json -s $GITHUB_WORKSPACE/tests/nest_continuous_benchmarking/test_nest_continuous_benchmarking.py' - - -on: - push: - branches: master - -jobs: - benchmark_base_branch: - name: Continuous Benchmarking Fork PRs with Bencher - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.sha }} - persist-credentials: false - - - uses: bencherdev/bencher@main - - # Setup Python version - - name: Setup Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - # Install dependencies - - name: Install apt dependencies - run: | - sudo apt-get update - sudo apt-get install libltdl7-dev libgsl0-dev libncurses5-dev libreadline6-dev pkg-config - sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3 - - # Install Python dependencies - - name: Python dependencies - run: | - python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy pandas pytest-benchmark - python -m pip install -r requirements.txt - - # Install NEST simulator - - name: NEST simulator - run: | - python -m pip install cython - echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE" - NEST_SIMULATOR=$(pwd)/nest-simulator - NEST_INSTALL=$(pwd)/nest_install - echo "NEST_SIMULATOR = $NEST_SIMULATOR" - echo "NEST_INSTALL = $NEST_INSTALL" - - git clone --depth=1 https://github.com/nest/nest-simulator - mkdir nest_install - echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV - cd nest_install - cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR - make && make install - cd .. - - # Install NESTML (repeated) - - name: Install NESTML - run: | - export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.8/site-packages - #echo PYTHONPATH=`pwd` >> $GITHUB_ENV - echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV - python setup.py install - - - name: Track Fork PR Benchmarks with Bencher - env: - LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest - run: | - echo "NEST_INSTALL = $NEST_INSTALL" - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest bencher run \ - --project nestml \ - --token '${{ secrets.BENCHER_API_TOKEN }}' \ - --branch master \ - --threshold-measure latency \ - --threshold-test t_test \ - --threshold-max-sample-size 64 \ - --threshold-upper-boundary 0.99 \ - --thresholds-reset \ - --github-actions "${{ secrets.GITHUB_TOKEN }}" \ - --testbed ubuntu-latest \ - --adapter python_pytest \ - --file results.json \ - --err \ - 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest python3 -m pytest --benchmark-json results.json -s $GITHUB_WORKSPACE/tests/nest_continuous_benchmarking/test_nest_continuous_benchmarking.py'