From 759ee3acaf33afaa99a14d327f91af6712ebd8d0 Mon Sep 17 00:00:00 2001 From: Dante Sanchez Date: Tue, 11 Jul 2023 16:17:03 -0400 Subject: [PATCH 01/17] build hermes --- .github/workflows/hermes-linux-body.md | 4 ++ .github/workflows/hermes-linux.yml | 83 ++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 .github/workflows/hermes-linux-body.md create mode 100644 .github/workflows/hermes-linux.yml diff --git a/.github/workflows/hermes-linux-body.md b/.github/workflows/hermes-linux-body.md new file mode 100644 index 0000000..0ab764c --- /dev/null +++ b/.github/workflows/hermes-linux-body.md @@ -0,0 +1,4 @@ +## Hermes Linux build: latest release + +Binaries are built to the latest release in the `informalsystems/hermes` repo. + diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml new file mode 100644 index 0000000..bf1a1d5 --- /dev/null +++ b/.github/workflows/hermes-linux.yml @@ -0,0 +1,83 @@ +name: Hermes Linux Build + +on: + workflow_dispatch: + schedule: + # Run every day at 1:00 + - cron: '0 1 1,15 * *' + push: + +jobs: + collect_remote_release: + name: Read latest release from build repo + runs-on: ubuntu-latest + outputs: + sha: ${{ steps.query_release.outputs.release }} + steps: + - name: Query latest release + id: query_release + run: | + latest=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/informalsystems/hermes/releases | jq -r '.[0].tag_name') + echo "release=$latest" >> "$GITHUB_OUTPUT" + + build: + name: Build + runs-on: ubuntu-latest + needs: [collect_remote_release] + permissions: + contents: write + steps: + - name: Check out repo + uses: actions/checkout@v3 + + - name: Install tools + run: | + sudo apt-get install curl jq -y + + - name: Setup environment + run: | + sudo apt install build-essential wget -y + + - name: Install Rust + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + + - name: Update PATH + run: | + echo "~/.cargo/bin" >> $GITHUB_PATH + cargo version + + - name: Clone and build Hermes + run: | + LAST_RELEASE=${{needs.collect_remote_release.outputs.release}} + git clone https://github.com/informalsystems/hermes.git + cd hermes + git checkout $LAST_RELEASE + export LDFLAGS="-extldflags=-static" + cargo build --release --bin hermes + cp target/release/hermes ~/hermes-linux + + - name: Print Hermes version + run: | + ~/hermes-linux version + + # Publish + - name: Remove old releases + uses: dev-drprasad/delete-older-releases@v0.2.1 + with: + keep_latest: 0 + delete_tag_pattern: "hermes-linux" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Add release + uses: ncipollo/release-action@v1 + with: + artifacts: "~/hermes-linux" + name: "Hermes ${{needs.collect_remote_release.outputs.release}}" + bodyFile: .github/workflows/hermes-linux-body.md + prerelease: true + replacesArtifacts: false + allowUpdates: false + tag: "hermes-linux" + token: ${{ secrets.GITHUB_TOKEN }} From b76dad0074e00bd516069d97f091a25bca74dedf Mon Sep 17 00:00:00 2001 From: Dante Sanchez Date: Tue, 11 Jul 2023 16:18:07 -0400 Subject: [PATCH 02/17] run sh with -y --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index bf1a1d5..b4894f9 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -40,7 +40,7 @@ jobs: - name: Install Rust run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -y - name: Update PATH run: | From 0799383423f4f51da3356c7c247fff5c3a6096c1 Mon Sep 17 00:00:00 2001 From: Dante Sanchez Date: Tue, 11 Jul 2023 16:19:08 -0400 Subject: [PATCH 03/17] -y option --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index b4894f9..ca32ff8 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -40,7 +40,7 @@ jobs: - name: Install Rust run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -y + curl --proto '=https' --tlsv1.2 -sSfy https://sh.rustup.rs | sh - name: Update PATH run: | From 00cdeee6c1c21d8b7d231ed78fb8e4a1a14acc51 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Tue, 11 Jul 2023 22:47:25 -0400 Subject: [PATCH 04/17] rust static build --- .github/workflows/hermes-linux.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index ca32ff8..c932717 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -36,7 +36,7 @@ jobs: - name: Setup environment run: | - sudo apt install build-essential wget -y + sudo apt install build-essential wget pkg-config musl-tools -y - name: Install Rust run: | @@ -53,9 +53,10 @@ jobs: git clone https://github.com/informalsystems/hermes.git cd hermes git checkout $LAST_RELEASE - export LDFLAGS="-extldflags=-static" + rustup target add x86_64-unknown-linux-musl cargo build --release --bin hermes - cp target/release/hermes ~/hermes-linux + cargo build --target x86_64-unknown-linux-musl --release --bin hermes + cp target/x86_64-unknown-linux-musl/release/hermes ~/hermes-linux - name: Print Hermes version run: | From 06b3afaa3b2582502d12f472ab520cb873abc88b Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 12:08:08 -0400 Subject: [PATCH 05/17] try building on debian runner --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index c932717..9ef3cdb 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -22,7 +22,7 @@ jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: self-hosted-debian-11 needs: [collect_remote_release] permissions: contents: write From e2031e35ef8dc1c18f16cf1222e469d8dd667846 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 13:08:31 -0400 Subject: [PATCH 06/17] apt update --- .github/workflows/hermes-linux.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index 9ef3cdb..1222407 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -30,6 +30,11 @@ jobs: - name: Check out repo uses: actions/checkout@v3 + - name: update apt + run: | + sudo apt update + sudo apt dist-upgrade -y + - name: Install tools run: | sudo apt-get install curl jq -y From 125c215649b97917a92d7f7a318156f0841cee34 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 13:10:04 -0400 Subject: [PATCH 07/17] update curl command --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index 1222407..2a53713 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -45,7 +45,7 @@ jobs: - name: Install Rust run: | - curl --proto '=https' --tlsv1.2 -sSfy https://sh.rustup.rs | sh + curl https://sh.rustup.rs | sh - name: Update PATH run: | From e97f1760a3a4fa890169c53e51bde01f175f3cc5 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 13:12:56 -0400 Subject: [PATCH 08/17] update curl command --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index 2a53713..7082a62 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -45,7 +45,7 @@ jobs: - name: Install Rust run: | - curl https://sh.rustup.rs | sh + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - name: Update PATH run: | From 3fb077bd029e2787e09c6e3219ca7083cac817c5 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 13:15:29 -0400 Subject: [PATCH 09/17] set cargo path --- .github/workflows/hermes-linux.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index 7082a62..f6e6c1a 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -50,10 +50,12 @@ jobs: - name: Update PATH run: | echo "~/.cargo/bin" >> $GITHUB_PATH + source "$HOME/.cargo/env" cargo version - name: Clone and build Hermes run: | + source "$HOME/.cargo/env" LAST_RELEASE=${{needs.collect_remote_release.outputs.release}} git clone https://github.com/informalsystems/hermes.git cd hermes From 6efc53f63eefeb0e282b9dacd3f2ced11015b843 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 13:40:38 -0400 Subject: [PATCH 10/17] do not build static --- .github/workflows/hermes-linux.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index f6e6c1a..ab82dd9 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -60,10 +60,10 @@ jobs: git clone https://github.com/informalsystems/hermes.git cd hermes git checkout $LAST_RELEASE - rustup target add x86_64-unknown-linux-musl + #rustup target add x86_64-unknown-linux-musl cargo build --release --bin hermes - cargo build --target x86_64-unknown-linux-musl --release --bin hermes - cp target/x86_64-unknown-linux-musl/release/hermes ~/hermes-linux + #cargo build --target x86_64-unknown-linux-musl --release --bin hermes + cp target/release/hermes ~/hermes-linux - name: Print Hermes version run: | From 24d0e08818e007ddbc78f51e90e142631ef844f1 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 14:03:45 -0400 Subject: [PATCH 11/17] ubuntu static build --- .github/workflows/hermes-linux.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index ab82dd9..ac2fe2b 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -22,7 +22,7 @@ jobs: build: name: Build - runs-on: self-hosted-debian-11 + runs-on: ubuntu-latest needs: [collect_remote_release] permissions: contents: write @@ -60,9 +60,9 @@ jobs: git clone https://github.com/informalsystems/hermes.git cd hermes git checkout $LAST_RELEASE - #rustup target add x86_64-unknown-linux-musl - cargo build --release --bin hermes - #cargo build --target x86_64-unknown-linux-musl --release --bin hermes + rustup target add x86_64-unknown-linux-musl + #cargo build --release --bin hermes + cargo build --target x86_64-unknown-linux-musl --release --bin hermes cp target/release/hermes ~/hermes-linux - name: Print Hermes version From cbabddb014503de97a7fb4ffc2e84198a790628e Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 14:24:40 -0400 Subject: [PATCH 12/17] copy correct release binary --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index ac2fe2b..e4553f0 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -63,7 +63,7 @@ jobs: rustup target add x86_64-unknown-linux-musl #cargo build --release --bin hermes cargo build --target x86_64-unknown-linux-musl --release --bin hermes - cp target/release/hermes ~/hermes-linux + cp target/x86_64-unknown-linux-musl/release/hermes ~/hermes-linux - name: Print Hermes version run: | From 90d48682b93a490af34742f5b0ea1bb023780da6 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 14:57:50 -0400 Subject: [PATCH 13/17] build on debian --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index e4553f0..6ec852d 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -22,7 +22,7 @@ jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: self-hosted-debian-11 needs: [collect_remote_release] permissions: contents: write From dd1832573c6fad23d737bee900c59ef08a17eb66 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 15:03:28 -0400 Subject: [PATCH 14/17] change back to ubuntu --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index 6ec852d..e4553f0 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -22,7 +22,7 @@ jobs: build: name: Build - runs-on: self-hosted-debian-11 + runs-on: ubuntu-latest needs: [collect_remote_release] permissions: contents: write From ed2e19917f78a2f0ee19c9cf5501ceffdbf4d317 Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 15:10:06 -0400 Subject: [PATCH 15/17] copy static path --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index e4553f0..b0a75ef 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -60,7 +60,7 @@ jobs: git clone https://github.com/informalsystems/hermes.git cd hermes git checkout $LAST_RELEASE - rustup target add x86_64-unknown-linux-musl + #rustup target add x86_64-unknown-linux-musl #cargo build --release --bin hermes cargo build --target x86_64-unknown-linux-musl --release --bin hermes cp target/x86_64-unknown-linux-musl/release/hermes ~/hermes-linux From 11ab679c35d60826a7aec6807484ea0d8d0171ad Mon Sep 17 00:00:00 2001 From: ASoTNetworks Date: Wed, 12 Jul 2023 15:14:40 -0400 Subject: [PATCH 16/17] set static target --- .github/workflows/hermes-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index b0a75ef..e4553f0 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -60,7 +60,7 @@ jobs: git clone https://github.com/informalsystems/hermes.git cd hermes git checkout $LAST_RELEASE - #rustup target add x86_64-unknown-linux-musl + rustup target add x86_64-unknown-linux-musl #cargo build --release --bin hermes cargo build --target x86_64-unknown-linux-musl --release --bin hermes cp target/x86_64-unknown-linux-musl/release/hermes ~/hermes-linux From da7b901939aa78c1abcbbb88b08c3506a8dcd56c Mon Sep 17 00:00:00 2001 From: Dante Sanchez Date: Thu, 28 Sep 2023 11:48:52 -0400 Subject: [PATCH 17/17] do not run on push or schedule --- .github/workflows/hermes-linux.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/hermes-linux.yml b/.github/workflows/hermes-linux.yml index e4553f0..aa58e36 100644 --- a/.github/workflows/hermes-linux.yml +++ b/.github/workflows/hermes-linux.yml @@ -2,11 +2,6 @@ name: Hermes Linux Build on: workflow_dispatch: - schedule: - # Run every day at 1:00 - - cron: '0 1 1,15 * *' - push: - jobs: collect_remote_release: name: Read latest release from build repo