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

Default branch to main instead of master #172

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

RSickenberg
Copy link

@RSickenberg RSickenberg commented Mar 30, 2022

Allow me to fix this:
#170

Note I couldn't run the PHPUnit in a clean env like the CI.

Greetings to everyone in Lausanne 👋🏼 💚

@RSickenberg RSickenberg marked this pull request as ready for review March 30, 2022 12:55
@jeanmonod
Copy link
Member

Hi @RSickenberg,

Thanks a lot for this PR 👍

There is still an issue with the tests because they rely on a small embedded Git repo: https://github.com/liip/RMT/blob/master/test/Liip/RMT/Tests/Unit/VCS/gitRepo.zip where the branch is still named master.

This is showing us, that changing the main branch name is a breaking change for existing RMT install (existing projects that are still using the master naming). We should find a way to make this configurable on the config. So we can ask users to add this config into rmt.yml if there are in this situation. Do you want to try to do this?

I imagine something like this:

vcs: 
  name: git
  main-branch: master

To locally run the tests, there is a documentation here: https://github.com/liip/RMT/blob/master/README.md#tests

Thanks again for your efforts!

@RSickenberg
Copy link
Author

Thanks, @jeanmonod for the input! Like I wrote on cd3b975, I didn't know about this small repo before so this answers the question I had about this.

I indeed followed the documentation, but my tests are differing from the CI, I have ~6/7 failures VS 2 (one should be fixed now) on the CI.
The issue must be due to the fact I'm running this on my machine with PHP 8.1.4.

I would love to contribute more on a migration script, let me some time to do so 🙂

@jeanmonod
Copy link
Member

@RSickenberg Changing the repo is an option to fix the tests. But you are still leaving alone all the users working with a master branch. For backward compatibility reason, we need a way to configure the main branch name in the config.
If you can do it, that's great, otherwise I will try to find someone on Lausanne to do it :)

@RSickenberg
Copy link
Author

@jeanmonod Sure, I will find a way to take care of that!

@RSickenberg
Copy link
Author

Hello @jeanmonod, could you run the tests?

What do you think of the current approach?

Copy link
Member

@jeanmonod jeanmonod left a comment

Choose a reason for hiding this comment

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

Thanks a lot @RSickenberg

I just did a first review! At this end, it's not an easy-pick at all. Sorry for that.

Can I ask you one more thing? To keep master branch name into the functional tests. Like this: 1) It's testing to use a different branch than main. So it's ensuring backward compat 2) We don't need to change the embedded Git repo?

.gitignore Outdated
@@ -5,3 +5,4 @@ cache.properties
bin
!bin/UpdateApplicationVersionCurrentVersion.php
.phpunit.result.cache
.idea/
Copy link
Member

Choose a reason for hiding this comment

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

Please keep this for your local git ignore

README.md Outdated
@@ -6,15 +6,15 @@ RMT - Release Management Tool
[![Total Downloads](https://poser.pugx.org/liip/RMT/d/total.png)](https://packagist.org/packages/liip/RMT)
[![License](https://poser.pugx.org/liip/rmt/license.svg)](https://packagist.org/packages/liip/rmt)

RMT is a handy tool to help releasing new versions of your software. You can define the type
RMT is a handy tool to help releasing a new versions of your software. You can define the type
Copy link
Member

Choose a reason for hiding this comment

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

new versionS. It was just before

README.md Outdated
@@ -123,12 +123,12 @@ RMT also support JSON configs, but we recommend using YAML.
### Branch specific config

Sometimes you want to use a different release strategy according to the VCS branch, e.g. you want to add CHANGELOG entries only in the `master` branch. To do so, you have to place your default config into a root element named `_default`, then you can override parts of this default config for the
Copy link
Member

Choose a reason for hiding this comment

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

One missing master here

'choices' => array('main', 'master'),
'choices_shortcuts' => array('m' => 'main', 'mst' => 'master'),
'default' => 'main',
)),
Copy link
Member

Choose a reason for hiding this comment

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

I don't like so much this question. If the user is saying none at the previous question, then it makes no sense to ask him a branch name.
But I have to admit that in most case users will use Git. Maybe allow also a choice n=>none. And adjust a bit the question:

The default branch you want to use (select none if you are not using a VCS system)

@@ -24,8 +26,8 @@ _default:
ask-confirmation: true

# BRANCH SPECIFIC CONFIG
# On master, we override the general config
master:
# On main, we override the general config
Copy link
Member

Choose a reason for hiding this comment

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

Please also use the %%main-branch%% in this comment

@@ -19,17 +19,35 @@ public function testInitialVersion(): void
$this->createConfig('simple', 'vcs-tag', array('vcs' => 'git'));
exec('./RMT release -n --confirm-first');
exec('git tag', $tags);
// $this->manualDebug();
Copy link
Member

Choose a reason for hiding this comment

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

Please keep all this $this->manualDebug();, they are very usefully to debug

$this->initGit();
$this->createConfig('simple', 'vcs-tag', ['vcs' => 'git']);
exec('git branch --show-current', $branch);
self::assertEquals('main', $branch[0]);
Copy link
Member

Choose a reason for hiding this comment

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

What are you testing here? To me this is not testing RMT...

self::assertEquals('master', $branch[0]);
exec('./RMT release -n --confirm-first');
exec('git tag', $tags);
self::assertEquals('1', $tags[0]);
Copy link
Member

Choose a reason for hiding this comment

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

Same here, I'm not really sure what you are testing. How could this test fail?

.rmt.yml Outdated
vcs: git
vcs:
name: git
main-branch: main
Copy link
Member

Choose a reason for hiding this comment

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

Let's do one thing at a time. Let's first merge this PR and then after this, I will change the main branch name of this repo. So please set master here for now

@RSickenberg
Copy link
Author

Hey @jeanmonod, can you run the tests, please? I saw I checked your comments so you might want to look at it :)

Regards

@jeanmonod
Copy link
Member

Hi @RSickenberg,
Sorry for my long silence, but I was off for the past 15 days. I long but very resourcing break :)
I will take a look at your lasted commit as soon as possible

@RSickenberg
Copy link
Author

Hello @jeanmonod, no worries! Hope this was a good break 🤗 !

Sure, let me know if you need anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants