Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Merge open blocker PRs in all CI workflows + other improvements #36338

Merged
merged 11 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .ci/merge-fixes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
# Merge open PRs from sagemath/sage labeled "blocker".
REPO="sagemath/sage"
GH="gh -R $REPO"
PRs="$($GH pr list --label "p: blocker / 1" --json number --jq '.[].number')"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting approach. There is a couple of thoughts I have about this:

  • We would merge any blocker PR. Is there any quality control, e.g. pipeline passed etc. or positively reviewed.
  • This would self-reference blockers.
  • Unless we merge in all blockers first, we might merge in PRs that depend on blockers, but do not declare that dependency correctly.

Would there still be a sanity check that just tests this PR without merging in other things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We would merge any blocker PR. Is there any quality control, e.g. pipeline passed etc. or positively reviewed.

There isn't, and I don't think it's needed. Since the transition to GitHub, using priority labels has become pretty rare, and no one has used the blocker tag without a good reason.

Copy link
Member Author

@mkoeppe mkoeppe Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This would self-reference blockers.

Yes, but for these the merge would be a no-op, and I think I'm handling this correctly in the scripts.

EDIT: See the run for the current workflow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Unless we merge in all blockers first, we might merge in PRs that depend on blockers, but do not declare that dependency correctly.

Currently, the release manager scripts ignore all dependencies and all priorities anyway...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds plausible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to make sure that they also have the "postive review" label.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not. Sometimes it takes a while to find a competent reviewer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #36338 (comment) for @mkoeppe's opinion on this.

Without requiring "positive review" label, we can check the PR before we set it positive review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will influence every other PR, so I think there should be some safety measure.

Without requiring "positive review" label, we can check the PR before we set it positive review.

What do you mean? Doesn't the CI of that PR already checks the PR? Why do you need other PRs to check it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I think there should be some safety measure.

We already have that, namely the Triage group + common sense.

Copy link
Member Author

@mkoeppe mkoeppe Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not putting off fire. There's no need to act immediately as soon as someone pushes a CI-fix PR and adds blocker label.

Well, it's not fire, but it's a matter of "availability of the CI services", which, if poor, leads to developer frustration (@fchapoton @tornaria) and can dramatically reduce development velocity because developers may disengage or wait until the CI is fixed again.

Let's consider the period from the release of a beta version to the release of the next beta version, currently about a week. For, say, 95% of availability of the CI, we want a CI fix to take effect within a few hours of a broken release.

We all want to fix CI failures as soon as possible and it would not take long before another one would lend second eyes to check the PR and give positive review.

This may be true for trivial fixes such as the linter failures, which can be fixed and reviewed by many people.

But for fixes to CI and build system, it hinges on the availability of a very small number of people, and time-to-positive-review can be several days -- which can easily make the availability of the CI services less than 50%.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobiasdiez wrote:

Sorry, but I don't understand the argument here: because two people don't like the change, we go along with the solution that one person prefers?

I know that @tobiasdiez knows this already, but I'll point out again: Our project does not hold majority votes In PR discussions.

I actually think this PR here is a perfect example: there is absolutely no reason this is tagged as a blocker, it doesn't resolve any issues with falling CIs or something similar,

This is false. This PR does resolve the issue of the failing CIs. Merging this PR is enough to fix all CI problems in the current cycle: it auto-applies the blocker PRs #36327 and #36276.

it is not tested very well (or did any of the reviewers tried to run the new macos workflow and the other changed workflows on the main repo?)

This is false, and moreover an inappropriate attack on author and reviewers.

Copy link
Collaborator

@kwankyu kwankyu Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Here is my suggestion. As we can observe by looking at the labelling war below, there are conflicting opinions on which way this PR should proceed. If the issue is large and of broad interest in our community, then this situation would be resolved by a voting in sage-devel. But the current issue is a small one, and it would be ridiculous and shameful to spend a long time for endless discussions or a large-scale voting. Hence let me suggest a small voting here, as defined below:

