From 6fec148f565029dbe49b8ab8f3c75aabe71ce3b3 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Feb 2021 00:05:52 -0500 Subject: [PATCH] CI: Run tests in a single CI job (Ubuntu + Python 3.9) for draft PRs (#906) This PR improves the "Tests" workflow to save CI resources: - For draft PRs: only run tests on Ubuntu + Python 3.9 (~10 minutes) - When draft PRs are ready for review, run all CI jobs (9 jobs, 10-30 minutes) - If converting PRs back to draft mode, pushes still only trigger one job (~10 minutes) - After merged into master, all 9 jobs will run. * Update MAINTENANCE.md Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- .github/workflows/ci_tests.yaml | 17 +++++++++++++++++ MAINTENANCE.md | 2 ++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 7e745252b91..427879532c1 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -7,6 +7,7 @@ on: push: branches: [ master ] pull_request: + types: [opened, reopened, synchronize, ready_for_review] paths-ignore: - 'doc/**' - '*.md' @@ -29,6 +30,22 @@ jobs: matrix: python-version: [3.7, 3.8, 3.9] os: [ubuntu-latest, macOS-latest, windows-latest] + # Is it a draft Pull Request (true or false)? + isDraft: + - ${{ github.event.pull_request.draft }} + # Only run one job (Ubuntu + Python 3.9) for draft PRs + exclude: + - os: macOS-latest + isDraft: true + - os: windows-latest + isDraft: true + - os: ubuntu-latest + python-version: 3.7 + isDraft: true + - os: ubuntu-latest + python-version: 3.8 + isDraft: true + # environmental variables used in coverage env: OS: ${{ matrix.os }} diff --git a/MAINTENANCE.md b/MAINTENANCE.md index c6ed5d3477e..ecc9a2c600f 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -58,6 +58,8 @@ It is also scheduled to run daily on the *master* branch. This is ran on every commit to the *master* and Pull Request branches. It is also scheduled to run daily on the *master* branch. +In draft Pull Requests, only one job (Ubuntu + Python latest) +is triggered to save on Continuous Integration resources. On the *master* branch, the workflow also handles the documentation deployment: