Skip to content

Commit 015a010

Browse files
authored
Merge branch 'main' into ldsda_documentation
2 parents 4cc31df + fa15cc7 commit 015a010

File tree

4 files changed

+57
-56
lines changed

4 files changed

+57
-56
lines changed

.codecov.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
codecov:
22
notify:
33
# GHA: 5, Jenkins: 11
4-
# Accurate as of July 3, 2024
5-
# Potential to change when Python versions change
6-
after_n_builds: 16
7-
wait_for_ci: true
4+
# Accurate as of April 1, 2025
5+
# Potential to change when Python versions change. We will allow
6+
# codecov to start reporting when 80% of the reports are in. This
7+
# will hopefully help avoid an issue where codecov is not tracking
8+
# PR branches (see https://github.com/codecov/feedback/issues/692).
9+
after_n_builds: 13
10+
wait_for_ci: false
811
require_ci_to_pass: false
12+
comment:
13+
after_n_builds: 13
914
coverage:
10-
range:
11-
- 50.0
12-
- 100.0
15+
range: 70..98
1316
status:
1417
patch:
1518
default:

.github/workflows/test_branches.yml

+9-23
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ env:
2626
CACHE_VER: v221013.1
2727
NEOS_EMAIL: [email protected]
2828
SRC_REF: ${{ github.head_ref || github.ref }}
29+
PYOMO_WORKFLOW: branch
2930

3031
jobs:
3132
lint:
3233
name: lint/style-and-typos
34+
if: |
35+
${{ ! ( contains(github.event.pull_request.title, '[WIP]') ||
36+
github.event.pull_request.draft ) }}
3337
runs-on: ubuntu-latest
3438
steps:
3539
- name: Checkout Pyomo source
@@ -48,6 +52,7 @@ jobs:
4852
with:
4953
config: ./.github/workflows/typos.toml
5054
- name: URL Checker
55+
if: env.PYOMO_WORKFLOW == 'branch'
5156
uses: urlstechie/[email protected]
5257
with:
5358
# A comma-separated list of file types to cover in the URL checks
@@ -805,7 +810,8 @@ jobs:
805810
cover:
806811
name: process-coverage-${{ matrix.TARGET }}
807812
needs: build
808-
if: ${{ false }} # turn off for branches
813+
# run even if a build job fails, but not if canceled (except for branches)
814+
if: ${{ false }}
809815
runs-on: ${{ matrix.os }}
810816
timeout-minutes: 10
811817
strategy:
@@ -876,26 +882,6 @@ jobs:
876882
$PYTHON_EXE -c "from pyomo.dataportal.parse_datacmds import \
877883
parse_data_commands; parse_data_commands(data='')"
878884
879-
- name: Update codecov uploader
880-
run: |
881-
set +e
882-
CODECOV="${GITHUB_WORKSPACE}/codecov.sh"
883-
echo "CODECOV=$CODECOV" >> $GITHUB_ENV
884-
for i in `seq 3`; do
885-
echo "Downloading current codecov script (attempt ${i})"
886-
curl -L https://codecov.io/bash -o $CODECOV
887-
if test $? == 0; then
888-
break
889-
fi
890-
DELAY=$(( RANDOM % 30 + 30))
891-
echo "Pausing $DELAY seconds before re-attempting download"
892-
sleep $DELAY
893-
done
894-
if test ! -e $CODECOV; then
895-
echo "Failed to download codecov.sh"
896-
exit 1
897-
fi
898-
899885
- name: Combine coverage reports
900886
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
901887
run: |
@@ -934,7 +920,7 @@ jobs:
934920
935921
- name: Upload codecov reports
936922
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
937-
uses: codecov/codecov-action@v4
923+
uses: codecov/codecov-action@v5
938924
with:
939925
files: coverage.xml
940926
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}
@@ -946,7 +932,7 @@ jobs:
946932
if: |
947933
hashFiles('coverage-other.xml') != '' &&
948934
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
949-
uses: codecov/codecov-action@v4
935+
uses: codecov/codecov-action@v5
950936
with:
951937
files: coverage-other.xml
952938
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}

.github/workflows/test_pr_and_main.yml

