From 4525ce6a84b5da1cc560a744a5ade481cea0cb6a Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Fri, 27 Aug 2021 08:16:48 -0400 Subject: [PATCH] Convert CI to use workflow triggers (#1189) Fixes #948 This PR does the following: 1. Changes the trigger for the PR comment updater from the cron method to workflow_run, triggered on completion of the test cases. This should remove the delay between the completion of the performance tests and the updating of the corresponding comment in the PR. 2. Separates the integrity check and performance check into separate workflows and allows them to run in parallel. This will allow the project to take advantage of multiple CI runners if they're available (which appears to be the case). In addition, this fixes an issue with post-merge undeleted/updated branches on PRs. The current "cron" method causes the CI to run the pr-update job over and over forever, unnecessarily. As described in github/docs#799, and the [github docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run), a `workflow_run` trigger will only fire when the workflow file is on the main branch. Thus, this change will not fire the PR updater on this PR. Thus there's no way to test this working properly without merging onto master and then testing on one of the other PRs. --- .github/workflows/integrity.yml | 38 +++++++++++++++++++ .../workflows/{tests.yml => performance.yml} | 33 +--------------- .github/workflows/pr-updater.yml | 9 ++--- 3 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/integrity.yml rename .github/workflows/{tests.yml => performance.yml} (95%) diff --git a/.github/workflows/integrity.yml b/.github/workflows/integrity.yml new file mode 100644 index 0000000..07b7794 --- /dev/null +++ b/.github/workflows/integrity.yml @@ -0,0 +1,38 @@ +# Workflow to run basic integrity checks on OMT`s new Pull Requests and commits pushed into OMT repo + +name: OpenMapTiles Integrity CI + +on: + push: + branches: [ master, master-tools ] + pull_request: + +jobs: + + integrity_test: + name: Run integrity test + runs-on: ubuntu-latest + steps: + + - name: Checkout the changes + uses: actions/checkout@v2 + + - name: Run quickstart for a small area + env: + area: monaco + MIN_ZOOM: 0 + MAX_ZOOM: 14 + QUIET: 1 + run: | + ./quickstart.sh $area + + - name: Save quickstart.log + uses: actions/upload-artifact@v2 + with: + name: quickstart.log + path: quickstart.log + + - name: Test etldoc images + run: | + export TEST_MODE=yes + make generate-devdoc diff --git a/.github/workflows/tests.yml b/.github/workflows/performance.yml similarity index 95% rename from .github/workflows/tests.yml rename to .github/workflows/performance.yml index ccee82c..28fcbfe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/performance.yml @@ -1,6 +1,6 @@ -# Workflow to validate OMT`s new Pull Requests and commits pushed into OMT repo +# Workflow to run performance tests OMT`s new Pull Requests and commits pushed into OMT repo -name: OpenMapTiles CI +name: OpenMapTiles Performance CI on: push: @@ -8,35 +8,6 @@ on: pull_request: jobs: - - integrity_test: - name: Run integrity test - runs-on: ubuntu-latest - steps: - - - name: Checkout the changes - uses: actions/checkout@v2 - - - name: Run quickstart for a small area - env: - area: monaco - MIN_ZOOM: 0 - MAX_ZOOM: 14 - QUIET: 1 - run: | - ./quickstart.sh $area - - - name: Save quickstart.log - uses: actions/upload-artifact@v2 - with: - name: quickstart.log - path: quickstart.log - - - name: Test etldoc images - run: | - export TEST_MODE=yes - make generate-devdoc - performance: name: Evaluate performance runs-on: self-hosted diff --git a/.github/workflows/pr-updater.yml b/.github/workflows/pr-updater.yml index d309e0e..f9896ce 100644 --- a/.github/workflows/pr-updater.yml +++ b/.github/workflows/pr-updater.yml @@ -1,15 +1,14 @@ name: Update PR comments on: - # This number should correspond to the IGNORE_RUNS_OLDER_THAN value below. - # When setting up for the first time, use "on: push" instead of "on: schedule" - # and set IGNORE_RUNS_OLDER_THAN to a very high number until it runs once. - schedule: - - cron: '*/6 * * * *' + workflow_run: + workflows: ["OpenMapTiles Performance CI"] + types: [completed] jobs: update_PRs: runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: main