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: update workflow fork conditions to allow run on copies #6783

Merged
merged 5 commits into from
Jul 9, 2024
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
14 changes: 9 additions & 5 deletions .github/workflows/e2e-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ on:

# cancel workflows if a new one is triggered on the same branch.
concurrency:
group: ${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to amend similar line in e2e-wasm?

cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
# dynamically build a matrix of test/test suite pairs to run
build-test-matrix:
if: ${{ github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
# run this job on forks and copies of ibc-go, for example: a public fork or a private copy of ibc-go.
if: ${{ github.repository != 'cosmos/ibc-go' || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

fine with either but is this required? I'd assume checking if it is/isn't a fork was the most general option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, pretty much! It's a cute solution I think. With Github forks, they can't be private, you don't have the ability to change the visibility.
image

So to use something like a "private fork", it is not treated as an actual fork, and more like importing a particular git history into a new repository.

Copy link
Contributor

Choose a reason for hiding this comment

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

to use something like a "private fork", it is not treated as an actual fork

quirky af. Makes sense to me, want to add a small comment there explaining it? Can see this as being something someone would change in future w/o knowing why it was there.

runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -35,7 +36,8 @@ jobs:

# dynamically build a matrix of test/test suite pairs to run
build-test-matrix-wasm:
if: ${{ github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
# run this job on forks and copies of ibc-go, for example: a public fork or a private copy of ibc-go.
if: ${{ github.repository != 'cosmos/ibc-go' || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -59,7 +61,8 @@ jobs:
CHAIN_IMAGE: ibc-go-simd
RELAYER_ID: "hermes" # by default use hermes for fork e2es.
FORK: "true"
if: ${{ github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
# run this job on forks and copies of ibc-go, for example: a public fork or a private copy of ibc-go.
if: ${{ github.repository != 'cosmos/ibc-go' || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
needs:
- build-test-matrix
runs-on: ubuntu-latest
Expand Down Expand Up @@ -88,7 +91,8 @@ jobs:
# CHAIN_IMAGE: ibc-go-wasm-simd
# RELAYER_ID: "hyperspace" # by default use hyperspace relayer for fork wasm tests.
# FORK: "true"
# if: ${{ github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
# run this job on forks and copies of ibc-go, for example: a public fork or a private copy of ibc-go.
# if: ${{ github.repository != 'cosmos/ibc-go' || github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' }}
# needs: build-test-matrix-wasm
# runs-on: ubuntu-latest
# strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:

# cancel workflows if a new one is triggered on the same branch.
concurrency:
group: ${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ on:
- 'LICENSE'
# cancel workflows if a new one is triggered on the same branch.
concurrency:
group: ${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
# determine-image-tag will either output the PR number e.g. pr-1234 or the string main.
# this will be used to tag the images that are built during the workflow.
determine-image-tag:
if: ${{ !github.event.pull_request.draft && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
if: ${{ !github.event.pull_request.draft && github.repository == 'cosmos/ibc-go' && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
outputs:
simd-tag: ${{ steps.get-tag.outputs.simd-tag }}
Expand All @@ -50,7 +50,7 @@ jobs:
e2e:
# we will be running this job if the PR has not yet been marked for review, and we push additional changes.
# we skip the job in this case.
if: ${{ !github.event.pull_request.draft && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
if: ${{ !github.event.pull_request.draft && github.repository == 'cosmos/ibc-go' && github.actor != 'dependabot[bot]' }}
needs: determine-image-tag # we are required to have a docker tag before we can build any images.
uses: ./.github/workflows/e2e-test-workflow-call.yml
# unless we explicitly tell the workflow to inherit secrets, required secrets such as GITHUB_TOKEN will not be
Expand Down
Loading