I have a package hosted on Github that I work on in VSCode (both of which I am new to). It currently has master
, feature-x
, and bugfix-x
branches that I created as well as some branches from CompatHelper
. All branches get merged into master
once they are finished.
However, I noticed a workflow issue when trying to update my package dependencies. How can I test new versions of my package dependencies with my package before adding them to the compat
list in the master
Project.toml
? The Project.toml
has to be updated before ] update
will work, but then my package says it is compatible with dependent packages before I know if that is true.
I imagine I need to add a new intermediate dev
branch to my Git structure, but I don’t know how to change CompatHelper so it points to a different branch. Also, complicating my Git tree sounds like a bad idea. I already almost always screw up my merges and end up manually copy and pasting into a new commit for master
instead.
1 Like
You probably don’t need a dev
branch. What you need is:
- Github actions to automatically run tests (including downloading the relevant package versions as specified in your
Project.toml
) on every PR you make
- Some magic to make sure those tests are also run on every PR that
CompatHelper
makes
This thread: Easy workflow file for setting up GitHub Actions CI for your Julia package has info for step (1), and these docs: Home · CompatHelper.jl have info for step (2).
Once you do this, you’ll get a nice green checkmark on your PRs that verifies that they install and test correctly before merging into master
.
I’d definitely recommend asking for help when you get into this state. Git can be confusing, but this isn’t the way
1 Like
That makes sense. Unfortunately, my package is not open source at the moment, so Github actions is out.
I suppose the manual alternative is to
git checkout
CompatHelper
branch
] update
on that branch
- run tests on that branch
- merge PR
- repeat
or maybe
- create a new
bugfix-compat
branch with all the dependency updates added together manually
- update packages and test on that branch
- merge into
master
- delete
CompatHelper
PRs.
I find it hard to ask for help when I’m in that state, because I don’t know how to describe what is wrong. I usually think I know what to do, but then get an error that says I need to resolve some conflict before continuing and can’t figure out how. One example is here. The answer got me halfway fixed, but I still had to undo a previous PR and make some empty commits to master
before everything started working again.
That will mostly work, but by testing the CompatHelper
branch, you’ll miss out on any potential interactions between more recent changes on master
and that branch. To be safe, I’d suggest:
- Checkout
compathelper
branch
- Merge
master
into that branch: git merge origin/master
- This doesn’t change
master
(yet). Instead, it brings in any new changes from master
and unifies them with whatever changes are on the compathelper branch.
- Resolve any conflicts during this merge. It looks like you’re using VSCode for this–I don’t know how to use that particular tool, but I strongly recommend checking out https://meldmerge.org/ if you want to try something else (I use it constantly and have found it to work well even for extremely thorny merge conflicts in my daily work)
- At this point, you now have a branch which (a) includes the
CompatHelper
changes, (b) also includes any new changes from master
and (c) will definitely merge cleanly into master
when you’re ready.
pkg> update
and test
as you said
- merge the PR, which should have no conflicts with
master
1 Like