Skip to content

chore(ci): support independent versioning #248

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

Merged
merged 22 commits into from
Mar 22, 2022
Merged

chore(ci): support independent versioning #248

merged 22 commits into from
Mar 22, 2022

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Mar 14, 2022

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/APIC-364

Changes included:

  • Update release process to handle independent versioning

🧪 Test

  • CI

@netlify
Copy link

netlify bot commented Mar 14, 2022

✅ Deploy Preview for api-clients-automation canceled.

🔨 Explore the source changes: 69a1db1

🔍 Inspect the deploy log: https://app.netlify.com/sites/api-clients-automation/deploys/6239dace48642b0009592f15

@eunjae-lee eunjae-lee marked this pull request as ready for review March 15, 2022 10:17
@eunjae-lee eunjae-lee requested review from a team, damcou and shortcuts and removed request for a team March 15, 2022 10:18
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

Massive work ! I don't understand half of it, let's see it in action !

@shortcuts
Copy link
Member

shortcuts commented Mar 17, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the generated/main branch.

millotp
millotp previously approved these changes Mar 21, 2022
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

Looks really good!!

Comment on lines 11 to 13
// eslint-disable-next-line no-param-reassign
mainGenerator[lang] = clientsConfig[lang].mainGenerator;
return mainGenerator;
Copy link
Member

Choose a reason for hiding this comment

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

You can remove the eslint silent

Suggested change
// eslint-disable-next-line no-param-reassign
mainGenerator[lang] = clientsConfig[lang].mainGenerator;
return mainGenerator;
return {
...mainGenerator,
[lang]: clientsConfig[lang].mainGenerator,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, I prefer reassign. By its nature, reduce involves reassigning. eslint error about this within the context of reduce seems dumb to me. Plus, just to avoid eslint error, spreading the object can be cost-y (of course, in our case, it's almost zero, though)

Copy link
Member

Choose a reason for hiding this comment

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

eslint error about this within the context of reduce seems dumb to me.

I agree, it's also because it makes it more readable that way (IMO), but not a blocker anyway!

Copy link
Contributor

@bodinsamuel bodinsamuel left a comment

Choose a reason for hiding this comment

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

LGTM


Thought that is coming late to the party.
I'm surprised to see that much custom code, I was in the impression that we could reuse ShipJS (probably too JS specific but some parts) or semantic-release that is mostly language agnostic.
For example the commit parsing is tricky and has already been done. Same for changelog processing.
Maybe I'm missing some stuff

@eunjae-lee
Copy link
Contributor Author

Thought that is coming late to the party. I'm surprised to see that much custom code, I was in the impression that we could reuse ShipJS (probably too JS specific but some parts) or semantic-release that is mostly language agnostic. For example the commit parsing is tricky and has already been done. Same for changelog processing. Maybe I'm missing some stuff

Ship.js is indeed too JS specific. We're dealing with multiple languages at the same time, while supporting independent versioning (which didn't exist in Ship.js). I copied & pasted code from Ship.js here and there.

For changelog processing, I've used conventional-changelog (the JS library, not the CLI) in Ship.js, but the amount of code to make it work as expected was too much, although I wasn't doing anything but just trying to replicate conventional-changelog-cli. For commit parsing, we want to skip releases for languages with only chore commits. For customisability like that, I just went for custom implementation.

@eunjae-lee eunjae-lee requested a review from shortcuts March 22, 2022 13:46
shortcuts
shortcuts previously approved these changes Mar 22, 2022
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

Let's test it!

We should iterate on the Language type thing before we forget but it's not urgent here

@eunjae-lee
Copy link
Contributor Author

Let's test it!

We should iterate on the Language type thing before we forget but it's not urgent here

yup, we've got it here https://algolia.atlassian.net/browse/APIC-385

return versions;
function readVersions(): VersionsWithoutReleaseType {
return Object.keys(MAIN_GENERATOR).reduce((acc, lang) => {
// eslint-disable-next-line no-param-reassign
Copy link
Member

Choose a reason for hiding this comment

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

There's this one also 😇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what a hawk eye. 69a1db1

Copy link
Member

Choose a reason for hiding this comment

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

👀 🐦

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

purrfect

@eunjae-lee eunjae-lee enabled auto-merge (squash) March 22, 2022 14:20
@eunjae-lee eunjae-lee merged commit 4a28a66 into main Mar 22, 2022
@eunjae-lee eunjae-lee deleted the chore/versioning branch March 22, 2022 14:30
shortcuts added a commit that referenced this pull request Apr 22, 2022
* chore: replace next with releaseType

* chore: parse new issue body correctly

* chore(ci): support independent versioning

* chore: fix version bumping

* chore: fix test cases

* chore: add more test

* chore: move mainGenerator to clients.config.json

* chore: clean up code

* chore: rename variables

* chore: extract types to types.ts

* Update scripts/release/__tests__/process-release.test.ts

Co-authored-by: Clément Vannicatte <[email protected]>

* chore: update types

* chore: update test

* chore: fix broken config

* chore: avoid eslint error

* chore: avoid eslint error

Co-authored-by: Clément Vannicatte <[email protected]>
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.

4 participants