From 908a4e5181d0759187ac94425f0ca232a382ee3f Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Tue, 24 Jun 2025 16:05:27 -0400 Subject: [PATCH 1/3] feat: Publishing a release of harmony composer binary as latest-snapshot This allows users to run the latest build of harmony_composer any time with a single curl command that does not change. While not the most standard solution, it is very practical and acceptable in the context of a `latest-snapshot` tag --- .gitea/workflows/harmony_composer.yaml | 63 +++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/harmony_composer.yaml b/.gitea/workflows/harmony_composer.yaml index 6c7bc0f..fbb809b 100644 --- a/.gitea/workflows/harmony_composer.yaml +++ b/.gitea/workflows/harmony_composer.yaml @@ -19,13 +19,6 @@ jobs: - name: Build for Windows x86_64 GNU run: cargo build --release --bin harmony_composer --target x86_64-pc-windows-gnu - - uses: actions/upload-artifact@v3 - with: - name: binaries - path: | - target/x86_64-unknown-linux-gnu/release/harmony_composer - target/x86_64-pc-windows-gnu/release/harmony_composer.exe - - name: Setup log into hub.nationtech.io uses: docker/login-action@v3 with: @@ -35,6 +28,62 @@ jobs: # TODO: build ARM images and MacOS binaries (or other targets) too + - name: Update snapshot-latest tag + run: | + git config user.name "Gitea CI" + git config user.email "ci@nationtech.io" + git tag -f snapshot-latest + git push origin snapshot-latest --force + + - name: Install jq + run: apt install -y jq # The current image includes apt lists so we don't have to apt update and rm /var/lib/apt... every time. But if the image is optimized it won't work anymore + + - name: Create or update release + run: | + # First, check if release exists and delete it if it does + RELEASE_ID=$(curl -s -X GET \ + -H "Authorization: token ${{ secrets.GITEATOKEN }}" \ + "https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/tags/snapshot-latest" \ + | jq -r '.id // empty') + + if [ -n "$RELEASE_ID" ]; then + # Delete existing release + curl -X DELETE \ + -H "Authorization: token ${{ secrets.GITEATOKEN }}" \ + "https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/$RELEASE_ID" + fi + + # Create new release + RESPONSE=$(curl -X POST \ + -H "Authorization: token ${{ secrets.GITEATOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "snapshot-latest", + "name": "Latest Snapshot", + "body": "Automated snapshot build from master branch", + "draft": false, + "prerelease": true + }' \ + "https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases") + + echo "RELEASE_ID=$(echo $RESPONSE | jq -r '.id')" >> $GITHUB_ENV + + - name: Upload Linux binary + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITEATOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@target/x86_64-unknown-linux-gnu/release/harmony_composer" \ + "https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/${{ env.RELEASE_ID }}/assets?name=harmony_composer" + + - name: Upload Windows binary + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITEATOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@target/x86_64-pc-windows-gnu/release/harmony_composer.exe" \ + "https://git.nationtech.io/api/v1/repos/nationtech/harmony/releases/${{ env.RELEASE_ID }}/assets?name=harmony_composer.exe" + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 -- 2.39.5 From c00bb27043ed67b97c914a33b762172dfda3ebc2 Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Tue, 24 Jun 2025 16:36:46 -0400 Subject: [PATCH 2/3] doc(harmony_composer): Add README for harmony composer Explain the main usage and idea behind harmony_composer show a few examples Show how to run it in a single shell command --- harmony_composer/README.md | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 harmony_composer/README.md diff --git a/harmony_composer/README.md b/harmony_composer/README.md new file mode 100644 index 0000000..7ac2860 --- /dev/null +++ b/harmony_composer/README.md @@ -0,0 +1,65 @@ +# harmony_composer + +`harmony_composer` is a command-line utility for compiling and bootstrapping deployments for the Harmony orchestration framework. + +It's designed to simplify the build process by either compiling a Harmony project found in a local harmony directory or by bootstrapping a new deployment through auto-detection of the current project type. + +## ⚡ Quick Install & Run (Linux x86-64) + +You can download and run the latest snapshot build with a single command. This will place the binary in ~/.local/bin, which should be in your PATH on most modern Linux distributions. + +```bash + +curl -Ls https://git.nationtech.io/NationTech/harmony/releases/download/snapshot-latest/harmony_composer \ + -o ~/.local/bin/harmony_composer && \ +chmod +x ~/.local/bin/harmony_composer +``` + +> ⚠️ Warning: Unstable Builds +> The snapshot-latest tag points to the latest build from the master branch. It is unstable, unsupported, and intended only for early testing of new features. Please do not use it in production environments. + +## ⚙️ How It Works + +harmony_composer requires either cargo or docker to be available on your system to compile the Harmony project. + +- If cargo is found: It will be used to compile the project locally. +- If cargo is not found: It will automatically download and run the harmony_composer Docker image. This image is a self-contained build environment with the required Cargo binary and build targets for both Linux and Windows. +- If both cargo and docker are unavailable, `harmony_composer` will fail. Please install one of them. + +## 📖 Basic Usage + +Here are some common commands: + +```bash + +# Run the full check, compile, and deploy pipeline +harmony_composer all --prod + +# Only compile the Harmony smart contracts +harmony_composer compile + +# Only run static checks on the project +harmony_composer check + +# Deploy a previously compiled build +harmony_composer deploy --staging +``` + +For a full list of commands and their options, run: +```bash + +harmony_composer --help +``` + +## 🏗️ Supported Architectures + +The build system currently supports compiling for: + + x86_64-unknown-linux-gnu + x86_64-pc-windows-gnu + +More target architectures are planned. If your platform is not yet supported, please open a feature request in the main repository. + +## 🔗 Main Project + +This tool is a small part of the main Harmony project. For complete documentation, contribution guidelines, and license information, please refer to the main repository. -- 2.39.5 From a9ad6b13f21e105383a2c6b9071871236e59c2d2 Mon Sep 17 00:00:00 2001 From: tahahawa Date: Tue, 24 Jun 2025 23:47:01 -0400 Subject: [PATCH 3/3] update readme --- harmony_composer/README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/harmony_composer/README.md b/harmony_composer/README.md index 7ac2860..279ad8a 100644 --- a/harmony_composer/README.md +++ b/harmony_composer/README.md @@ -15,8 +15,8 @@ curl -Ls https://git.nationtech.io/NationTech/harmony/releases/download/snapshot chmod +x ~/.local/bin/harmony_composer ``` -> ⚠️ Warning: Unstable Builds -> The snapshot-latest tag points to the latest build from the master branch. It is unstable, unsupported, and intended only for early testing of new features. Please do not use it in production environments. +> ⚠️ Warning: Unstable Builds +> The snapshot-latest tag points to the latest build from the master branch. It is unstable, unsupported, and intended only for early testing of new features. Please do not use it in production environments. ## ⚙️ How It Works @@ -32,20 +32,21 @@ Here are some common commands: ```bash -# Run the full check, compile, and deploy pipeline -harmony_composer all --prod - -# Only compile the Harmony smart contracts +# Compile the repo's Harmony module harmony_composer compile -# Only run static checks on the project +# Run check script on the project harmony_composer check -# Deploy a previously compiled build -harmony_composer deploy --staging +# Run the repo's entire harmony deployment sequence +harmony_composer deploy + +# Run the full check, compile, and deploy pipeline +harmony_composer all ``` For a full list of commands and their options, run: + ```bash harmony_composer --help -- 2.39.5