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

#2503 push SNAPSHOT Maven artifacts to github Packages #2525

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

Conversation

icrc-fdeniger
Copy link
Contributor

@icrc-fdeniger icrc-fdeniger commented Apr 23, 2024

Fixes #2503

Description
Publish Maven artifacts in GitHub Packages

Type
Feature

Checklist

Versions

  • When the maven artifacts are deployed in GitHub Packages the SNAPSHOT prefix is used to follow Maven coventions.
  • When the maven artifacts are deployed in official maven repositories, the SNAPSHOT prefix is not used ( as it's done actually as far as I can understand)
  • In the PR, the artifact versions has been updated to next expected release version:
    • for instance, commonmodule will be automatically deployed with the version 0.1.0-alpha06-SNAPSHOT in GitHub Packages and with 0.1.0-alpha06 in the next release.

Suggestion/question
why not removeing beta/alpha as versions like 0.X.Y are considered as development version ?

Current Version Used in this PR Proposition
common:0.1.0-alpha05 common:0.1.0-alpha06 common:0.1.1
engine:1.0.0 engine:1.0.1 engine:1.0.1
data-capture:1.1.0 data-capture:1.1.1 data-capture:1.1.1
workflow:0.1.0-alpha04 workflow:0.1.0-alpha05 workflow:0.1.1
ontrib-barcode:0.1.0-beta3 ontrib-barcode:0.1.0-beta4 ontrib-barcode:0.1.1
contrib-locationwidget:0.1.0-alpha01 contrib-locationwidget:0.1.0-alpha02 contrib-locationwidget:0.1.1
knowledge:0.1.0-alpha03 knowledge:0.1.0-alpha04 knowledge:0.1.1

if a dev Team wants to use an alpha/beta version it can use a dependency to a SNAPSHOT version ( the "unstable version created from the last build").
it's also possible to specify the artifact of a build with by example: engine-1.0.1-20240423.083712-3

@icrc-fdeniger icrc-fdeniger marked this pull request as ready for review April 23, 2024 10:22
Copy link
Member

@vorburger vorburger left a comment

Choose a reason for hiding this comment

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

LGTM, based on an initial quick glance... but a "core team" member and not just me should probably also rewiew this PR.

@icrc-fdeniger
Copy link
Contributor Author

Hello @santosh-pingle, @ktarasenko
please tell me if this PR need to be modified. I understand that the version updates are the "tricky" part and will be happy to modify this. My point was to update them to the next version as GitHub Actions should produce SNAPSHOT of next versions.

Thanks

@vorburger
Copy link
Member

@icrc-fdeniger FYI the artifact version number changes introduced here will cause build failures once you rebase this after #2533 is merged. The required fix (after you have rebased it, not right now) is as simple as changing those version numbers also in the (new, TBD) docs/use/api.md file; hopefully that's trivial. Please do shout if unclear!

@MJ1998 @santosh-pingle @ktarasenko merge this only after #2533.

@icrc-fdeniger
Copy link
Contributor Author

@vorburger @santosh-pingle @ktarasenko should be ok now

@vorburger
Copy link
Member

@vorburger @santosh-pingle @ktarasenko should be ok now

LGTM! I say let's merge this... @santosh-pingle @ktarasenko @MJ1998 no objects, right?

Copy link
Collaborator

@MJ1998 MJ1998 left a comment

Choose a reason for hiding this comment

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

LGTM but requesting @aditya-07 to approve.

buildSrc/src/main/kotlin/Releases.kt Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/Releases.kt Show resolved Hide resolved
@MJ1998
Copy link
Collaborator

MJ1998 commented May 13, 2024

Thanks for this PR @icrc-fdeniger. LGTM.

About the version proposal we would wanna keep the alpha/beta naming conventions. Reason - Using alpha and beta suffixes aligns with established conventions in semantic versioning and open-source software development. So we would like to stick with it.

Copy link
Collaborator

@MJ1998 MJ1998 left a comment

Choose a reason for hiding this comment

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

LGTM

buildSrc/src/main/kotlin/Releases.kt Outdated Show resolved Hide resolved
buildSrc/src/main/kotlin/Releases.kt Outdated Show resolved Hide resolved
@MJ1998 MJ1998 enabled auto-merge (squash) May 23, 2024 05:11
@icrc-fdeniger
Copy link
Contributor Author

@santosh-pingle any news on that PR ?

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

Thansk @icrc-fdeniger for this contribution! 🙏

For some background on the maven-repository.zip artifact, see this PR from @yigit:
#249. We also have some documentation and I just realised it's a bit messed up after our recent documentation migration to this page: https://google.github.io/android-fhir/contrib but for your information the original text is this:

Use unreleased GitHub build (for development/testing only)

Each GitHub build of the project also contains a maven repository. You can access unreleased features by downloading it and including it in your project. To acquire the maven repository, go the the actions page, and click on the build you want. In the build artifacts dropdown, you will find a maven-repository.zip file. After downloading and extracting it to a local folder, you can add it to your gradle setup via:

repositories {
  maven {
    url "file:///<path to the unzipped folder>"
  }
}

These artifacts are versioned as a combination of the current version + buildid (e.g. 0.1.0-alpha01-build_123). You can find the version in the zip file by checking the contents of it and update your build file to match that version.

OK, now onto github packages - with this change, do we always overwrite the SNAPSHOT? so if I have a PR in development, and I push a new commit it will overwrite the github packages?

Another thing we might need to be careful about is just any incurred cost - https://github.com/features/packages#pricing. With our repo under google organisation I'm hoping that we'll be covered by the google organisation quota/allowance. But I will investigate.

docs/use/api.md Outdated
Comment on lines 3 to 6
* [Engine](api/engine/1.0.1/index.html)
* [Data Capture](api/data-capture/1.1.1/index.html)
* [Workflow](api/workflow/0.1.0-alpha05/index.html)
* [Knowledge](api/knowledge/0.1.0-alpha04/index.html)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this would break our existing doc. please revert this change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems to me the PR is doing 2 things: set up the snapshot artifacts on github and updating the version numbers. In the spirit of making things independent, can we revert the version number change?

Copy link
Collaborator

@MJ1998 MJ1998 Jun 6, 2024

Choose a reason for hiding this comment

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

I think we need to do both in this PR. Version update indicates the future version to be released .. the snapshot of which is released in GitHub package.

If we don't update the version, the snapshot will be pushed with version that has already been released..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jingtang10 all done.
But I can revert again :) As @MJ1998 mentionned the point is to push a SNAPSHOT of the next release to help developper from other team to use the last version without having to download zip file and doing temporary changes in their local installation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need to do both in this PR. Version update indicates the future version to be released .. the snapshot of which is released in GitHub package.

