From 92bc9948fedcd4d615f367b706a786e7cbe98c6a Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Fri, 14 Feb 2025 20:44:20 +0700 Subject: [PATCH 1/7] Reformat meson.build file to satisfy update-meson --- src/sage/data_structures/meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sage/data_structures/meson.build b/src/sage/data_structures/meson.build index 8c100328378..3cc243fe62a 100644 --- a/src/sage/data_structures/meson.build +++ b/src/sage/data_structures/meson.build @@ -42,9 +42,7 @@ foreach name, pyx : extension_data ) endforeach -extension_data_cpp = { - 'pairing_heap' : files('pairing_heap.pyx'), -} +extension_data_cpp = {'pairing_heap' : files('pairing_heap.pyx')} foreach name, pyx : extension_data_cpp py.extension_module( From 82a439a9ec694c19022808a67cf47732a4a5379a Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Fri, 14 Feb 2025 20:51:49 +0700 Subject: [PATCH 2/7] Test on CI that update-meson is properly ran --- .github/workflows/ci-meson.yml | 25 +++++++++++++++++++++++++ .gitignore | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/.github/workflows/ci-meson.yml b/.github/workflows/ci-meson.yml index ab073aae87c..13ae8d9dc92 100644 --- a/.github/workflows/ci-meson.yml +++ b/.github/workflows/ci-meson.yml @@ -72,6 +72,23 @@ jobs: # Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda pip install --no-build-isolation --no-deps --config-settings=builddir=builddir . -v + - name: Check update-meson + # this step must be after build, because meson.build creates a number of __init__.py files + # that is needed to make tools/update-meson.py run correctly + shell: bash -l {0} + id: check_update_meson + run: | + python3 tools/update-meson.py + make test-git-no-uncommitted-changes + continue-on-error: true + + - name: Show files changed by update-meson + if: ${{ steps.check_update_meson.outcome == 'failure' }} + shell: bash -l {0} + run: | + git status + git diff + - name: Verify dependencies shell: bash -l {0} run: pip check @@ -83,6 +100,14 @@ jobs: rm -R ./src/sage_setup/ ./sage -t --all -p4 + - name: Report update-meson failure + if: ${{ steps.check_update_meson.outcome == 'failure' }} + shell: bash -l {0} + run: | + # Please see step 'Show files changed by update-meson' above and apply the changes, + # or run tools/update-meson.py locally + false + - name: Upload log uses: actions/upload-artifact@v4.5.0 if: failure() diff --git a/.gitignore b/.gitignore index b8bfc364a26..c0a86090cad 100644 --- a/.gitignore +++ b/.gitignore @@ -467,3 +467,8 @@ src/sage/libs/mpfr/__init__.py src/sage/libs/mpc/__init__.py src/sage/calculus/transforms/__init__.py src/sage/calculus/__init__.py + +# Temporary files generated by Meson CI (needed to make test pass because +# ci-meson.yml runs a `make test-git-no-uncommitted-changes` step) +/.ccache +/setup-miniconda-patched-environment-*.yml From b7ae258f69610e6373bdbbd7341e16964d8e1c79 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 17 Feb 2025 15:56:51 +0700 Subject: [PATCH 3/7] Refactor test-git-no-uncommitted-changes to independent script --- .github/workflows/ci-meson.yml | 2 +- Makefile | 8 +------- tools/test-git-no-uncommitted-changes | 10 ++++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100755 tools/test-git-no-uncommitted-changes diff --git a/.github/workflows/ci-meson.yml b/.github/workflows/ci-meson.yml index 13ae8d9dc92..edac659b006 100644 --- a/.github/workflows/ci-meson.yml +++ b/.github/workflows/ci-meson.yml @@ -79,7 +79,7 @@ jobs: id: check_update_meson run: | python3 tools/update-meson.py - make test-git-no-uncommitted-changes + ./tools/test-git-no-uncommitted-changes continue-on-error: true - name: Show files changed by update-meson diff --git a/Makefile b/Makefile index 15dbbb411c0..4b5e9350d3e 100644 --- a/Makefile +++ b/Makefile @@ -254,13 +254,7 @@ TEST_TARGET = $@ TEST = ./sage -t --logfile=$(TEST_LOG) $(TEST_FLAGS) --optional=$(TEST_OPTIONAL) $(TEST_FILES) test-git-no-uncommitted-changes: - @UNCOMMITTED=$$(git status --porcelain); \ - if [ -n "$$UNCOMMITTED" ]; then \ - echo "Error: the git repo has uncommitted changes:"; \ - echo "$$UNCOMMITTED"; \ - echo; \ - exit 1; \ - fi + ./tools/test-git-no-uncommitted-changes test: all @echo '### make $(TEST_TARGET): Running $(TEST)' >> $(TEST_LOG) diff --git a/tools/test-git-no-uncommitted-changes b/tools/test-git-no-uncommitted-changes new file mode 100755 index 00000000000..f79997062f5 --- /dev/null +++ b/tools/test-git-no-uncommitted-changes @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +# Test that there is no uncommitted changes in the repository. Return failure if there is. +# Can also be invoked with `make test-git-no-uncommitted-changes` from top level. +UNCOMMITTED="$(git status --porcelain)"; +if [ -n "$UNCOMMITTED" ]; then + echo "Error: the git repo has uncommitted changes:"; + echo "$UNCOMMITTED"; + echo; + exit 1; +fi From 44e75720cd63667e1924d8752eceadbc3862e186 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 17 Feb 2025 15:57:05 +0700 Subject: [PATCH 4/7] Show newly created files in git diff, if any --- .github/workflows/ci-meson.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-meson.yml b/.github/workflows/ci-meson.yml index edac659b006..eb8784fb650 100644 --- a/.github/workflows/ci-meson.yml +++ b/.github/workflows/ci-meson.yml @@ -86,6 +86,7 @@ jobs: if: ${{ steps.check_update_meson.outcome == 'failure' }} shell: bash -l {0} run: | + git add --intent-to-add . # also show newly created files in git diff git status git diff From c3705802e4af59ef280bd973b593fcb2fe922f79 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 17 Feb 2025 15:59:16 +0700 Subject: [PATCH 5/7] Merge two report steps --- .github/workflows/ci-meson.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-meson.yml b/.github/workflows/ci-meson.yml index eb8784fb650..228767fc32e 100644 --- a/.github/workflows/ci-meson.yml +++ b/.github/workflows/ci-meson.yml @@ -82,14 +82,6 @@ jobs: ./tools/test-git-no-uncommitted-changes continue-on-error: true - - name: Show files changed by update-meson - if: ${{ steps.check_update_meson.outcome == 'failure' }} - shell: bash -l {0} - run: | - git add --intent-to-add . # also show newly created files in git diff - git status - git diff - - name: Verify dependencies shell: bash -l {0} run: pip check @@ -101,12 +93,14 @@ jobs: rm -R ./src/sage_setup/ ./sage -t --all -p4 - - name: Report update-meson failure + - name: Show files changed by update-meson if: ${{ steps.check_update_meson.outcome == 'failure' }} shell: bash -l {0} + # must be after "Test" since we still want to run test when check_update_meson fails run: | - # Please see step 'Show files changed by update-meson' above and apply the changes, - # or run tools/update-meson.py locally + git add --intent-to-add . # also show newly created files in git diff + git status + git diff false - name: Upload log From d796a29cf8503ddaef7c219d42ef41fee6b0260e Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Wed, 19 Feb 2025 23:29:31 +0700 Subject: [PATCH 6/7] Disable running test step when update-meson check fails --- .github/workflows/ci-meson.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-meson.yml b/.github/workflows/ci-meson.yml index 228767fc32e..3c433e130af 100644 --- a/.github/workflows/ci-meson.yml +++ b/.github/workflows/ci-meson.yml @@ -76,11 +76,14 @@ jobs: # this step must be after build, because meson.build creates a number of __init__.py files # that is needed to make tools/update-meson.py run correctly shell: bash -l {0} - id: check_update_meson run: | python3 tools/update-meson.py - ./tools/test-git-no-uncommitted-changes - continue-on-error: true + if ! ./tools/test-git-no-uncommitted-changes; then + git add --intent-to-add . # also show newly created files in git diff + git status + git diff + false + fi - name: Verify dependencies shell: bash -l {0} @@ -93,16 +96,6 @@ jobs: rm -R ./src/sage_setup/ ./sage -t --all -p4 - - name: Show files changed by update-meson - if: ${{ steps.check_update_meson.outcome == 'failure' }} - shell: bash -l {0} - # must be after "Test" since we still want to run test when check_update_meson fails - run: | - git add --intent-to-add . # also show newly created files in git diff - git status - git diff - false - - name: Upload log uses: actions/upload-artifact@v4.5.0 if: failure() From 6bf8c80c19d9777bf3fdc2cec512d57c7dbfad67 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Wed, 19 Feb 2025 23:58:08 +0700 Subject: [PATCH 7/7] Update an outdated comment --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c0a86090cad..9190feb4b13 100644 --- a/.gitignore +++ b/.gitignore @@ -469,6 +469,6 @@ src/sage/calculus/transforms/__init__.py src/sage/calculus/__init__.py # Temporary files generated by Meson CI (needed to make test pass because -# ci-meson.yml runs a `make test-git-no-uncommitted-changes` step) +# ci-meson.yml runs a `./tools/test-git-no-uncommitted-changes` step) /.ccache /setup-miniconda-patched-environment-*.yml