This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Prepare copy-workflow for setting up unified CI for JS repos #239
Merged
Conversation
This file contains hidden or 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
galargh
commented
Dec 8, 2021
galargh
commented
Dec 8, 2021
galargh
commented
Dec 8, 2021
galargh
commented
Dec 8, 2021
c03b9de to
c41af02
Compare
Contributor
Author
|
Since this PR doesn't modify any workflows in the target repositories I propose merging it into the Testing after the rebase
|
This was referenced Dec 20, 2021
| - name: Check if we need to create a PR | ||
| working-directory: ${{ env.TARGET_REPO_DIR }} | ||
| run: echo "NEEDS_UPDATE=$(git rev-list HEAD...origin/$(git rev-parse --abbrev-ref HEAD) --ignore-submodules --count)" >> $GITHUB_ENV | ||
| run: echo "NEEDS_UPDATE=$(git rev-list HEAD...origin/$(git rev-parse --abbrev-ref HEAD) --ignore-submodules --count 2> /dev/null || echo 1)" >> $GITHUB_ENV |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one. This is a lot better than working with fake bools (strings).
marten-seemann
approved these changes
Jan 7, 2022
Contributor
marten-seemann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
galargh
added a commit
that referenced
this pull request
Jan 7, 2022
* move config*.json files to configs directory * rename configs/*.json * make checks aware of all the configs/*.json * turn configs into objects with repositories key * make files part of the config * move language specific copy-workflow setup to actions * make dispatch workflow support more than one config json * create fewer batches if possible * set up copy-workflow actions properly * extract defaults from config separately * bring back double toJson * use copy-workflow actions from same branch * use compact json representation for storing FILES * fix files and local actions * run actions from template repo * add missing shell property to actions * add configs README * set deploy_versioning=true for go repositories * address review comments * restore hardcoded template-repo reference * add section on config testing * fix batches creation * fix command that produces batches * fix needs update logic
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Both
dispath.ymlandcopy-workflow.ymlhave accumulated a fair share ofgospecific setup. In this PR I'm trying to generalise both of these workflows to enable setting up unified CI for JS repos.Moving config JSONs to configs directory
With JS adoption we're expecting more JSON config files to be needed. I propose to store all the config JSON files in a designated
configsdirectory so that they're easy to find. This also allows us to use matching patterns likeconfigs/*.jsonin various places.Specifying what files should be copied for particular configuration
I have decided to create
defaultsobject withfilesarray field inside each config JSON file. Thefilesarray defines what files should be copied for that particular workflow by default.In dispatch workflow, each object from
repositoriesarray is mapped to the output of merging thedefaultsobject with the repository object. Thanks to this, it is also possible to override the list of files to be copied on a per repository basis (or other fields thatdefaultsmight define):Having the list of files to be copied in the same file as the list of repositories makes it easier for repo owners to reason about the outcome of adding a repository to the repositories list.
Handling language specific setup in copy-workflow
I have moved
gospecific setup tocopy-workflow-goaction. The action is performed iff the target object passed to the copy-workflow hasdeploy_gofield set totrue. I have used this pattern to provide specific setup for targets that requestdeploy_versioningtoo.It will also be applicable when we want to introduce more languages, like JS for example. We could just introduce new flags like
deploy_monorepo_js,deploy_isomorphic_js, etc.Testing
dispatch.ymlworkflow ontestingbranch: https://github.com/protocol/.github/actions/runs/1553727642copy-workflow.ymlworkflow ontestingbranch: https://github.com/protocol/.github/actions/runs/1553730245configs/go.jsonand failed to commit those changes becausepre-commithook prevented it