If we don't update the version, the snapshot will be pushed with version that has already been released..

yeah i see your point - but we also don't necessarily determine version increments before an actual release - for example a breaking change might need to be introduced and we might need to actually bump up the major version. or maybe an urgent minior fix needs to go in immediately and we need to make a small version increment. this process would enforce us to know for which future version we're publishing the snapshots :/

i guess really - we're publishing snapshots for HEAD...

Copy link
Member

Choose a reason for hiding this comment

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

The way I have seen this conundrum resolved traditionally (in other Java projects using Maven version numbers) is simply that you "avoid" the "problem is that sometimes we don't know what the next version is"; by using https://semver.org numbering, and determining the version number "early". For example, if the last FHIR Engine that was released was v1.0.0, you should decide "now" (not when you release) if what's currently coming together on the master branch is going be the (future) v1.1.0, not v1.1.1. Therefore, the version number in Gradle would be set to 1.1.0-SNAPSHOT. When you release, you drop the SNAPSHOT and create a 1.1.0 release - and then immediately increment to 1.2.0-SNAPSHOT. When an urgent minior fix needs to go in immediately, then you git branch that off from the 1.1.0 revision and change the version to 1.1.1 (-SNAPSHOT, if more changes are possibly anticipated on such a maintenance branch; else never mind), on the branch (only). I hope this helps?

@MJ1998
Copy link
Collaborator

MJ1998 commented Jun 6, 2024

OK, now onto github packages - with this change, do we always overwrite the SNAPSHOT? so if I have a PR in development, and I push a new commit it will overwrite the github packages?

Yes it will overwrite.

