From 88f0dd45e7c34aa21edda37e4f21b7a62569cf9b Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 10:34:30 -0600 Subject: [PATCH 01/14] Retry gc colelction (fix intermittent pypy failure) --- pyomo/common/tests/test_tee.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pyomo/common/tests/test_tee.py b/pyomo/common/tests/test_tee.py index 0da06f497f6..2fe13ceac88 100644 --- a/pyomo/common/tests/test_tee.py +++ b/pyomo/common/tests/test_tee.py @@ -578,7 +578,18 @@ def test_exit_on_del(self): stack = T.context_stack self.assertGreater(len(stack), 0) del T - gc.collect() + # This is a bit tricky: for cpython, T should be immediately + # deallocated (including calling __del__) through reference + # counting. pypy is trickier: because it lacks + # reference-counting, it must rely on the GC. We have seen + # cases on GHA where a single call to gc.collect() was sometimes + # insufficient to ensure that T was collected (but unable to + # reproduce it locally). We will try up to 4 times (1 more than + # the number of generations in the GC) + remaining_attempts = 1 + while len(stack) and remaining_attempts: + gc.collect() + remaining_attempts -= 1 self.assertEqual(len(stack), 0) def test_deadlock(self): From df806dfd157d46552b242254a1144807fb614307 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 10:35:40 -0600 Subject: [PATCH 02/14] Update codecov-action version, remove unnecesary step --- .github/workflows/test_branches.yml | 24 ++---------------------- .github/workflows/test_pr_and_main.yml | 24 ++---------------------- 2 files changed, 4 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index f48d7c8e52b..3c40ccfcdf6 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -876,26 +876,6 @@ jobs: $PYTHON_EXE -c "from pyomo.dataportal.parse_datacmds import \ parse_data_commands; parse_data_commands(data='')" - - name: Update codecov uploader - run: | - set +e - CODECOV="${GITHUB_WORKSPACE}/codecov.sh" - echo "CODECOV=$CODECOV" >> $GITHUB_ENV - for i in `seq 3`; do - echo "Downloading current codecov script (attempt ${i})" - curl -L https://codecov.io/bash -o $CODECOV - if test $? == 0; then - break - fi - DELAY=$(( RANDOM % 30 + 30)) - echo "Pausing $DELAY seconds before re-attempting download" - sleep $DELAY - done - if test ! -e $CODECOV; then - echo "Failed to download codecov.sh" - exit 1 - fi - - name: Combine coverage reports if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main' run: | @@ -934,7 +914,7 @@ jobs: - name: Upload codecov reports if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main' - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: files: coverage.xml token: ${{ secrets.PYOMO_CODECOV_TOKEN }} @@ -946,7 +926,7 @@ jobs: if: | hashFiles('coverage-other.xml') != '' && (github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main') - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: files: coverage-other.xml token: ${{ secrets.PYOMO_CODECOV_TOKEN }} diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index 85e9b182258..7924649c5f3 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -914,26 +914,6 @@ jobs: $PYTHON_EXE -c "from pyomo.dataportal.parse_datacmds import \ parse_data_commands; parse_data_commands(data='')" - - name: Update codecov uploader - run: | - set +e - CODECOV="${GITHUB_WORKSPACE}/codecov.sh" - echo "CODECOV=$CODECOV" >> $GITHUB_ENV - for i in `seq 3`; do - echo "Downloading current codecov script (attempt ${i})" - curl -L https://codecov.io/bash -o $CODECOV - if test $? == 0; then - break - fi - DELAY=$(( RANDOM % 30 + 30)) - echo "Pausing $DELAY seconds before re-attempting download" - sleep $DELAY - done - if test ! -e $CODECOV; then - echo "Failed to download codecov.sh" - exit 1 - fi - - name: Combine coverage reports if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main' run: | @@ -972,7 +952,7 @@ jobs: - name: Upload codecov reports if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main' - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: files: coverage.xml token: ${{ secrets.PYOMO_CODECOV_TOKEN }} @@ -984,7 +964,7 @@ jobs: if: | hashFiles('coverage-other.xml') != '' && (github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main') - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: files: coverage-other.xml token: ${{ secrets.PYOMO_CODECOV_TOKEN }} From 1d2b57da925d513e78d72eb529e7ec1189a09b3d Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 10:36:14 -0600 Subject: [PATCH 03/14] Update codecov config - adjust red/yellow/green ranges - allow codecov to begin reporting without waiting for CI completion --- .codecov.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 932cd7bd7f8..3395aa4b358 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,15 +1,18 @@ codecov: notify: # GHA: 5, Jenkins: 11 - # Accurate as of July 3, 2024 - # Potential to change when Python versions change - after_n_builds: 16 - wait_for_ci: true + # Accurate as of April 1, 2025 + # Potential to change when Python versions change. We will allow + # codecov to start reporting when 80% of the reports are in. This + # will hopefully help avoid an issue where codecov is not tracking + # PR branches (see https://github.com/codecov/feedback/issues/692). + after_n_builds: 13 + wait_for_ci: false require_ci_to_pass: false +comment: + after_n_builds: 13 coverage: - range: - - 50.0 - - 100.0 + range: 70..98 status: patch: default: From 0357523abe086149fd9ba63b7efaf04f3e39c6c5 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 11:12:34 -0600 Subject: [PATCH 04/14] Add PYOMO_WORKFLOW env var, reduce diffs between workflows --- .github/workflows/test_branches.yml | 8 ++++++- .github/workflows/test_pr_and_main.yml | 29 +++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index 3c40ccfcdf6..9be2d41ad59 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -26,11 +26,13 @@ env: CACHE_VER: v221013.1 NEOS_EMAIL: tests@pyomo.org SRC_REF: ${{ github.head_ref || github.ref }} + PYOMO_WORKFLOW: branch jobs: lint: name: lint/style-and-typos runs-on: ubuntu-latest + if: env.PYOMO_WORKFLOW != 'draft_pr' steps: - name: Checkout Pyomo source uses: actions/checkout@v4 @@ -48,6 +50,7 @@ jobs: with: config: ./.github/workflows/typos.toml - name: URL Checker + if: env.PYOMO_WORKFLOW == 'branch' uses: urlstechie/urlchecker-action@0.0.34 with: # A comma-separated list of file types to cover in the URL checks @@ -65,6 +68,7 @@ jobs: build: name: ${{ matrix.TARGET }}/${{ matrix.python }}${{ matrix.other }} + needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} runs-on: ${{ matrix.os }} timeout-minutes: 120 strategy: @@ -764,6 +768,7 @@ jobs: bare-python-env: name: linux/3.9/bare-env + needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -805,7 +810,8 @@ jobs: cover: name: process-coverage-${{ matrix.TARGET }} needs: build - if: ${{ false }} # turn off for branches + # run even if a build job fails, but not if cancelled (except for branches) + if: env.PYOMO_WORKFLOW != 'branch' && (success() || failure()) runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index 7924649c5f3..5e4b92e0ea3 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -34,13 +34,16 @@ env: CACHE_VER: v221013.1 NEOS_EMAIL: tests@pyomo.org SRC_REF: ${{ github.head_ref || github.ref }} + PYOMO_WORKFLOW: | + ${{ ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) && 'draft_pr' + || github.event.pull_request.number && 'pr' || 'main' }} jobs: lint: name: lint/style-and-typos runs-on: ubuntu-latest - if: | - contains(github.event.pull_request.title, '[WIP]') != true && !github.event.pull_request.draft + if: env.PYOMO_WORKFLOW != 'draft_pr' steps: - name: Checkout Pyomo source uses: actions/checkout@v4 @@ -57,11 +60,26 @@ jobs: uses: crate-ci/typos@master with: config: ./.github/workflows/typos.toml + - name: URL Checker + if: env.PYOMO_WORKFLOW == 'branch' + uses: urlstechie/urlchecker-action@0.0.34 + with: + # A comma-separated list of file types to cover in the URL checks + file_types: .md,.rst,.py + # Choose whether to include file with no URLs in the prints. + print_all: false + # More verbose summary at the end of a run + verbose: true + # How many times to retry a failed request (defaults to 1) + retry_count: 3 + # Exclude Jenkins because it's behind a firewall; ignore RTD because + # a magically-generated string is triggering a failure + exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html build: name: ${{ matrix.TARGET }}/${{ matrix.python }}${{ matrix.other }} - needs: lint # the linter job is a prerequisite for PRs + needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} runs-on: ${{ matrix.os }} timeout-minutes: 120 strategy: @@ -801,7 +819,7 @@ jobs: bare-python-env: name: linux/3.9/bare-env - needs: lint # the linter job is a prerequisite for PRs + needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -843,7 +861,8 @@ jobs: cover: name: process-coverage-${{ matrix.TARGET }} needs: build - if: success() || failure() # run even if a build job fails, but not if cancelled + # run even if a build job fails, but not if cancelled (except for branches) + if: env.PYOMO_WORKFLOW != 'branch' && (success() || failure()) runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: From e6f61d8181877ee9dedc6071584da6d15017e85b Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 11:37:39 -0600 Subject: [PATCH 05/14] GHA doesn't support conditions in 'needs:' --- .github/workflows/test_branches.yml | 4 ++-- .github/workflows/test_pr_and_main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index 9be2d41ad59..ad3682f4eb6 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -68,7 +68,7 @@ jobs: build: name: ${{ matrix.TARGET }}/${{ matrix.python }}${{ matrix.other }} - needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} + needs: # Note: GHA does not support conditional dependencies runs-on: ${{ matrix.os }} timeout-minutes: 120 strategy: @@ -768,7 +768,7 @@ jobs: bare-python-env: name: linux/3.9/bare-env - needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} + needs: # Note: GHA does not support conditional dependencies runs-on: ubuntu-latest timeout-minutes: 10 steps: diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index 5e4b92e0ea3..8476597d27d 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -79,7 +79,7 @@ jobs: build: name: ${{ matrix.TARGET }}/${{ matrix.python }}${{ matrix.other }} - needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} + needs: lint # the linter job is a prerequisite for PRs runs-on: ${{ matrix.os }} timeout-minutes: 120 strategy: @@ -819,7 +819,7 @@ jobs: bare-python-env: name: linux/3.9/bare-env - needs: ${{ endsWith( env.PYOMO_WORKFLOW, 'pr') && 'lint' || '' }} + needs: lint # the linter job is a prerequisite for PRs runs-on: ubuntu-latest timeout-minutes: 10 steps: From 053503b4591200ff68622d930dece58c36a36b71 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 11:38:28 -0600 Subject: [PATCH 06/14] GHA doesn't support empty 'needs:' --- .github/workflows/test_branches.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index ad3682f4eb6..33f1ab26379 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -68,7 +68,6 @@ jobs: build: name: ${{ matrix.TARGET }}/${{ matrix.python }}${{ matrix.other }} - needs: # Note: GHA does not support conditional dependencies runs-on: ${{ matrix.os }} timeout-minutes: 120 strategy: @@ -768,7 +767,6 @@ jobs: bare-python-env: name: linux/3.9/bare-env - needs: # Note: GHA does not support conditional dependencies runs-on: ubuntu-latest timeout-minutes: 10 steps: From 3f0ea8b285428e4bd02fb85aad7f43d75c81a586 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:02:36 -0600 Subject: [PATCH 07/14] Switch from env to input for subworkflow flag --- .github/workflows/test_branches.yml | 21 +++++++++++++++++---- .github/workflows/test_pr_and_main.yml | 19 ++++++++++++------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index 33f1ab26379..b05c24885eb 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -10,6 +10,19 @@ on: description: Git Hash (Optional) required: false +inputs: + subworkflow: + description: Configure the sub-workflow to execute + required: false + default: branch + subworkflow_test: + description: Configure the sub-workflow to execute + required: false + default: | + ${{ ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) && 'draft_pr' + || github.event.pull_request.number && 'pr' || 'main' }} + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -26,13 +39,13 @@ env: CACHE_VER: v221013.1 NEOS_EMAIL: tests@pyomo.org SRC_REF: ${{ github.head_ref || github.ref }} - PYOMO_WORKFLOW: branch + PYOMO_WORKFLOW: ${{ inputs.subworkflow }} jobs: lint: name: lint/style-and-typos + if: inputs.subworkflow != 'draft_pr' runs-on: ubuntu-latest - if: env.PYOMO_WORKFLOW != 'draft_pr' steps: - name: Checkout Pyomo source uses: actions/checkout@v4 @@ -50,7 +63,7 @@ jobs: with: config: ./.github/workflows/typos.toml - name: URL Checker - if: env.PYOMO_WORKFLOW == 'branch' + if: inputs.subworkflow == 'branch' uses: urlstechie/urlchecker-action@0.0.34 with: # A comma-separated list of file types to cover in the URL checks @@ -809,7 +822,7 @@ jobs: name: process-coverage-${{ matrix.TARGET }} needs: build # run even if a build job fails, but not if cancelled (except for branches) - if: env.PYOMO_WORKFLOW != 'branch' && (success() || failure()) + if: inputs.subworkflow != 'branch' && (success() || failure()) runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index 8476597d27d..da7571f0288 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -18,6 +18,15 @@ on: description: Git Hash (Optional) required: false +inputs: + subworkflow: + description: Configure the sub-workflow to execute + required: false + default: | + ${{ ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) && 'draft_pr' + || github.event.pull_request.number && 'pr' || 'main' }} + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -34,16 +43,12 @@ env: CACHE_VER: v221013.1 NEOS_EMAIL: tests@pyomo.org SRC_REF: ${{ github.head_ref || github.ref }} - PYOMO_WORKFLOW: | - ${{ ( contains(github.event.pull_request.title, '[WIP]') || - github.event.pull_request.draft ) && 'draft_pr' - || github.event.pull_request.number && 'pr' || 'main' }} jobs: lint: name: lint/style-and-typos + if: inputs.subworkflow != 'draft_pr' runs-on: ubuntu-latest - if: env.PYOMO_WORKFLOW != 'draft_pr' steps: - name: Checkout Pyomo source uses: actions/checkout@v4 @@ -61,7 +66,7 @@ jobs: with: config: ./.github/workflows/typos.toml - name: URL Checker - if: env.PYOMO_WORKFLOW == 'branch' + if: inputs.subworkflow == 'branch' uses: urlstechie/urlchecker-action@0.0.34 with: # A comma-separated list of file types to cover in the URL checks @@ -862,7 +867,7 @@ jobs: name: process-coverage-${{ matrix.TARGET }} needs: build # run even if a build job fails, but not if cancelled (except for branches) - if: env.PYOMO_WORKFLOW != 'branch' && (success() || failure()) + if: inputs.subworkflow != 'branch' && (success() || failure()) runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: From 4f5a5556ad643280fbd7f09f14456dfdfcdc96e6 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:08:10 -0600 Subject: [PATCH 08/14] Move inputs definition --- .github/workflows/test_branches.yml | 24 +++++++++++------------- .github/workflows/test_pr_and_main.yml | 16 +++++++--------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index b05c24885eb..9079d0005aa 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -9,19 +9,17 @@ on: git-ref: description: Git Hash (Optional) required: false - -inputs: - subworkflow: - description: Configure the sub-workflow to execute - required: false - default: branch - subworkflow_test: - description: Configure the sub-workflow to execute - required: false - default: | - ${{ ( contains(github.event.pull_request.title, '[WIP]') || - github.event.pull_request.draft ) && 'draft_pr' - || github.event.pull_request.number && 'pr' || 'main' }} + subworkflow: + description: Configure the sub-workflow to execute + required: false + default: branch + subworkflow_test: + description: Configure the sub-workflow to execute + required: false + default: | + ${{ ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) && 'draft_pr' + || github.event.pull_request.number && 'pr' || 'main' }} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index da7571f0288..ee715ddb55a 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -17,15 +17,13 @@ on: git-ref: description: Git Hash (Optional) required: false - -inputs: - subworkflow: - description: Configure the sub-workflow to execute - required: false - default: | - ${{ ( contains(github.event.pull_request.title, '[WIP]') || - github.event.pull_request.draft ) && 'draft_pr' - || github.event.pull_request.number && 'pr' || 'main' }} + subworkflow: + description: Configure the sub-workflow to execute + required: false + default: | + ${{ ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) && 'draft_pr' + || github.event.pull_request.number && 'pr' || 'main' }} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} From d4c28991a8550065544f7a841e3a8b12bb3a7c8b Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:13:42 -0600 Subject: [PATCH 09/14] Debugging --- .github/workflows/test_branches.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index 9079d0005aa..8646c864e0d 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -9,6 +9,8 @@ on: git-ref: description: Git Hash (Optional) required: false + workflow_call: + inputs: subworkflow: description: Configure the sub-workflow to execute required: false From 522ea50a0a0a488e0622228b16237246bb7adae4 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:16:06 -0600 Subject: [PATCH 10/14] Add missing type --- .github/workflows/test_branches.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index 8646c864e0d..b5361d93082 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -18,6 +18,7 @@ on: subworkflow_test: description: Configure the sub-workflow to execute required: false + type: string default: | ${{ ( contains(github.event.pull_request.title, '[WIP]') || github.event.pull_request.draft ) && 'draft_pr' From 418955a6ff32cc3ee65865ae7a370d32793b4b36 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:16:36 -0600 Subject: [PATCH 11/14] Add missing type --- .github/workflows/test_branches.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index b5361d93082..00ecb076354 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -14,6 +14,7 @@ on: subworkflow: description: Configure the sub-workflow to execute required: false + type: string default: branch subworkflow_test: description: Configure the sub-workflow to execute From 19f98d0870ecbed843f092f88b47e03c664d3a75 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:41:47 -0600 Subject: [PATCH 12/14] Revert to env.PYOMO_WORKFLOW, hardcode job-level if --- .github/workflows/test_branches.yml | 25 ++++++------------------- .github/workflows/test_pr_and_main.yml | 19 +++++++++---------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index 00ecb076354..b721ba2a644 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -9,21 +9,6 @@ on: git-ref: description: Git Hash (Optional) required: false - workflow_call: - inputs: - subworkflow: - description: Configure the sub-workflow to execute - required: false - type: string - default: branch - subworkflow_test: - description: Configure the sub-workflow to execute - required: false - type: string - default: | - ${{ ( contains(github.event.pull_request.title, '[WIP]') || - github.event.pull_request.draft ) && 'draft_pr' - || github.event.pull_request.number && 'pr' || 'main' }} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -41,12 +26,14 @@ env: CACHE_VER: v221013.1 NEOS_EMAIL: tests@pyomo.org SRC_REF: ${{ github.head_ref || github.ref }} - PYOMO_WORKFLOW: ${{ inputs.subworkflow }} + PYOMO_WORKFLOW: branch jobs: lint: name: lint/style-and-typos - if: inputs.subworkflow != 'draft_pr' + if: | + ${{ ! ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) }} runs-on: ubuntu-latest steps: - name: Checkout Pyomo source @@ -65,7 +52,7 @@ jobs: with: config: ./.github/workflows/typos.toml - name: URL Checker - if: inputs.subworkflow == 'branch' + if: env.PYOMO_WORKFLOW == 'branch' uses: urlstechie/urlchecker-action@0.0.34 with: # A comma-separated list of file types to cover in the URL checks @@ -824,7 +811,7 @@ jobs: name: process-coverage-${{ matrix.TARGET }} needs: build # run even if a build job fails, but not if cancelled (except for branches) - if: inputs.subworkflow != 'branch' && (success() || failure()) + if: ${{ false }} runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index ee715ddb55a..1cdbfb85162 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -17,13 +17,6 @@ on: git-ref: description: Git Hash (Optional) required: false - subworkflow: - description: Configure the sub-workflow to execute - required: false - default: | - ${{ ( contains(github.event.pull_request.title, '[WIP]') || - github.event.pull_request.draft ) && 'draft_pr' - || github.event.pull_request.number && 'pr' || 'main' }} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -41,11 +34,17 @@ env: CACHE_VER: v221013.1 NEOS_EMAIL: tests@pyomo.org SRC_REF: ${{ github.head_ref || github.ref }} + PYOMO_WORKFLOW: | + ${{ ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) && 'draft_pr' + || github.event.pull_request.number && 'pr' || 'main' }} jobs: lint: name: lint/style-and-typos - if: inputs.subworkflow != 'draft_pr' + if: | + ${{ ! ( contains(github.event.pull_request.title, '[WIP]') || + github.event.pull_request.draft ) }} runs-on: ubuntu-latest steps: - name: Checkout Pyomo source @@ -64,7 +63,7 @@ jobs: with: config: ./.github/workflows/typos.toml - name: URL Checker - if: inputs.subworkflow == 'branch' + if: env.PYOMO_WORKFLOW == 'branch' uses: urlstechie/urlchecker-action@0.0.34 with: # A comma-separated list of file types to cover in the URL checks @@ -865,7 +864,7 @@ jobs: name: process-coverage-${{ matrix.TARGET }} needs: build # run even if a build job fails, but not if cancelled (except for branches) - if: inputs.subworkflow != 'branch' && (success() || failure()) + if: success() || failure() runs-on: ${{ matrix.os }} timeout-minutes: 10 strategy: From 734f97d8f457f5ec72b1668c700905aa787e1aa2 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:48:45 -0600 Subject: [PATCH 13/14] NFC: fix typo --- .github/workflows/test_branches.yml | 2 +- .github/workflows/test_pr_and_main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_branches.yml b/.github/workflows/test_branches.yml index b721ba2a644..d2e70f18a76 100644 --- a/.github/workflows/test_branches.yml +++ b/.github/workflows/test_branches.yml @@ -810,7 +810,7 @@ jobs: cover: name: process-coverage-${{ matrix.TARGET }} needs: build - # run even if a build job fails, but not if cancelled (except for branches) + # run even if a build job fails, but not if canceled (except for branches) if: ${{ false }} runs-on: ${{ matrix.os }} timeout-minutes: 10 diff --git a/.github/workflows/test_pr_and_main.yml b/.github/workflows/test_pr_and_main.yml index 1cdbfb85162..170aa821de3 100644 --- a/.github/workflows/test_pr_and_main.yml +++ b/.github/workflows/test_pr_and_main.yml @@ -863,7 +863,7 @@ jobs: cover: name: process-coverage-${{ matrix.TARGET }} needs: build - # run even if a build job fails, but not if cancelled (except for branches) + # run even if a build job fails, but not if canceled (except for branches) if: success() || failure() runs-on: ${{ matrix.os }} timeout-minutes: 10 From 792e114f47d0557151e88abf7dbdf94c4bc111a2 Mon Sep 17 00:00:00 2001 From: John Siirola Date: Tue, 1 Apr 2025 13:49:02 -0600 Subject: [PATCH 14/14] Increase test attempts --- pyomo/common/tests/test_tee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyomo/common/tests/test_tee.py b/pyomo/common/tests/test_tee.py index 2fe13ceac88..42175eb93f5 100644 --- a/pyomo/common/tests/test_tee.py +++ b/pyomo/common/tests/test_tee.py @@ -586,7 +586,7 @@ def test_exit_on_del(self): # insufficient to ensure that T was collected (but unable to # reproduce it locally). We will try up to 4 times (1 more than # the number of generations in the GC) - remaining_attempts = 1 + remaining_attempts = 4 while len(stack) and remaining_attempts: gc.collect() remaining_attempts -= 1