+26-25
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,18 @@ env:
3434
CACHE_VER: v221013.1
3535
NEOS_EMAIL: [email protected]
3636
SRC_REF: ${{ github.head_ref || github.ref }}
37+
PYOMO_WORKFLOW: |
38+
${{ ( contains(github.event.pull_request.title, '[WIP]') ||
39+
github.event.pull_request.draft ) && 'draft_pr'
40+
|| github.event.pull_request.number && 'pr' || 'main' }}
3741
3842
jobs:
3943
lint:
4044
name: lint/style-and-typos
41-
runs-on: ubuntu-latest
4245
if: |
43-
contains(github.event.pull_request.title, '[WIP]') != true && !github.event.pull_request.draft
46+
${{ ! ( contains(github.event.pull_request.title, '[WIP]') ||
47+
github.event.pull_request.draft ) }}
48+
runs-on: ubuntu-latest
4449
steps:
4550
- name: Checkout Pyomo source
4651
uses: actions/checkout@v4
@@ -57,6 +62,21 @@ jobs:
5762
uses: crate-ci/typos@master
5863
with:
5964
config: ./.github/workflows/typos.toml
65+
- name: URL Checker
66+
if: env.PYOMO_WORKFLOW == 'branch'
67+
uses: urlstechie/[email protected]
68+
with:
69+
# A comma-separated list of file types to cover in the URL checks
70+
file_types: .md,.rst,.py
71+
# Choose whether to include file with no URLs in the prints.
72+
print_all: false
73+
# More verbose summary at the end of a run
74+
verbose: true
75+
# How many times to retry a failed request (defaults to 1)
76+
retry_count: 3
77+
# Exclude Jenkins because it's behind a firewall; ignore RTD because
78+
# a magically-generated string is triggering a failure
79+
exclude_urls: https://pyomo-jenkins.sandia.gov/,https://pyomo.readthedocs.io/en/%s/errors.html
6080

6181

6282
build:
@@ -843,7 +863,8 @@ jobs:
843863
cover:
844864
name: process-coverage-${{ matrix.TARGET }}
845865
needs: build
846-
if: success() || failure() # run even if a build job fails, but not if cancelled
866+
# run even if a build job fails, but not if canceled (except for branches)
867+
if: success() || failure()
847868
runs-on: ${{ matrix.os }}
848869
timeout-minutes: 10
849870
strategy:
@@ -914,26 +935,6 @@ jobs:
914935
$PYTHON_EXE -c "from pyomo.dataportal.parse_datacmds import \
915936
parse_data_commands; parse_data_commands(data='')"
916937
917-
- name: Update codecov uploader
918-
run: |
919-
set +e
920-
CODECOV="${GITHUB_WORKSPACE}/codecov.sh"
921-
echo "CODECOV=$CODECOV" >> $GITHUB_ENV
922-
for i in `seq 3`; do
923-
echo "Downloading current codecov script (attempt ${i})"
924-
curl -L https://codecov.io/bash -o $CODECOV
925-
if test $? == 0; then
926-
break
927-
fi
928-
DELAY=$(( RANDOM % 30 + 30))
929-
echo "Pausing $DELAY seconds before re-attempting download"
930-
sleep $DELAY
931-
done
932-
if test ! -e $CODECOV; then
933-
echo "Failed to download codecov.sh"
934-
exit 1
935-
fi
936-
937938
- name: Combine coverage reports
938939
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
939940
run: |
@@ -972,7 +973,7 @@ jobs:
972973
973974
- name: Upload codecov reports
974975
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
975-
uses: codecov/codecov-action@v4
976+
uses: codecov/codecov-action@v5
976977
with:
977978
files: coverage.xml
978979
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}
@@ -984,7 +985,7 @@ jobs:
984985
if: |
985986
hashFiles('coverage-other.xml') != '' &&
986987
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
987-
uses: codecov/codecov-action@v4
988+
uses: codecov/codecov-action@v5
988989
with:
989990
files: coverage-other.xml
990991
token: ${{ secrets.PYOMO_CODECOV_TOKEN }}

pyomo/common/tests/test_tee.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,18 @@ def test_exit_on_del(self):
578578
stack = T.context_stack
579579
self.assertGreater(len(stack), 0)
580580
del T
581-
gc.collect()
581+
# This is a bit tricky: for cpython, T should be immediately
582+
# deallocated (including calling __del__) through reference
583+
# counting. pypy is trickier: because it lacks
584+
# reference-counting, it must rely on the GC. We have seen
585+
# cases on GHA where a single call to gc.collect() was sometimes
586+
# insufficient to ensure that T was collected (but unable to
587+
# reproduce it locally). We will try up to 4 times (1 more than
588+
# the number of generations in the GC)
589+
remaining_attempts = 4
590+
while len(stack) and remaining_attempts:
591+
gc.collect()
592+
remaining_attempts -= 1
582593
self.assertEqual(len(stack), 0)
583594

584595
def test_deadlock(self):

0 commit comments

Comments
 (0)