Another thing we might need to be careful about is just any incurred cost - https://github.com/features/packages#pricing. With our repo under google organisation I'm hoping that we'll be covered by the google organisation quota/allowance. But I will investigate.

I doubt if there will be a problem but we will beinformed by Google in case the quota reaches limit..

auto-merge was automatically disabled June 6, 2024 07:41

Head branch was pushed to by a user without write access

@icrc-fdeniger
Copy link
Contributor Author

Thansk @icrc-fdeniger for this contribution! 🙏

For some background on the maven-repository.zip artifact, see this PR from @yigit: #249. We also have some documentation and I just realised it's a bit messed up after our recent documentation migration to this page: google.github.io/android-fhir/contrib but for your information the original text is this:

Use unreleased GitHub build (for development/testing only)
Each GitHub build of the project also contains a maven repository. You can access unreleased features by downloading it and including it in your project. To acquire the maven repository, go the the actions page, and click on the build you want. In the build artifacts dropdown, you will find a maven-repository.zip file. After downloading and extracting it to a local folder, you can add it to your gradle setup via:

repositories {
  maven {
    url "file:///<path to the unzipped folder>"
  }
}

These artifacts are versioned as a combination of the current version + buildid (e.g. 0.1.0-alpha01-build_123). You can find the version in the zip file by checking the contents of it and update your build file to match that version.

OK, now onto github packages - with this change, do we always overwrite the SNAPSHOT? so if I have a PR in development, and I push a new commit it will overwrite the github packages?

Another thing we might need to be careful about is just any incurred cost - github.com/features/packages#pricing. With our repo under google organisation I'm hoping that we'll be covered by the google organisation quota/allowance. But I will investigate.

the old version will be kept as you can see here:
https://github.com/icrc-fdeniger/android-fhir/packages/2129825
It's a kind of feature as we can use a specific SNAHPSHOT Version.

So yes it could be an issue with the storage. It seems there are no perfect solution for this point:
https://github.com/orgs/community/discussions/48971

@jingtang10
Copy link
Collaborator

Thansk @icrc-fdeniger for this contribution! 🙏
For some background on the maven-repository.zip artifact, see this PR from @yigit: #249. We also have some documentation and I just realised it's a bit messed up after our recent documentation migration to this page: google.github.io/android-fhir/contrib but for your information the original text is this:

Use unreleased GitHub build (for development/testing only)
Each GitHub build of the project also contains a maven repository. You can access unreleased features by downloading it and including it in your project. To acquire the maven repository, go the the actions page, and click on the build you want. In the build artifacts dropdown, you will find a maven-repository.zip file. After downloading and extracting it to a local folder, you can add it to your gradle setup via:

repositories {
  maven {
    url "file:///<path to the unzipped folder>"
  }
}

These artifacts are versioned as a combination of the current version + buildid (e.g. 0.1.0-alpha01-build_123). You can find the version in the zip file by checking the contents of it and update your build file to match that version.

OK, now onto github packages - with this change, do we always overwrite the SNAPSHOT? so if I have a PR in development, and I push a new commit it will overwrite the github packages?
Another thing we might need to be careful about is just any incurred cost - github.com/features/packages#pricing. With our repo under google organisation I'm hoping that we'll be covered by the google organisation quota/allowance. But I will investigate.

the old version will be kept as you can see here: https://github.com/icrc-fdeniger/android-fhir/packages/2129825 It's a kind of feature as we can use a specific SNAHPSHOT Version.

So yes it could be an issue with the storage. It seems there are no perfect solution for this point: https://github.com/orgs/community/discussions/48971

is there a way to publish a github package on whatever is on HEAD? i feel like that's much more useful?

@icrc-fdeniger have you tested that the current local packages (what i mentioned above) are generated in your forked repo? I'm not seeing any successful github build actions?

See https://github.com/icrc-fdeniger/android-fhir/actions/runs/8798380904/job/24145256498 for a full deployment

this run seems to have failied?

also can you update the description to clarify when the packages are generated? is it on every github action run? will different branches and prs overwrite each other's packages?

@vorburger
Copy link
Member

vorburger commented Jun 6, 2024

