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

Avoid publishing redundant packages to CI feed #681

Closed
atifaziz opened this issue Nov 10, 2019 · 5 comments · Fixed by #758
Closed

Avoid publishing redundant packages to CI feed #681

atifaziz opened this issue Nov 10, 2019 · 5 comments · Fixed by #758

Comments

@atifaziz
Copy link
Member

atifaziz commented Nov 10, 2019

Today, every push to master also publishes a NuGet package to the CI feed on MyGet:

deploy:
- provider: NuGet
  server: https://www.myget.org/F/morelinq/api/v2/package
  api_key:
  symbol_server: https://www.myget.org/F/morelinq/symbols/api/v2/package
  on:
    branch: master

However, not each push changes the compiled binaries and so it's wasteful to publish redundant packages. We should use C#'s deterministic building (-deterministic) to avoid them. This would mean (I think) comparing MVID of the new binaries against those of the binaries from last published package and upload the new package from CI/CD pipeline if there's any difference.

@atifaziz
Copy link
Member Author

Looks like this needs to start with adding the following properties to MoreLinq.csproj:

<Deterministic>true</Deterministic>
<PathMap>$(MSBuildProjectDirectory)=.\</PathMap>

@atifaziz
Copy link
Member Author

PowerShell can be used to query MVID:

pwsh -C "Add-Type -Path MoreLinq.dll; [string][MoreLinq.MoreEnumerable].Assembly.Modules[0].ModuleVersionId"

@moh-hassan
Copy link
Contributor

@atifaziz
You can limit the generation of the package per tag only by adding APPVEYOR_REPO_TAG condition
When you push a tag to Appveyor, package will be pushed to MyGet.
The Package will be generated on artifact of appveyor and can be download manually from there (if needed).

deploy:
- provider: NuGet
  server: https://www.myget.org/F/morelinq/api/v2/package
  api_key:
  symbol_server: https://www.myget.org/F/morelinq/symbols/api/v2/package
  on:
    branch: master
  on:
    APPVEYOR_REPO_TAG: true    # add this line

@atifaziz
Copy link
Member Author

Thanks for that suggestion, but…

The Package will be generated on artifact of appveyor and can be download manually from there (if needed).

I precisely want to avoid the manual download for folks working with so-called “nightly” versions baking off each build. While AppVeyor does also offer NuGet feeds, it's something that could change if we migrate away to another CI platform. With MyGet, things stay independent and don't break if the cheese is moved.

@atifaziz
Copy link
Member Author

When you push a tag to Appveyor, package will be pushed to MyGet.

@moh-hassan I am going with an alternative of your suggestion with PR #758 and using a branch as opposed to a tag per nightly (which I feel would pollute the tag ref-space) or a single tag that would need to be force-pushed.

@atifaziz atifaziz linked a pull request Aug 12, 2020 that will close this issue
atifaziz added a commit that referenced this issue Aug 12, 2020
This is a squashed merge of PR #758 that closes #681.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants