From 5e50e71f33a55cce28a33f6a39136147fcb6ff4a Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 12:43:40 -0400 Subject: [PATCH 01/10] CI: Build merged version on CircleCI [skip actions] [skip appveyor] --- .circleci/config.yml | 17 +++++++++++++++++ .github/workflows/circleci.yml | 1 + 2 files changed, 18 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 802a09097aac..82460c06f7d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,22 @@ version: 2.1 # commands: + merge: + steps: + - run: + name: Merge with upstream + command: | + if ! git remote -v | grep upstream; then + git remote add upstream git://github.com/matplotlib/matplotlib.git + fi + git fetch upstream + echo $(git log -1 --pretty=%B) | tee gitlog.txt + echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt + if [[ $(cat merge.txt) != "" ]]; then + echo "Merging $(cat merge.txt)"; + git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge"; + fi + apt-install: steps: - run: @@ -124,6 +140,7 @@ jobs: - image: circleci/python:3.8 steps: - checkout + - merge - apt-install - fonts-install diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 90ed466828ed..75fc40d32e99 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -10,3 +10,4 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} artifact-path: 0/doc/build/html/index.html circleci-jobs: docs-python38 + job-title: Check the rendered docs here! From e366e0ba4fa8a9a86bb03f7cf6a197783bba7ee6 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 13:03:26 -0400 Subject: [PATCH 02/10] ENH: Add [skip azp] in addition to [skip actions] [skip appveyor] --- .circleci/config.yml | 1 - azure-pipelines.yml | 237 +++++++++++++++++++++++-------------------- 2 files changed, 129 insertions(+), 109 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 82460c06f7d9..2e86135ad4ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,7 +18,6 @@ commands: git remote add upstream git://github.com/matplotlib/matplotlib.git fi git fetch upstream - echo $(git log -1 --pretty=%B) | tee gitlog.txt echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt if [[ $(cat merge.txt) != "" ]]; then echo "Merging $(cat merge.txt)"; diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e35ccf3ebec1..5d51afa86f67 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,122 +3,143 @@ # Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: # https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/python?view=azure-devops -strategy: - matrix: - Linux_py37: - vmImage: 'ubuntu-18.04' - python.version: '3.7' - Linux_py38: - vmImage: 'ubuntu-18.04' - python.version: '3.8' - Linux_py39: - vmImage: 'ubuntu-18.04' - python.version: '3.9' - macOS_py37: - vmImage: 'macOS-10.15' - python.version: '3.7' - macOS_py38: - vmImage: 'macOS-latest' - python.version: '3.8' - macOS_py39: - vmImage: 'macOS-latest' - python.version: '3.9' - Windows_py37: - vmImage: 'vs2017-win2016' - python.version: '3.7' - Windows_py38: - vmImage: 'windows-latest' - python.version: '3.8' - Windows_py39: - vmImage: 'windows-latest' - python.version: '3.9' - maxParallel: 4 +stages: -pool: - vmImage: '$(vmImage)' - -steps: +- stage: Check + jobs: + - job: Skip + pool: + vmImage: 'ubuntu-18.04' + variables: + DECODE_PERCENTS: 'false' + RET: 'true' + steps: + - bash: | + git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` + echo "##vso[task.setvariable variable=log]$git_log" + - bash: echo "##vso[task.setvariable variable=RET]false" + condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]')) + - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" + name: result -- task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - displayName: 'Use Python $(python.version)' - condition: and(succeeded(), ne(variables['python.version'], 'Pre')) +- stage: Main + condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) + dependsOn: Check + jobs: + - job: Pytest + strategy: + matrix: + Linux_py37: + vmImage: 'ubuntu-18.04' + python.version: '3.7' + Linux_py38: + vmImage: 'ubuntu-18.04' + python.version: '3.8' + Linux_py39: + vmImage: 'ubuntu-18.04' + python.version: '3.9' + macOS_py37: + vmImage: 'macOS-10.15' + python.version: '3.7' + macOS_py38: + vmImage: 'macOS-latest' + python.version: '3.8' + macOS_py39: + vmImage: 'macOS-latest' + python.version: '3.9' + Windows_py37: + vmImage: 'vs2017-win2016' + python.version: '3.7' + Windows_py38: + vmImage: 'windows-latest' + python.version: '3.8' + Windows_py39: + vmImage: 'windows-latest' + python.version: '3.9' + maxParallel: 4 + pool: + vmImage: '$(vmImage)' + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: 'x64' + displayName: 'Use Python $(python.version)' + condition: and(succeeded(), ne(variables['python.version'], 'Pre')) -- task: stevedower.python.InstallPython.InstallPython@1 - displayName: 'Use prerelease Python' - inputs: - prerelease: true - condition: and(succeeded(), eq(variables['python.version'], 'Pre')) + - task: stevedower.python.InstallPython.InstallPython@1 + displayName: 'Use prerelease Python' + inputs: + prerelease: true + condition: and(succeeded(), eq(variables['python.version'], 'Pre')) -- bash: | - set -e - case "$(python -c 'import sys; print(sys.platform)')" in - linux) - sudo apt update - sudo apt install \ - cm-super \ - dvipng \ - ffmpeg \ - gdb \ - gir1.2-gtk-3.0 \ - graphviz \ - inkscape \ - libcairo2 \ - libgirepository-1.0.1 \ - lmodern \ - fonts-freefont-otf \ - poppler-utils \ - texlive-pictures \ - texlive-fonts-recommended \ - texlive-latex-base \ - texlive-latex-extra \ - texlive-latex-recommended \ - texlive-xetex texlive-luatex \ - ttf-wqy-zenhei - ;; - darwin) - brew install --cask xquartz - brew install pkg-config ffmpeg imagemagick mplayer ccache - ;; - win32) - ;; - *) - exit 1 - ;; - esac - displayName: 'Install dependencies' + - bash: | + set -e + case "$(python -c 'import sys; print(sys.platform)')" in + linux) + sudo apt update + sudo apt install \ + cm-super \ + dvipng \ + ffmpeg \ + gdb \ + gir1.2-gtk-3.0 \ + graphviz \ + inkscape \ + libcairo2 \ + libgirepository-1.0.1 \ + lmodern \ + fonts-freefont-otf \ + poppler-utils \ + texlive-pictures \ + texlive-fonts-recommended \ + texlive-latex-base \ + texlive-latex-extra \ + texlive-latex-recommended \ + texlive-xetex texlive-luatex \ + ttf-wqy-zenhei + ;; + darwin) + brew install --cask xquartz + brew install pkg-config ffmpeg imagemagick mplayer ccache + ;; + win32) + ;; + *) + exit 1 + ;; + esac + displayName: 'Install dependencies' -- bash: | - python -m pip install --upgrade pip - python -m pip install -r requirements/testing/all.txt -r requirements/testing/extra.txt || - [[ "$PYTHON_VERSION" = 'Pre' ]] - displayName: 'Install dependencies with pip' + - bash: | + python -m pip install --upgrade pip + python -m pip install -r requirements/testing/all.txt -r requirements/testing/extra.txt || + [[ "$PYTHON_VERSION" = 'Pre' ]] + displayName: 'Install dependencies with pip' -- bash: | - python -m pip install -ve . || - [[ "$PYTHON_VERSION" = 'Pre' ]] - displayName: "Install self" + - bash: | + python -m pip install -ve . || + [[ "$PYTHON_VERSION" = 'Pre' ]] + displayName: "Install self" -- script: env - displayName: 'print env' + - script: env + displayName: 'print env' -- bash: | - PYTHONFAULTHANDLER=1 python -m pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 || - [[ "$PYTHON_VERSION" = 'Pre' ]] - displayName: 'pytest' + - bash: | + PYTHONFAULTHANDLER=1 python -m pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 || + [[ "$PYTHON_VERSION" = 'Pre' ]] + displayName: 'pytest' -- bash: | - bash <(curl -s https://codecov.io/bash) -f "!*.gcov" -X gcov - displayName: 'Upload to codecov.io' + - bash: | + bash <(curl -s https://codecov.io/bash) -f "!*.gcov" -X gcov + displayName: 'Upload to codecov.io' -- task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() + - task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test-results.xml' + testRunTitle: 'Python $(python.version)' + condition: succeededOrFailed() -- publish: $(System.DefaultWorkingDirectory)/result_images - artifact: $(Agent.JobName)-result_images - condition: and(failed(), ne(variables['python.version'], 'Pre')) + - publish: $(System.DefaultWorkingDirectory)/result_images + artifact: $(Agent.JobName)-result_images + condition: and(failed(), ne(variables['python.version'], 'Pre')) From ecbd9d54f740e19d9789402180fbfb72d12a4ed4 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 13:05:38 -0400 Subject: [PATCH 03/10] CI: Make sure Azure still works [skip actions] [skip appveyor] From 34890a05b0a44df93b9cc67045899f1a1aadaa08 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 15:19:58 -0400 Subject: [PATCH 04/10] ENH: Add CircleCI skip [skip circle] [skip azp] [skip appveyor] [skip actions] --- .circleci/config.yml | 14 ++++++++++++++ doc/devel/coding_guide.rst | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e86135ad4ad..eed6281105af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,19 @@ commands: git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge"; fi + check-skip: + steps: + - run: + name: Check-skip + command: | + export COMMIT_MESSAGE=$(git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " ") + echo "Got commit message:" + echo "${COMMIT_MESSAGE}" + if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then + echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}." + circleci-agent step halt; + fi + apt-install: steps: - run: @@ -139,6 +152,7 @@ jobs: - image: circleci/python:3.8 steps: - checkout + - check-skip - merge - apt-install diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index f936483dee1e..9d87601854a2 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -219,6 +219,17 @@ will run on all supported platforms and versions of Python. .. _tox: https://tox.readthedocs.io/ +* If you know your changes do not need to be tested (this is very rare!), all + CIs can be skipped by including ``[ci skip]`` or ``[skip ci]`` in your + commit message. If you know only a subset of CIs need to be run (e.g., + if you are changing some block of plain reStructuredText and only want + only CircleCI to run to render the result), individual CIs can be skipped + to save bandwidth using: + + - GitHub Actions: ``[skip actions]`` + - AppVeyor: ``[skip appveyor]`` + - Azure Pipelines: ``[skip azp]`` + - CircleCI: ``[skip circle]`` .. _pr-squashing: From e1afbeaf29e4b2dc8ef751330c822033db021792 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 15:31:08 -0400 Subject: [PATCH 05/10] FIX: Correct CircleCI skip [skip circle] [skip azp] [skip appveyor] [skip actions] --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eed6281105af..65f5adcbe698 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,8 @@ commands: - run: name: Check-skip command: | - export COMMIT_MESSAGE=$(git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " ") + git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " " > commit_message.txt + export COMMIT_MESSAGE=$(cat commit_message.txt); echo "Got commit message:" echo "${COMMIT_MESSAGE}" if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then From f6b11e8ba7dfa2335d93f83008f69cdf462b450f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 15:33:11 -0400 Subject: [PATCH 06/10] TST: Check docs output [skip azp] [skip appveyor] [skip actions] From 42fe53cc7eb3061408d6bc69d3aa82cdc779afa7 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 15:38:06 -0400 Subject: [PATCH 07/10] FIX: Dont skip one [skip azp] [skip appveyor] [skip actions] --- .circleci/config.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 65f5adcbe698..086ede88e3b8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,20 @@ version: 2.1 # commands: + check-skip: + steps: + - run: + name: Check-skip + command: | + git log --max-count=1 --pretty=format:"%B" | tr "\n" " " > commit_message.txt + export COMMIT_MESSAGE=$(cat commit_message.txt); + echo "Got commit message:" + echo "${COMMIT_MESSAGE}" + if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then + echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}." + circleci-agent step halt; + fi + merge: steps: - run: @@ -24,20 +38,6 @@ commands: git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge"; fi - check-skip: - steps: - - run: - name: Check-skip - command: | - git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " " > commit_message.txt - export COMMIT_MESSAGE=$(cat commit_message.txt); - echo "Got commit message:" - echo "${COMMIT_MESSAGE}" - if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then - echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}." - circleci-agent step halt; - fi - apt-install: steps: - run: From 218be782986762d7330416302e0720b5b61b414d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 19 Jul 2021 16:28:48 -0400 Subject: [PATCH 08/10] DOC: Update [ci skip] --- doc/devel/coding_guide.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index 9d87601854a2..963845cd4a4b 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -220,14 +220,15 @@ will run on all supported platforms and versions of Python. .. _tox: https://tox.readthedocs.io/ * If you know your changes do not need to be tested (this is very rare!), all - CIs can be skipped by including ``[ci skip]`` or ``[skip ci]`` in your - commit message. If you know only a subset of CIs need to be run (e.g., - if you are changing some block of plain reStructuredText and only want - only CircleCI to run to render the result), individual CIs can be skipped - to save bandwidth using: + CIs can be skipped for a given commit by including ``[ci skip]`` or + ``[skip ci]`` in the commit message. If you know only a subset of CIs need + to be run (e.g., if you are changing some block of plain reStructuredText and + want only CircleCI to run to render the result), individual CIs can be + skipped on individual commits as well by using the following substrings + in commit messages: - GitHub Actions: ``[skip actions]`` - - AppVeyor: ``[skip appveyor]`` + - AppVeyor: ``[skip appveyor]`` (must be in the first line of the commit) - Azure Pipelines: ``[skip azp]`` - CircleCI: ``[skip circle]`` From d25357a933085ccbe283c83557307ca9408c5164 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 20 Jul 2021 13:03:20 -0400 Subject: [PATCH 09/10] MAINT: Cleaner vars [skip azp] [skip actions] [skip appveyor] --- .circleci/config.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 086ede88e3b8..d1d3655d1cb5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,11 +14,10 @@ commands: - run: name: Check-skip command: | - git log --max-count=1 --pretty=format:"%B" | tr "\n" " " > commit_message.txt - export COMMIT_MESSAGE=$(cat commit_message.txt); + export git_log=$(git log --max-count=1 --pretty=format:"%B" | tr "\n" " ") echo "Got commit message:" - echo "${COMMIT_MESSAGE}" - if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then + echo "${git_log}" + if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$git_log" == *"[skip circle]"* ]] || [[ "$git_log" == *"[circle skip]"* ]]); then echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}." circleci-agent step halt; fi @@ -32,10 +31,10 @@ commands: git remote add upstream git://github.com/matplotlib/matplotlib.git fi git fetch upstream - echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt - if [[ $(cat merge.txt) != "" ]]; then - echo "Merging $(cat merge.txt)"; - git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge"; + export merge=${CI_PULL_REQUEST//*pull\//} + if [[ "$merge" != "" ]]; then + echo "Merging ${merge})"; + git pull --ff-only upstream "refs/pull/${merge}/merge"; fi apt-install: From 2a0da4206531c6f2c9a91aa2e9e3c3f11d3f2711 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 20 Jul 2021 13:06:17 -0400 Subject: [PATCH 10/10] FIX: Cruft [skip azp] [skip actions] [skip appveyor] [skip circle] --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d1d3655d1cb5..bb93687c3181 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,7 +33,7 @@ commands: git fetch upstream export merge=${CI_PULL_REQUEST//*pull\//} if [[ "$merge" != "" ]]; then - echo "Merging ${merge})"; + echo "Merging ${merge}"; git pull --ff-only upstream "refs/pull/${merge}/merge"; fi