-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from AiyionPrime/wg-variant-patch-actions
WG variant patch actions
- Loading branch information
Showing
9 changed files
with
231 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
name: Gluon check patches | ||
on: | ||
push: | ||
paths: | ||
- 'patches/**' | ||
- '.github/workflows/gluon-check-patches.yml' | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
paths: | ||
- 'patches/**' | ||
- '.github/workflows/gluon-check-patches.yml' | ||
schedule: | ||
- cron: '16 * * * *' | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
gluon-check-patches: | ||
name: Gluon check patches | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone gluon repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: freifunk-gluon/gluon | ||
|
||
- name: Clone site repo | ||
uses: actions/checkout@v3 | ||
with: | ||
path: gluon/site | ||
|
||
- name: apply site patches | ||
working-directory: ./gluon | ||
run: git -c user.name='freifunkh Patch Manager' -c user.email='freifunkh@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date site/patches/* | ||
|
||
|
||
# The following should match the last steps in gluons check-patches.yml | ||
- name: Refresh patches | ||
run: make refresh-patches GLUON_SITEDIR="contrib/ci/minimal-site" | ||
|
||
- name: Show diff | ||
run: git status; git diff | ||
|
||
- name: Patch status | ||
run: git diff-files --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Site check patches | ||
on: | ||
push: | ||
paths: | ||
- 'patches/**' | ||
- '.github/workflows/site-check-patches.yml' | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
paths: | ||
- 'patches/**' | ||
- '.github/workflows/site-check-patches.yml' | ||
schedule: | ||
- cron: '16 * * * *' | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
site-check-patches: | ||
name: site check patches | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone site repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run refresh_ffh_patches.sh | ||
working-directory: ./ | ||
run: ./refresh_ffh_patches.sh | ||
|
||
# The following should match the last steps from gluons check-patches.yml | ||
|
||
- name: Show diff | ||
run: git status; git diff | ||
|
||
- name: Patch status | ||
run: git diff-files --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Patches | ||
|
||
As gluon, this repo is upstream-first. | ||
Which means, if a patch can be upstreamed to gluon, it should be. | ||
|
||
|
||
## Patches in Gluons repo | ||
|
||
Whenever Gluon implements changes that cannot be upstreamed to OpenWrt or related repos (yet), | ||
Patchfiles are created and tracked in a subdir of the `patches`-folder in the gluon repo. | ||
|
||
Patches in that repo have to be structured in a specific way. | ||
There's a helper in the gluon repo, which reformats them accordingly, | ||
available by calling `make refresh-patches`. | ||
|
||
After calling it, the file is in the desired format, but uncommitted. | ||
Commit them (if necessary using `--amend`, if the commit that created italready exists). | ||
|
||
## Patches in this repo | ||
|
||
Our patches are similar: | ||
|
||
Whenever we implement changes that cannot be upstreamed to Gluon (yet), | ||
Patchfiles are created and tracked in the `patches`-folder in this repo. | ||
|
||
We structure these patches the very same way gluon does. | ||
There's again a helper in this repo, which formats them as intended. | ||
available by calling `refresh_ffh_patches.sh`. | ||
|
||
Calling it does change the files in the patch folder if necessary, but does not commit them. | ||
That's your task again. | ||
|
||
|
||
## Careful | ||
|
||
Working with these helpers is a fast and powerful workflow; | ||
which means you can break things fast. | ||
|
||
Make sure you have **no uncommited changes** in the respective repo, before calling either of them. | ||
That way recovering and assessing the situation is easy using git. | ||
|
||
|
||
## A clean patch | ||
|
||
If the folder contains only clean patches, calling either helper does not change anything. | ||
So calling them before pushing is a good way to make sure the GitHub actions will run through. | ||
|
||
|
||
# Use-cases | ||
|
||
## Updating a patch | ||
|
||
If we want to change an exiting patch of ours, we apply the *existing* patches to the proper gluon-branch can then alter the commits appropriately. | ||
After commiting the gluon changes using `--amend` we can then create a patch of it using `git format-patch`, and replace the old patch version with it. | ||
Now comes the new part: call `refresh_ffh_patches.sh` to have the script reformat it appropriately. | ||
This will minimize the differences to previous versions of the patches, regardless which OS we use to create them. | ||
|
||
## Gluon added a patch itself | ||
|
||
The action will fail, if tat breaks the order of existing patches. | ||
renaming the numbers manually and then fixing the script again will do the trick. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.