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

Formalize PR process for breaking changes #2289

Merged
merged 15 commits into from
Oct 5, 2023
10 changes: 9 additions & 1 deletion .github/workflows/build-tutorial-hello-world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ on:
- '.github/ISSUE_TEMPLATE/**'

jobs:
get-branch:
name: "Get target branch"
uses: ./.github/workflows/reusable-get-pr-branch.yml
with:
target_repository: fprime-community/fprime-tutorial-hello-world

run:
needs: get-branch
name: ""
uses: ./.github/workflows/reusable-builder.yml
uses: ./.github/workflows/reusable-project-builder.yml
with:
target_repository: fprime-community/fprime-tutorial-hello-world
build_location: HelloWorldDeployment
run_unit_tests: true
target_ref: ${{ needs.get-branch.outputs.target-branch }}
10 changes: 9 additions & 1 deletion .github/workflows/build-tutorial-led-blinker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ on:
- '.github/ISSUE_TEMPLATE/**'

jobs:
get-branch:
name: "Get target branch"
uses: ./.github/workflows/reusable-get-pr-branch.yml
with:
target_repository: fprime-community/fprime-workshop-led-blinker

run:
needs: get-branch
name: ""
uses: ./.github/workflows/reusable-builder.yml
uses: ./.github/workflows/reusable-project-builder.yml
with:
target_repository: fprime-community/fprime-workshop-led-blinker
build_location: LedBlinker
run_unit_tests: true
target_ref: ${{ needs.get-branch.outputs.target-branch }}
10 changes: 9 additions & 1 deletion .github/workflows/build-tutorial-math-comp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ on:
- '.github/ISSUE_TEMPLATE/**'

jobs:
get-branch:
name: "Get target branch"
uses: ./.github/workflows/reusable-get-pr-branch.yml
with:
target_repository: fprime-community/fprime-tutorial-math-component

run:
needs: get-branch
name: ""
uses: ./.github/workflows/reusable-builder.yml
uses: ./.github/workflows/reusable-project-builder.yml
with:
target_repository: fprime-community/fprime-tutorial-math-component
build_location: MathDeployment
run_unit_tests: true
target_ref: ${{ needs.get-branch.outputs.target-branch }}
42 changes: 42 additions & 0 deletions .github/workflows/reusable-get-pr-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# If the event that triggered this action is a PR and has a matching `pr-<number>` branch on
# target_repository, then return the name of that branch. Otherwise, return default_target_ref.
# See the CONTRIBUTING.md for info on why this is used.

name: 'Get PR Branch'

on:
workflow_call:
inputs:
target_repository:
description: 'The repository to check for the PR branch'
type: string
required: true
default_target_ref:
description: 'Ref to use if the PR branch is not found'
type: string
required: false
default: devel
outputs:
target-branch:
value: ${{ jobs.runs.outputs.target-branch }}

jobs:
runs:
runs-on: "ubuntu-latest"
outputs:
target-branch: ${{ steps.get_target_branch.outputs.TARGET_BRANCH }}
steps:
- name: "Get target branch"
id: get_target_branch
run: |
response_code=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/pr-${{ github.event.number }} -o /dev/null`
if [[ "${{ github.event_name }}" == "pull_request" && "$response_code" == "200" ]]; then
echo "TARGET_BRANCH=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
echo "PR branch found, using pr-${{ github.event.number }}"
else
echo "TARGET_BRANCH=${{ inputs.default_target_ref }}" >> $GITHUB_OUTPUT
echo "PR branch not found, using ${{ inputs.default_target_ref }}"
fi
shell: bash


Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ on:
default: "devel"

jobs:

build:
runs-on: ${{ inputs.runs_on }}
name: "Build"
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ the end, these checks must pass for the submission to continue.
If something seems amiss with one of these checks ask for help on your PR and a maintainer will do their best to help
get the submission moving forward.

### Automated Checks on Reference Repositories

Some of the above-mentioned automated checks run on reference applications that are not part of the core F´ repository, such as our [tutorial repositories](https://github.com/fprime-community#tutorials). This serves two main purposes: running more tests, and making sure our suite of reference applications and tutorials do not go out-of-date.
Because of this pattern, users who submit a pull request which introduces breaking changes on _how_ F´ is used in those external repositories will need to submit associated pull requests to introduce a fix on said external repositories.

The checks are configured to run on the `devel` branch of each external repository, but will prioritize the branch `pr-<PR_NUMBER>` if it exists, with `PR_NUMBER` being the number of the pull request that has been opened in nasa/fprime.

Maintainers will gladly help you in this process.

## Final Approval and Submission

Once all corrections have been made, automated checks are passing, and a maintainer has given final approval, it is time
Expand Down
Loading