The voting is about (a) "only blocker label" vs (b) "blocker label + positive review". The voting occurs only in this thread. The voting starts by the votes of @tobiasdiez and @mkoeppe, by which they are supposed to have vowed on accepting the voting result. The voting ends automatically when there was no more vote for the last 24 hours. When the voting ends, the author of the PR proceeds in the way of winning candidate. Please only vote with an optional simple comment in the rest of this thread.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 on holding majority votes in PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobiasdiez wrote:

Sorry, but I don't understand the argument here: because two people don't like the change, we go along with the solution that one person prefers?

I know that @tobiasdiez knows this already, but I'll point out again: Our project does not hold majority votes In PR discussions.

I actually think this PR here is a perfect example: there is absolutely no reason this is tagged as a blocker, it doesn't resolve any issues with falling CIs or something similar,

This is false. This PR does resolve the issue of the failing CIs. Merging this PR is enough to fix all CI problems in the current cycle: it auto-applies the blocker PRs #36327 and #36276.

it is not tested very well (or did any of the reviewers tried to run the new macos workflow and the other changed workflows on the main repo?)

This is false, and moreover an inappropriate attack on author and reviewers.

Sadly not false...

if [ -z "$PRs" ]; then
echo 'Nothing to do: Found no open PRs with "blocker" status.'
else
echo "Found PRs: " $PRs
export GIT_AUTHOR_NAME="ci-sage workflow"
export GIT_AUTHOR_EMAIL="ci-sage@example.com"
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git tag -f test_base
git commit -q -m "Uncommitted changes" --no-allow-empty -a
for a in $PRs; do
echo "::group::Merging PR https://github.com/$REPO/pull/$a"
git tag -f test_head
$GH pr checkout -b pr-$a $a
git fetch --unshallow --all
git checkout -q test_head
if git merge --no-edit --squash -q pr-$a; then
echo "::endgroup::"
git commit -q -m "Merge https://github.com/$REPO/pull/$a" -a --allow-empty
echo "Merged #$a"
else
echo "::endgroup::"
echo "Failure merging #$a, resetting"
git reset --hard
fi
done
git log test_base..HEAD
fi
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,30 @@ concurrency:
cancel-in-progress: true

jobs:
get_ci_fixes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds now another row in the checks under each PR, which is already a pretty crowded. Can this not be merged directly in the build workflow as you do say with conda?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the container does not have a suitable version of the gh script available, and installing it is too annoying.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkoeppe, No response to this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to switch a different view; I responded above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that one's not portable to i686, and overall I don't think this is a worthwhile change

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the duplicate lines too. But that's a trivial issue, and there's no simple fix. Let's ignore it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using any i686 architecture...that's a very potential if and when argument...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using any i686 architecture...that's a very potential if and when argument...

Yes, we are. The build.yml workflow accepts the container image on workflow_dispatch, and we do test 32-bit platforms.

runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Store CI fixes in upstream artifact
run: |
mkdir -p upstream
git format-patch --stdout test_base > upstream/ci_fixes.patch
- uses: actions/upload-artifact@v2
with:
path: upstream
name: upstream

build:
runs-on: ubuntu-latest
container: ghcr.io/sagemath/sage/sage-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}}
needs: [get_ci_fixes]
steps:
- name: Checkout
id: checkout
Expand Down Expand Up @@ -68,6 +89,21 @@ jobs:
if [ ! -f worktree-image/.gitignore ]; then cp .gitignore worktree-image/; fi
(cd worktree-image && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)

- name: Download upstream artifact
uses: actions/download-artifact@v3
with:
path: upstream
name: upstream

- name: Apply CI fixes from sagemath/sage
# After applying the fixes, make sure all changes are marked as uncommitted changes.
run: |
if [ -r upstream/ci_fixes.patch ]; then
(cd worktree-image && git commit --quiet -m "current changes" --allow-empty -a && git am) < upstream/ci_fixes.patch
git reset --quiet old
git add --quiet -N .
fi

- name: Incremental build, test changed files (sage -t --new)
id: incremental
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}

