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

ci: upload contracts to CF R2 from main #100

Merged
merged 16 commits into from
Feb 4, 2025
Merged

ci: upload contracts to CF R2 from main #100

merged 16 commits into from
Feb 4, 2025

Conversation

hydrobeam
Copy link
Contributor

@hydrobeam hydrobeam commented Dec 6, 2024

closes AXE-6843

the new workflow is mostly adapted from release.yaml

Test: https://github.com/axelarnetwork/axelar-cgp-soroban-testing/actions/runs/13063535201

@hydrobeam hydrobeam requested a review from a team as a code owner December 6, 2024 16:32
@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.15%. Comparing base (4ffb0cb) to head (a1e8954).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #100   +/-   ##
=======================================
  Coverage   97.15%   97.15%           
=======================================
  Files          69       69           
  Lines        4000     4000           
=======================================
  Hits         3886     3886           
  Misses        114      114           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.github/workflows/release-hash.yaml Outdated Show resolved Hide resolved
.github/workflows/reusable-build-upload.yaml Outdated Show resolved Hide resolved
.github/workflows/pre-release.yaml Outdated Show resolved Hide resolved
.github/workflows/pre-release.yaml Outdated Show resolved Hide resolved
.github/workflows/pre-release.yaml Outdated Show resolved Hide resolved
.github/workflows/pre-release.yaml Outdated Show resolved Hide resolved
.github/workflows/reusable-build.yaml Outdated Show resolved Hide resolved
.github/workflows/pre-release.yaml Outdated Show resolved Hide resolved
.github/workflows/pre-release.yaml Outdated Show resolved Hide resolved
Comment on lines +30 to +34
RELEASES_JSON=$(find contracts -maxdepth 1 -mindepth 1 -type d | sed 's|contracts/||' | jq -R . | jq -s --arg commit "${{ steps.get-commit-hash.outputs.hash }}" 'map({
package_name: .,
version: $commit,
package_git_tag: "\(.)_\($commit)"
})')
Copy link
Member

Choose a reason for hiding this comment

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

this is overkill, the commit is the same now, we just need to list all contract names

Copy link
Contributor

Choose a reason for hiding this comment

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

We should also consider the existing release workflow, and this is the same format where MarcoIeni/release-plz-action@fff938ea2923fdfa35797fff63537b00f30fe6f9 uses.

Copy link
Member

Choose a reason for hiding this comment

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

But we aren't releasing to crates.io here. Take a look at how the version and package_git_tag are being used below. The commit hash can be used there directly instead of creating this confusing JSON

.github/workflows/reusable-build.yaml Outdated Show resolved Hide resolved
.github/workflows/reusable-upload.yaml Outdated Show resolved Hide resolved
.github/workflows/reusable-upload.yaml Outdated Show resolved Hide resolved
.github/workflows/reusable-upload.yaml Outdated Show resolved Hide resolved
.github/workflows/reusable-build.yaml Show resolved Hide resolved
.github/workflows/reusable-build.yaml Outdated Show resolved Hide resolved
@milapsheth milapsheth changed the title ci: add ability to upload wasm artefacts based on release hash ci: upload contracts to R2 from main Feb 4, 2025
@ahramy ahramy changed the title ci: upload contracts to R2 from main ci: upload contracts to CL R2 from main Feb 4, 2025
@ahramy ahramy changed the title ci: upload contracts to CL R2 from main ci: upload contracts to CF R2 from main Feb 4, 2025
@ahramy ahramy merged commit a2de330 into main Feb 4, 2025
7 checks passed
@ahramy ahramy deleted the hash-release-process branch February 4, 2025 19:52
@@ -0,0 +1,66 @@
# Workflow to fetch the latest commit hash on the main branch and upload artifacts to CF storage.
Copy link
Member

Choose a reason for hiding this comment

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

`# Build Stellar contracts on every commit to main and upload the wasm code to Cloudflare R2

package-name:
description: "The package name to use (ex: gz-srv)"
type: string
required: true
default: ""

Copy link
Member

Choose a reason for hiding this comment

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

why remove newlines? it's more readable that way

Comment on lines +30 to +34
RELEASES_JSON=$(find contracts -maxdepth 1 -mindepth 1 -type d | sed 's|contracts/||' | jq -R . | jq -s --arg commit "${{ steps.get-commit-hash.outputs.hash }}" 'map({
package_name: .,
version: $commit,
package_git_tag: "\(.)_\($commit)"
})')
Copy link
Member

Choose a reason for hiding this comment

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

But we aren't releasing to crates.io here. Take a look at how the version and package_git_tag are being used below. The commit hash can be used there directly instead of creating this confusing JSON

@@ -6,15 +6,14 @@ on:
pull_request:
branches:
- main
- 'releases/**'
- "releases/**"
Copy link
Member

Choose a reason for hiding this comment

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

Just releases/** is fine, consistent with other actions

Comment on lines +64 to +66
uses: ./.github/workflows/reusable-build.yaml
with:
commit-hash: ${{ needs.publish-release.outputs.commit_hash }}
Copy link
Member

Choose a reason for hiding this comment

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

Is this correct? This is creating a build on the current commit hash instead of using the release tags created for every contract by release-plz. So, the built wasm files won't correspond to the release tag? The release matrix needs to be applied for both build and upload, unless all release tags are the same commit

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