From 2e3417f545c87e3b2c3a4c9c1e16e37a2e511eb5 Mon Sep 17 00:00:00 2001 From: dcherian Date: Thu, 13 Apr 2023 11:29:12 -0600 Subject: [PATCH 1/4] Add benchmark against latest release on main. --- .github/workflows/benchmarks-last-release.yml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/benchmarks-last-release.yml diff --git a/.github/workflows/benchmarks-last-release.yml b/.github/workflows/benchmarks-last-release.yml new file mode 100644 index 00000000000..0621a59959f --- /dev/null +++ b/.github/workflows/benchmarks-last-release.yml @@ -0,0 +1,79 @@ +name: Benchmark compare last release + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + benchmark: + name: Linux + runs-on: ubuntu-20.04 + env: + ASV_DIR: "./asv_bench" + CONDA_ENV_FILE: ci/requirements/environment.yml + + steps: + # We need the full repo to avoid this issue + # https://github.com/actions/checkout/issues/23 + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up conda environment + uses: mamba-org/provision-with-micromamba@v15 + with: + environment-file: ${{env.CONDA_ENV_FILE}} + environment-name: xarray-tests + cache-env: true + cache-env-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}-benchmark" + extra-specs: | + asv + + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + # with: + # fallback: 1.0.0 # Optional fallback tag to use when no tag can be found + + - name: Run benchmarks + shell: bash -l {0} + id: benchmark + env: + OPENBLAS_NUM_THREADS: 1 + MKL_NUM_THREADS: 1 + OMP_NUM_THREADS: 1 + ASV_FACTOR: 1.5 + ASV_SKIP_SLOW: 1 + run: | + set -x + # ID this runner + asv machine --yes + echo "Baseline: ${{ steps.previoustag.outputs.tag }} " + echo "Contender: ${{ github.sha }}" + # Use mamba for env creation + # export CONDA_EXE=$(which mamba) + export CONDA_EXE=$(which conda) + # Run benchmarks for current commit against base + ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR" + asv continuous $ASV_OPTIONS ${{ steps.previoustag.outputs.tag }} ${{ github.sha }} \ + | sed "/Traceback \|failed$\|PERFORMANCE DECREASED/ s/^/::error::/" \ + | tee benchmarks.log + # Report and export results for subsequent steps + if grep "Traceback \|failed\|PERFORMANCE DECREASED" benchmarks.log > /dev/null ; then + exit 1 + fi + working-directory: ${{ env.ASV_DIR }} + + - name: Add instructions to artifact + if: always() + run: | + cp benchmarks/README_CI.md benchmarks.log .asv/results/ + working-directory: ${{ env.ASV_DIR }} + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: asv-benchmark-results-${{ runner.os }} + path: ${{ env.ASV_DIR }}/.asv/results From e517c121aab03634109076c334278315901f61e9 Mon Sep 17 00:00:00 2001 From: dcherian Date: Thu, 13 Apr 2023 11:34:27 -0600 Subject: [PATCH 2/4] Revert --- .github/workflows/benchmarks-last-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/benchmarks-last-release.yml b/.github/workflows/benchmarks-last-release.yml index 0621a59959f..cf974bbfef2 100644 --- a/.github/workflows/benchmarks-last-release.yml +++ b/.github/workflows/benchmarks-last-release.yml @@ -1,6 +1,8 @@ name: Benchmark compare last release on: + pull_request: + types: [opened, reopened, synchronize, labeled] push: branches: - main From f585dbbf365c20352343d98b2799f4be1419b27b Mon Sep 17 00:00:00 2001 From: dcherian Date: Thu, 13 Apr 2023 11:36:12 -0600 Subject: [PATCH 3/4] [skip-ci] From 9be268c3987ff87dc0400a6c59add2f6464cfbd3 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Thu, 13 Apr 2023 12:51:00 -0600 Subject: [PATCH 4/4] [skip-ci] remove pull-request trigger --- .github/workflows/benchmarks-last-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/benchmarks-last-release.yml b/.github/workflows/benchmarks-last-release.yml index cf974bbfef2..0621a59959f 100644 --- a/.github/workflows/benchmarks-last-release.yml +++ b/.github/workflows/benchmarks-last-release.yml @@ -1,8 +1,6 @@ name: Benchmark compare last release on: - pull_request: - types: [opened, reopened, synchronize, labeled] push: branches: - main