- name: Check for Miniconda
id: check_conda
run: echo ::set-output name=installed::$CONDA
Expand Down
115 changes: 33 additions & 82 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,89 +30,40 @@ env:
TARGETS_OPTIONAL: ptest

jobs:
local-macos:
stage-1:
uses: ./.github/workflows/macos.yml
with:
stage: "1"

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
stage: ["1", "2", "2-optional-0-o", "2-optional-p-z", "2-experimental-0-o", "2-experimental-p-z"]
# python3_xcode is only accepted if enough packages are available from the system
# --> to test "minimal", we would need https://github.com/sagemath/sage/issues/30949
tox_env: [homebrew-macos-usrlocal-minimal, homebrew-macos-usrlocal-standard, homebrew-macos-usrlocal-maximal, homebrew-macos-usrlocal-python3_xcode-standard, conda-forge-macos-minimal, conda-forge-macos-standard, conda-forge-macos-maximal]
xcode_version_factor: [default]
os: [ macos-11, macos-12 ]
env:
TOX_ENV: local-${{ matrix.tox_env }}
LOCAL_ARTIFACT_NAME: sage-local-commit-${{ github.sha }}-tox-local-${{ matrix.tox_env }}-${{ matrix.os }}-xcode_${{ matrix.xcode_version_factor }}
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-local-${{ matrix.tox_env }}--${{ matrix.os }}-xcode_${{ matrix.xcode_version_factor }}
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
run: |
if [ ${{ matrix.xcode_version_factor }} != default ]; then sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version_factor }}.app; fi
- name: Install test prerequisites
run: |
brew install tox
- uses: actions/download-artifact@v3
with:
path: sage-local-artifact
name: ${{ env.LOCAL_ARTIFACT_NAME }}
if: contains(matrix.stage, '2')
- name: Extract sage-local artifact
# This is macOS tar -- cannot use --listed-incremental
run: |
export SAGE_LOCAL=$(pwd)/.tox/$TOX_ENV/local
.github/workflows/extract-sage-local.sh sage-local-artifact/sage-local-*.tar
if: contains(matrix.stage, '2')
- name: Build and test with tox
# We use a high parallelization on purpose in order to catch possible parallelization bugs in the build scripts.
# For doctesting, we use a lower parallelization to avoid timeouts.
run: |
case "${{ matrix.stage }}" in
1) export TARGETS_PRE="all-sage-local" TARGETS="all-sage-local" TARGETS_OPTIONAL="build/make/Makefile"
;;
2) export TARGETS_PRE="all-sage-local" TARGETS="build doc-html" TARGETS_OPTIONAL="ptest"
;;
2-optional*) export TARGETS_PRE="build/make/Makefile" TARGETS="build/make/Makefile"
targets_pattern="${{ matrix.stage }}"
targets_pattern="${targets_pattern#2-optional-}"
export TARGETS_OPTIONAL=$( echo $(export PATH=build/bin:$PATH && sage-package list :optional: --has-file 'spkg-install.in|spkg-install|requirements.txt' --no-file huge|has_nonfree_dependencies | grep -v sagemath_doc | grep "^[$targets_pattern]" ) )
;;
2-experimental*) export TARGETS_PRE="build/make/Makefile" TARGETS="build/make/Makefile"
targets_pattern="${{ matrix.stage }}"
targets_pattern="${targets_pattern#2-experimental-}"
export TARGETS_OPTIONAL=$( echo $(export PATH=build/bin:$PATH && sage-package list :experimental: --has-file 'spkg-install.in|spkg-install|requirements.txt' --no-file huge|has_nonfree_dependencies | grep -v sagemath_doc | grep "^[$targets_pattern]" ) )
;;
esac
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=4 $TARGETS
- name: Prepare logs artifact
run: |
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
if: always()
- uses: actions/upload-artifact@v3
with:
path: artifacts
name: ${{ env.LOGS_ARTIFACT_NAME }}
if: always()
- name: Print out logs for immediate inspection
# and markup the output with GitHub Actions logging commands
run: |
.github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME"
if: always()
- name: Prepare sage-local artifact
# This also includes the copies of homebrew or conda installed in the tox environment.
# We use absolute pathnames in the tar file.
# This is macOS tar -- cannot use --remove-files.
# We remove the $SAGE_LOCAL/lib64 link, which will be recreated by the next stage.
run: |
mkdir -p sage-local-artifact && (cd .tox/$TOX_ENV && rm -f "local/lib64" && tar -cf - $(pwd)) > sage-local-artifact/sage-${{ env.TOX_ENV }}-${{ matrix.stage }}.tar
if: contains(matrix.stage, '1')
- uses: actions/upload-artifact@v3
with:
path: sage-local-artifact/sage-${{ env.TOX_ENV }}-${{ matrix.stage }}.tar
name: ${{ env.LOCAL_ARTIFACT_NAME }}
if: always()
stage-2:
uses: ./.github/workflows/macos.yml
with:
stage: "2"
needs: [stage-1]

