Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 9 additions & 7 deletions .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ env:
jobs:
lint:
name: lint/style-and-typos
if: |
${{ ! ( contains(github.event.pull_request.title, '[WIP]') ||
github.event.pull_request.draft ) }}
# Note: 'env' is not available in GHA jobs.<job_id>.if context.
if: ${{ ! contains(github.event.pull_request.title, '[WIP]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout Pyomo source
Expand Down Expand Up @@ -62,7 +61,7 @@ jobs:
sudo resolvectl query github.com
sudo resolvectl status
- name: URL Checker
if: env.PYOMO_WORKFLOW == '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
Expand Down Expand Up @@ -866,8 +865,8 @@ jobs:
cover:
name: process-coverage-${{ matrix.TARGET }}
needs: build
# run even if a build job fails, but not if canceled (except for branches)
if: ${{ false }}
# run even if a build job fails, but not if canceled
if: ${{ success() || failure() }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
Expand Down Expand Up @@ -976,7 +975,9 @@ jobs:
fi

- name: Upload codecov reports
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
if: |
env.PYOMO_WORKFLOW != 'branch' &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't really know what this is doing. Will this prevent people from running tests on branches on forks?

Copy link
Copy Markdown
Contributor

@michaelbynum michaelbynum May 4, 2026

Choose a reason for hiding this comment

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

Oh, this is just codecov. Never mind.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Exactly: we were getting weird behavior on codecov when branches from forks (including the main branch on forks), and when the "branches" workflow would upload coverage results. THis logic makes sure that only the Pyomo main branch, as well as any PR builds are uploaded to codecov.

(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
uses: codecov/codecov-action@v6
with:
files: coverage.xml
Expand All @@ -987,6 +988,7 @@ jobs:

- name: Upload other coverage reports
if: |
env.PYOMO_WORKFLOW != 'branch' &&
hashFiles('coverage-other.xml') != '' &&
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
uses: codecov/codecov-action@v6
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ env:
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' }}
${{ contains(github.event.pull_request.title, '[WIP]') && 'wip'
|| github.event.pull_request.draft && 'draft_pr'
|| github.event.pull_request.number && 'pr'
|| 'main' }}

jobs:
lint:
name: lint/style-and-typos
if: |
${{ ! ( contains(github.event.pull_request.title, '[WIP]') ||
github.event.pull_request.draft ) }}
# Note: 'env' is not available in GHA jobs.<job_id>.if context.
if: ${{ ! contains(github.event.pull_request.title, '[WIP]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout Pyomo source
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
sudo resolvectl query github.com
sudo resolvectl status
- name: URL Checker
if: env.PYOMO_WORKFLOW == '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
Expand Down Expand Up @@ -919,8 +919,8 @@ jobs:
cover:
name: process-coverage-${{ matrix.TARGET }}
needs: build
# run even if a build job fails, but not if canceled (except for branches)
if: success() || failure()
# run even if a build job fails, but not if canceled
if: ${{ success() || failure() }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
Expand Down Expand Up @@ -1029,7 +1029,9 @@ jobs:
fi

- name: Upload codecov reports
if: github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main'
if: |
env.PYOMO_WORKFLOW != 'branch' &&
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
uses: codecov/codecov-action@v6
with:
files: coverage.xml
Expand All @@ -1040,6 +1042,7 @@ jobs:

- name: Upload other coverage reports
if: |
env.PYOMO_WORKFLOW != 'branch' &&
hashFiles('coverage-other.xml') != '' &&
(github.repository_owner == 'Pyomo' || github.ref != 'refs/heads/main')
uses: codecov/codecov-action@v6
Expand Down
Loading