From 60c4bef8c39dfc67684b87aa9924601d98d0f436 Mon Sep 17 00:00:00 2001 From: Yishuo Wang Date: Tue, 16 Aug 2022 09:36:58 +0800 Subject: [PATCH] fix bugs of regression test (#5380) * fix the the issue that `IS_PR `environment takes no effect * fix the branch checkout --- .../workflows/performance-regression-test.yml | 16 ++++++++++------ python/nano/benchmark/run.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/performance-regression-test.yml b/.github/workflows/performance-regression-test.yml index 9dd948ad52f..6013ffd66cd 100644 --- a/.github/workflows/performance-regression-test.yml +++ b/.github/workflows/performance-regression-test.yml @@ -13,7 +13,15 @@ jobs: runs-on: [Rohan, ubuntu-20.04-lts] if: github.event.schedule || github.event.issue.pull_request && github.event.comment.body=='APRT' steps: - - uses: actions/checkout@v3 + - name: checkout (schedule) + if: github.event.schedule + uses: actions/checkout@v3 + + - name: checkout (pr comments) + if: github.event.issue.pull_request + uses: actions/checkout@v3 + with: + ref: ${{ format('refs/pull/{0}/merge', github.event.issue.number) }} - name: Set up Python uses: actions/setup-python@v2 @@ -28,13 +36,9 @@ jobs: pip install twine pip install psycopg2-binary - - name: Check if it is triggered by PR comments - if: github.event.issue.pull_request - run: | - export IS_PR=1 - - name: Run benchmark run: | python python/nano/benchmark/run.py resnet50 env: ANALYTICS_ZOO_ROOT: ${{ github.workspace }} + IS_PR: ${{ github.event.issue.pull_request != null}} diff --git a/python/nano/benchmark/run.py b/python/nano/benchmark/run.py index 5e16f2dfaf2..d362f38ace4 100644 --- a/python/nano/benchmark/run.py +++ b/python/nano/benchmark/run.py @@ -50,7 +50,7 @@ def _extract_logs(output: str): return logs def _save_logs(self, logs: list): - is_pr = True if os.environ.get('IS_PR') is not None else False + is_pr = True if os.environ.get('IS_PR') == 'true' else False timestamp = datetime.now() conn = psycopg2.connect( database=self._get_secret('DB_NAME'),