stage-2-optional-0-o:
uses: ./.github/workflows/macos.yml
with:
stage: "2-optional-0-o"
needs: [stage-2]

stage-2-optional-p-z:
uses: ./.github/workflows/macos.yml
with:
stage: "2-optional-p-z"
needs: [stage-2-optional-0-o]

stage-2-experimental-0-o:
uses: ./.github/workflows/macos.yml
with:
stage: "2-optional-0-o"
needs: [stage-2-optional-p-z]

stage-2-experimental-p-z:
uses: ./.github/workflows/macos.yml
with:
stage: "2-experimental-p-z"
needs: [stage-2-experimental-0-o]

dist:

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/doc-build-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}

- name: Prepare
run: |
apt-get update && apt-get install -y zip
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,30 @@ concurrency:
cancel-in-progress: true

jobs:
get_ci_fixes:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Store CI fixes in upstream artifact
run: |
mkdir -p upstream
git format-patch --stdout test_base > upstream/ci_fixes.patch
- uses: actions/upload-artifact@v2
with:
path: upstream
name: upstream

build-docs:
runs-on: ubuntu-latest
container: ghcr.io/sagemath/sage/sage-ubuntu-focal-standard-with-targets:dev
needs: [get_ci_fixes]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -54,6 +75,21 @@ jobs:
# Keep track of changes to built HTML
new_version=$(cat src/VERSION.txt); (cd /sage/local/share/doc/sage/html/en && find . -name "*.html" | xargs sed -i '/class="sidebar-brand-text"/s/Sage [0-9a-z.]* /Sage '$new_version' /'; git init && (echo "*.svg binary"; echo "*.pdf binary") >> .gitattributes && (echo ".buildinfo"; echo '*.inv'; echo '.git*'; echo '*.svg'; echo '*.pdf'; echo '*.png'; echo 'searchindex.js') > .gitignore; git add -A && git commit --quiet -m "old")

- name: Download upstream artifact
uses: actions/download-artifact@v3
with:
path: upstream
name: upstream

- name: Apply CI fixes from sagemath/sage
# After applying the fixes, make sure all changes are marked as uncommitted changes.
run: |
if [ -r upstream/ci_fixes.patch ]; then
(cd worktree-image && git commit -m "current changes" --allow-empty -a && git am) < upstream/ci_fixes.patch
git reset --quiet old
git add -N .
fi

- name: Incremental build
id: incremental
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ jobs:
(export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && sed -i.bak '/upstream/d' .dockerignore && echo "/:toolchain:/i ADD upstream upstream" | sed -i.bak -f - build/bin/write-dockerfile.sh && git diff)
if: inputs.upstream_artifact

- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}

- name: Try to login to ghcr.io
if: inputs.docker_push_repository != ''
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -28,6 +33,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -42,6 +52,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Merge CI fixes from sagemath/sage
run: |
.ci/merge-fixes.sh
env:
GH_TOKEN: ${{ github.token }}
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
Loading
Loading