also can you update the description to clarify when the packages are generated? is it on every github action run? will different branches and prs overwrite each other's packages?

How about, instead of capturing this with comments here, contributing (in this PR) clarifications for any questions related to all this in a snapshot.md (or whatever) doc in https://github.com/google/android-fhir/tree/master/docs/contrib? (And link it in mkdocs.yaml.

@icrc-fdeniger
Copy link
Contributor Author

Thansk @icrc-fdeniger for this contribution! 🙏
For some background on the maven-repository.zip artifact, see this PR from @yigit: #249. We also have some documentation and I just realised it's a bit messed up after our recent documentation migration to this page: google.github.io/android-fhir/contrib but for your information the original text is this:

Use unreleased GitHub build (for development/testing only)
Each GitHub build of the project also contains a maven repository. You can access unreleased features by downloading it and including it in your project. To acquire the maven repository, go the the actions page, and click on the build you want. In the build artifacts dropdown, you will find a maven-repository.zip file. After downloading and extracting it to a local folder, you can add it to your gradle setup via:

repositories {
  maven {
    url "file:///<path to the unzipped folder>"
  }
}

These artifacts are versioned as a combination of the current version + buildid (e.g. 0.1.0-alpha01-build_123). You can find the version in the zip file by checking the contents of it and update your build file to match that version.

OK, now onto github packages - with this change, do we always overwrite the SNAPSHOT? so if I have a PR in development, and I push a new commit it will overwrite the github packages?
Another thing we might need to be careful about is just any incurred cost - github.com/features/packages#pricing. With our repo under google organisation I'm hoping that we'll be covered by the google organisation quota/allowance. But I will investigate.

the old version will be kept as you can see here: icrc-fdeniger/android-fhir/packages/2129825 It's a kind of feature as we can use a specific SNAHPSHOT Version.
So yes it could be an issue with the storage. It seems there are no perfect solution for this point: github.com/orgs/community/discussions/48971

is there a way to publish a github package on whatever is on HEAD? i feel like that's much more useful?

@icrc-fdeniger have you tested that the current local packages (what i mentioned above) are generated in your forked repo? I'm not seeing any successful github build actions?

See icrc-fdeniger/android-fhir/actions/runs/8798380904/job/24145256498 for a full deployment

this run seems to have failied?

also can you update the description to clarify when the packages are generated? is it on every github action run? will different branches and prs overwrite each other's packages?

it's failing because of the feature "git pages" that I didn't activate on my repo. I tested it on April on my branch master-deploy-repo. To do the PR I had to revert my "test setup" :
icrc-fdeniger@8293430

You can have a look here:
https://github.com/icrc-fdeniger/android-fhir/actions/runs/8798380904/job/24145256498
and here:
image

The publication is working. If you want I can modify the github actions on my branch to show that the action will be launched for every push on master-deploy-repo and it's ok.

If the PR is accepted as is on the official repo, The publish task is launched automatically for all push to master only ( so when a PR is merged on master branch). For PR, the task will be skipped:
https://github.com/icrc-fdeniger/android-fhir/blob/6cc76eec4476188bce55a455755968fa97a38cfb/.github/workflows/build.yml#L79

@icrc-fdeniger
Copy link
Contributor Author

also can you update the description to clarify when the packages are generated? is it on every github action run? will different branches and prs overwrite each other's packages?

How about, instead of capturing this with comments here, contributing (in this PR) clarifications for any questions related to all this in a snapshot.md (or whatever) doc in master/docs/contrib? (And link it in mkdocs.yaml.

@vorburger I should create a new file shapshot.md in docs/contrib and add a line related to this in mkdocs.yml and in the sections "Contributors". Am I correct ?

@vorburger
Copy link
Member

vorburger commented Jun 6, 2024

@vorburger I should create a new file shapshot.md in docs/contrib and add a line related to this in mkdocs.yml and in the sections "Contributors". Am I correct ?

Yup, exactly; that's how you can contribute documentation! (If you want to, this is a suggestion.) You can name the MD file with any filename you like, obviously.

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

Successfully merging this pull request may close these issues.

Deploy pre-built SNAPSHOT pre-release (dev, unstable) versions of Engine and DataCapture to a Maven repo
5 participants