From ab86ee556b63b1027632d4c5bf29728e11f606d3 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 13:58:37 +0200 Subject: [PATCH 01/15] [ci] Move CI to GHA --- .github/workflows/ci.yml | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4efb7ac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +# common variable is defined in the workflow +# repo env variable doesn't work for PR from forks +env: + CI_IMAGE: "paritytech/ci-unified:bullseye-1.75.0-2024-01-22-v20240222" + +jobs: + set-image: + # This workaround sets the container image for each job using 'set-image' job output. + # env variables don't work for PR from forks, so we need to use outputs. + runs-on: ubuntu-latest + outputs: + CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }} + steps: + - id: set_image + run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT + fmt: + name: Cargo fmt + runs-on: ubuntu-latest + needs: [set-image] + container: + image: ${{ needs.set-image.outputs.CI_IMAGE }} + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Rust Cache + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + cache-on-failure: true + cache-all-crates: true + + - name: Cargo fmt + run: cargo +nightly fmt --all -- --check + build-test-linux: + name: Build Linux + runs-on: parity-large + needs: [set-image] + container: + image: ${{ needs.set-image.outputs.CI_IMAGE }} + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Rust Cache + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + cache-on-failure: true + cache-all-crates: true + + - name: Build and Test Linux + run: | + cargo build --release + cargo test --release --all From 54b1096a86252efb3ae726292a2698b98d18e292 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 14:00:27 +0200 Subject: [PATCH 02/15] fix branch name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4efb7ac..8803680 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - master + - main pull_request: types: [opened, synchronize, reopened, ready_for_review] From ae51137a10da53791fbcf4eda22f08e32cdb388f Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 14:12:52 +0200 Subject: [PATCH 03/15] add macos jobs --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8803680..abf8f5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,12 +29,12 @@ jobs: fmt: name: Cargo fmt runs-on: ubuntu-latest + timeout-minutes: 5 needs: [set-image] container: image: ${{ needs.set-image.outputs.CI_IMAGE }} steps: - - name: Checkout sources - uses: actions/checkout@v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Rust Cache uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 @@ -47,12 +47,12 @@ jobs: build-test-linux: name: Build Linux runs-on: parity-large + timeout-minutes: 30 needs: [set-image] container: image: ${{ needs.set-image.outputs.CI_IMAGE }} steps: - - name: Checkout sources - uses: actions/checkout@v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Rust Cache uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 @@ -64,3 +64,41 @@ jobs: run: | cargo build --release cargo test --release --all + + build-macos: + timeout-minutes: 30 + runs-on: parity-macos + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Set rust version from env file + run: | + echo $CI_IMAGE + RUST_VERSION=$(echo $CI_IMAGE | sed -E 's/.*ci-unified:([^-]+)-([^-]+).*/\2/') + echo $RUST_VERSION + echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@1ccc07ccd54b6048295516a3eb89b192c35057dc # master from 12.09.2024 + - name: Install rust ${{ env.RUST_VERSION }} + uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 + with: + cache: false + toolchain: ${{ env.RUST_VERSION }} + target: wasm32-unknown-unknown,aarch64-apple-darwin,x86_64-apple-darwin + components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std + - name: cargo info + run: | + echo "######## rustup show ########" + rustup show + echo "######## cargo --version ########" + cargo --version + - name: Run cargo build + run: | + # rustup component add rust-src rustfmt + # rustup target add wasm32-unknown-unknown aarch64-apple-darwin + time cargo build --release --target aarch64-apple-darwin + # rustup target add x86_64-apple-darwin + time cargo build --release --target x86_64-apple-darwin + mkdir -p ./artifacts/substrate-contracts-node-mac/ + lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ + ./target/aarch64-apple-darwin/release/substrate-contracts-node \ + -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node From bc2995984cbf462b25bf3fefbfe8b7b79bf6a58d Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 14:13:51 +0200 Subject: [PATCH 04/15] add cache --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abf8f5c..0bee8c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,6 +91,11 @@ jobs: rustup show echo "######## cargo --version ########" cargo --version + - name: Rust Cache + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + cache-on-failure: true + cache-all-crates: true - name: Run cargo build run: | # rustup component add rust-src rustfmt From f1ac2c8394ab76cbdca18aed5950f629deb84b1f Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 14:24:45 +0200 Subject: [PATCH 05/15] install protobuf --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bee8c1..a4bb52f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,6 +78,8 @@ jobs: echo "RUST_VERSION=${RUST_VERSION}" >> $GITHUB_ENV - name: Set up Homebrew uses: Homebrew/actions/setup-homebrew@1ccc07ccd54b6048295516a3eb89b192c35057dc # master from 12.09.2024 + - name: Install protobuf + run: brew install protobuf - name: Install rust ${{ env.RUST_VERSION }} uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0 with: From fa949d1785c420007373c9428997ee00fce7e5ed Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 16:02:31 +0200 Subject: [PATCH 06/15] collect artifacts --- .github/workflows/ci.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4bb52f..f547862 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: steps: - id: set_image run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT + fmt: name: Cargo fmt runs-on: ubuntu-latest @@ -35,15 +36,14 @@ jobs: image: ${{ needs.set-image.outputs.CI_IMAGE }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Rust Cache uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 with: cache-on-failure: true cache-all-crates: true - - name: Cargo fmt run: cargo +nightly fmt --all -- --check + build-test-linux: name: Build Linux runs-on: parity-large @@ -53,18 +53,22 @@ jobs: image: ${{ needs.set-image.outputs.CI_IMAGE }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Rust Cache uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 with: cache-on-failure: true cache-all-crates: true - - name: Build and Test Linux run: | cargo build --release cargo test --release --all - + mkdir -p ./artifacts/substrate-contracts-node-linux/ + cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node + - name: Upload artifacts + uses: actions/upload-artifact@v4.3.6 + with: + name: build-linux + path: ./artifacts build-macos: timeout-minutes: 30 runs-on: parity-macos @@ -100,12 +104,14 @@ jobs: cache-all-crates: true - name: Run cargo build run: | - # rustup component add rust-src rustfmt - # rustup target add wasm32-unknown-unknown aarch64-apple-darwin time cargo build --release --target aarch64-apple-darwin - # rustup target add x86_64-apple-darwin time cargo build --release --target x86_64-apple-darwin mkdir -p ./artifacts/substrate-contracts-node-mac/ lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ ./target/aarch64-apple-darwin/release/substrate-contracts-node \ -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node + - name: Upload artifacts + uses: actions/upload-artifact@v4.3.6 + with: + name: build-macos + path: ./artifacts From 32391a0db1cbb2d0d5efdd8e04ee52ad34c9dc05 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 20:50:22 +0200 Subject: [PATCH 07/15] divide mac into 2 jobs --- .github/workflows/ci.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f547862..ee39f38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,6 +72,10 @@ jobs: build-macos: timeout-minutes: 30 runs-on: parity-macos + strategy: + fail-fast: true + matrix: + target: [aarch64-apple-darwin, x86_64-apple-darwin] steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set rust version from env file @@ -89,7 +93,7 @@ jobs: with: cache: false toolchain: ${{ env.RUST_VERSION }} - target: wasm32-unknown-unknown,aarch64-apple-darwin,x86_64-apple-darwin + target: wasm32-unknown-unknown, ${{ matrix.target }} components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std - name: cargo info run: | @@ -104,12 +108,13 @@ jobs: cache-all-crates: true - name: Run cargo build run: | - time cargo build --release --target aarch64-apple-darwin - time cargo build --release --target x86_64-apple-darwin - mkdir -p ./artifacts/substrate-contracts-node-mac/ - lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ - ./target/aarch64-apple-darwin/release/substrate-contracts-node \ - -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node + cargo build --release --target ${{ matrix.target }} + # cargo build --release --target aarch64-apple-darwin + # cargo build --release --target x86_64-apple-darwin + # mkdir -p ./artifacts/substrate-contracts-node-mac/ + # lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ + # ./target/aarch64-apple-darwin/release/substrate-contracts-node \ + # -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node - name: Upload artifacts uses: actions/upload-artifact@v4.3.6 with: From bbf02490c1873e2a94d523f40ec39a5dbaf66dae Mon Sep 17 00:00:00 2001 From: alvicsam Date: Mon, 23 Sep 2024 21:29:42 +0200 Subject: [PATCH 08/15] disable matrix --- .github/workflows/ci.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee39f38..3b31951 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,10 +72,6 @@ jobs: build-macos: timeout-minutes: 30 runs-on: parity-macos - strategy: - fail-fast: true - matrix: - target: [aarch64-apple-darwin, x86_64-apple-darwin] steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set rust version from env file @@ -93,7 +89,7 @@ jobs: with: cache: false toolchain: ${{ env.RUST_VERSION }} - target: wasm32-unknown-unknown, ${{ matrix.target }} + target: wasm32-unknown-unknown, aarch64-apple-darwin, x86_64-apple-darwin components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std - name: cargo info run: | @@ -108,13 +104,12 @@ jobs: cache-all-crates: true - name: Run cargo build run: | - cargo build --release --target ${{ matrix.target }} - # cargo build --release --target aarch64-apple-darwin - # cargo build --release --target x86_64-apple-darwin - # mkdir -p ./artifacts/substrate-contracts-node-mac/ - # lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ - # ./target/aarch64-apple-darwin/release/substrate-contracts-node \ - # -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node + cargo build --release --target aarch64-apple-darwin + cargo build --release --target x86_64-apple-darwin + mkdir -p ./artifacts/substrate-contracts-node-mac/ + lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ + ./target/aarch64-apple-darwin/release/substrate-contracts-node \ + -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node - name: Upload artifacts uses: actions/upload-artifact@v4.3.6 with: From a151bc4092ff5b9e1e6f8846baba21a20607e484 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 24 Sep 2024 10:28:34 +0200 Subject: [PATCH 09/15] add info to jobs and deps to fmt --- .github/workflows/ci.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b31951..16a53c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,12 @@ jobs: with: cache-on-failure: true cache-all-crates: true + - name: cargo info + run: | + echo "######## rustup show ########" + rustup show + echo "######## cargo --version ########" + cargo --version - name: Cargo fmt run: cargo +nightly fmt --all -- --check @@ -48,7 +54,7 @@ jobs: name: Build Linux runs-on: parity-large timeout-minutes: 30 - needs: [set-image] + needs: [set-image, fmt] container: image: ${{ needs.set-image.outputs.CI_IMAGE }} steps: @@ -58,12 +64,22 @@ jobs: with: cache-on-failure: true cache-all-crates: true + - name: cargo info + run: | + echo "######## rustup show ########" + rustup show + echo "######## cargo --version ########" + cargo --version - name: Build and Test Linux run: | + echo "######## cargo build ########" cargo build --release + echo "######## cargo test ########" cargo test --release --all + echo "######## Packing artifacts ########" mkdir -p ./artifacts/substrate-contracts-node-linux/ cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node + ls -la ./artifacts/substrate-contracts-node-linux/ - name: Upload artifacts uses: actions/upload-artifact@v4.3.6 with: @@ -72,6 +88,7 @@ jobs: build-macos: timeout-minutes: 30 runs-on: parity-macos + needs: [fmt] steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set rust version from env file @@ -104,12 +121,16 @@ jobs: cache-all-crates: true - name: Run cargo build run: | + echo "######## cargo build aarch64-apple-darwin ########" cargo build --release --target aarch64-apple-darwin + echo "######## cargo build x86_64-apple-darwin ########" cargo build --release --target x86_64-apple-darwin + echo "######## Packing artifacts ########" mkdir -p ./artifacts/substrate-contracts-node-mac/ lipo ./target/x86_64-apple-darwin/release/substrate-contracts-node \ ./target/aarch64-apple-darwin/release/substrate-contracts-node \ -create -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node + ls -la ./artifacts/substrate-contracts-node-mac/ - name: Upload artifacts uses: actions/upload-artifact@v4.3.6 with: From 58859ccc1a51ad05a21eed75688c22b0de5cc98e Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 24 Sep 2024 15:27:13 +0200 Subject: [PATCH 10/15] fix readme, publish draft, rm gitlab-ci --- .github/workflows/ci.yml | 28 +++++++ .gitlab-ci.yml | 165 --------------------------------------- README.md | 12 ++- 3 files changed, 36 insertions(+), 169 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16a53c1..07f7a9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,3 +136,31 @@ jobs: with: name: build-macos path: ./artifacts + publish: + name: Publish release + runs-on: ubuntu-latest + needs: [build-test-linux, build-macos] + permissions: + contents: write + steps: + - uses: actions/checkout@v4.1.7 + - uses: actions/download-artifact@v4 + with: + name: build-linux + - uses: actions/download-artifact@v4 + with: + name: build-mac + - name: Pack artifacts + run: | + tar -czvf ./substrate-contracts-node-linux.tar.gz ./substrate-contracts-node-linux + tar -czvf ./substrate-contracts-node-mac-universal.tar.gz ./substrate-contracts-node-mac + ls -la + - name: Publish release + uses: ghalactic/github-release-from-tag@v5 + if: github.ref_type == 'tag' + with: + prerelease: false + draft: true + assets: | + - path: substrate-contracts-node-linux.tar.gz + - path: substrate-contracts-node-mac-universal.tar.gz diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 2bfc1ef..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,165 +0,0 @@ -# .gitlab-ci.yml -# -# substrate-contracts-node -# -# pipelines can be triggered manually in the web - -default: - interruptible: true - retry: - max: 2 - when: - - runner_system_failure - - unknown_failure - - api_failure - -stages: - - fmt - - build-linux - - build-mac - - publish - -variables: - GIT_STRATEGY: fetch - GIT_DEPTH: 100 - CARGO_INCREMENTAL: 0 - -.collect-artifacts: &collect-artifacts - artifacts: - name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" - when: on_success - expire_in: 7 days - paths: - - artifacts/ - -.docker-env: &docker-env - image: paritytech/ci-unified:latest - before_script: - - cargo -vV - - rustc -vV - - rustup show - - bash --version - tags: - - linux-docker-vm-c2 - -.kubernetes-env: &kubernetes-env - tags: - - kubernetes-parity-build - -.build-refs: &build-refs - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_REF_NAME == "main" - - if: $CI_COMMIT_REF_NAME == "tags" - - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 - -.publish-refs: &publish-refs - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 - -### stage: fmt - -fmt: - stage: fmt - <<: *docker-env - script: - - cargo +nightly fmt --verbose --all -- --check - -### stage: build-linux - -build-linux: - stage: build-linux - <<: *docker-env - <<: *collect-artifacts - <<: *build-refs - script: - - time cargo build --release - - time cargo test --release --all - - mkdir -p ./artifacts/substrate-contracts-node-linux/ - - cp target/release/substrate-contracts-node ./artifacts/substrate-contracts-node-linux/substrate-contracts-node - -### stage: build-mac - -build-mac: - stage: build-mac - <<: *docker-env - <<: *collect-artifacts - <<: *build-refs - before_script: - - unset CARGO_TARGET_DIR - script: - - rustup component add rust-src rustfmt - - rustup target add wasm32-unknown-unknown aarch64-apple-darwin - - time cargo build --release --target aarch64-apple-darwin - - rustup target add x86_64-apple-darwin - - time cargo build --release --target x86_64-apple-darwin - - mkdir -p ./artifacts/substrate-contracts-node-mac/ - - 'lipo - ./target/x86_64-apple-darwin/release/substrate-contracts-node - ./target/aarch64-apple-darwin/release/substrate-contracts-node - -create - -output ./artifacts/substrate-contracts-node-mac/substrate-contracts-node' - tags: - - osx - -publish: - stage: publish - <<: *kubernetes-env - image: paritytech/tools:latest - <<: *publish-refs - needs: - - job: build-linux - artifacts: true - - job: build-mac - artifacts: true - script: - - git describe --tags - - TAG_NAME=`git describe --tags` - - echo "tag name ${TAG_NAME}" - - tar -czvf ./substrate-contracts-node-linux.tar.gz ./artifacts/substrate-contracts-node-linux/substrate-contracts-node - - tar -czvf ./substrate-contracts-node-mac-universal.tar.gz ./artifacts/substrate-contracts-node-mac/substrate-contracts-node - - 'curl https://api.github.com/repos/paritytech/substrate-contracts-node/releases - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}"' - - 'curl https://api.github.com/repos/paritytech/substrate-contracts-node/releases - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" | jq .' - - 'RELEASE_ID=$(curl https://api.github.com/repos/paritytech/substrate-contracts-node/releases - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - | jq -r ".[] | select(.tag_name == \"$TAG_NAME\") | .id"); - echo "release id if existent: ${RELEASE_ID}"' - - 'if [ -z "$RELEASE_ID" ]; then - RESP=$(curl -X "POST" "https://api.github.com/repos/paritytech/substrate-contracts-node/releases" - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - -H "Content-Type: application/json; charset=utf-8" - -d $"{ - \"tag_name\": \"${TAG_NAME}\", - \"name\": \"${TAG_NAME}\", - \"prerelease\": false, - \"draft\": true - }"); - echo "api response ${RESP}"; - RELEASE_ID=$(echo $RESP | jq -r .id); - echo "release id of created release ${RELEASE_ID}"; - fi' - - echo "release id ${RELEASE_ID}" - - 'curl -X "POST" "https://uploads.github.com/repos/paritytech/substrate-contracts-node/releases/$RELEASE_ID/assets?name=substrate-contracts-node-linux.tar.gz" - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - -H "Content-Type: application/octet-stream" - --data-binary @"./substrate-contracts-node-linux.tar.gz"' - - 'curl -X "POST" "https://uploads.github.com/repos/paritytech/substrate-contracts-node/releases/$RELEASE_ID/assets?name=substrate-contracts-node-mac-universal.tar.gz" - --fail-with-body - -H "Cookie: logged_in=no" - -H "Authorization: token ${GITHUB_TOKEN}" - -H "Content-Type: application/octet-stream" - --data-binary @"./substrate-contracts-node-mac-universal.tar.gz"' diff --git a/README.md b/README.md index d366a05..2810629 100644 --- a/README.md +++ b/README.md @@ -110,11 +110,15 @@ We can have two types of releases: Note: Before uploading, perform a dry run to ensure that it will be successful. - [ ] Merge the release PR branch. - [ ] Replace `XX` in this command with your incremented version number and execute it: - `git checkout main && git pull && git tag v0.XX.0 && git push origin v0.XX.0`. + ```bash + TAG="v0.XX.0" + git checkout main + git pull + git tag -a ${TAG} -m "${TAG}" + git push origin ${TAG} + ``` This will push a new tag with the version number to this repository. -- [ ] We have set this repository up in a way that tags à la `vX.X.X` trigger - a CI run that creates a GitHub draft release. You can observe CI runs on - [GitLab](https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/pipelines). +- [ ] After tag is pushed CI creates a GitHub draft release. This draft release will contain a binary for Linux and Mac and appear under [Releases](https://github.com/paritytech/substrate-contracts-node/releases). Add a description in the style of "Synchronized with [`polkadot-v1.8.0`](https://github.com/paritytech/polkadot-sdk/tree/release-polkadot-v1.8.0) branch." From 22d11c3579c09a2ac4b2005f676ac4080ca07190 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 24 Sep 2024 15:27:56 +0200 Subject: [PATCH 11/15] rm gitspiegel trigger --- .github/workflows/gitspiegel-trigger.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/workflows/gitspiegel-trigger.yml diff --git a/.github/workflows/gitspiegel-trigger.yml b/.github/workflows/gitspiegel-trigger.yml deleted file mode 100644 index dce3aaf..0000000 --- a/.github/workflows/gitspiegel-trigger.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: gitspiegel sync - -# This workflow doesn't do anything, it's only use is to trigger "workflow_run" -# webhook, that'll be consumed by gitspiegel -# This way, gitspiegel won't do mirroring, unless this workflow runs, -# and running the workflow is protected by GitHub - -on: - pull_request: - types: - - opened - - synchronize - - unlocked - - ready_for_review - - reopened - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Do nothing - run: echo "let's go" From 5e6a4eabfeb01d7df93d8a67034a3dd1f3458197 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 24 Sep 2024 15:31:41 +0200 Subject: [PATCH 12/15] fix readme --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2810629..ef3e9f7 100644 --- a/README.md +++ b/README.md @@ -109,15 +109,17 @@ We can have two types of releases: `cargo release 0.XX.0 -v --no-tag --no-push -p contracts-node --execute` Note: Before uploading, perform a dry run to ensure that it will be successful. - [ ] Merge the release PR branch. -- [ ] Replace `XX` in this command with your incremented version number and execute it: - ```bash - TAG="v0.XX.0" - git checkout main - git pull - git tag -a ${TAG} -m "${TAG}" - git push origin ${TAG} - ``` - This will push a new tag with the version number to this repository. +- [ ] Set the tag and run the following commands to push the tag. The tag must contain a message, otherwise the github action won't be able to create a release: + +```bash +TAG="v0.XX.0" +git checkout main +git pull +git tag -a ${TAG} -m "${TAG}" +git push origin ${TAG} +``` + + - [ ] After tag is pushed CI creates a GitHub draft release. This draft release will contain a binary for Linux and Mac and appear under [Releases](https://github.com/paritytech/substrate-contracts-node/releases). From 1a647cb4d53da42ad5d4edc6a9465c5f644313e3 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 24 Sep 2024 15:56:02 +0200 Subject: [PATCH 13/15] pin version --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07f7a9e..8d05942 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,11 +143,11 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v4.1.7 - - uses: actions/download-artifact@v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: build-linux - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: build-mac - name: Pack artifacts @@ -156,7 +156,7 @@ jobs: tar -czvf ./substrate-contracts-node-mac-universal.tar.gz ./substrate-contracts-node-mac ls -la - name: Publish release - uses: ghalactic/github-release-from-tag@v5 + uses: ghalactic/github-release-from-tag@cebdacac0ccd08933b8e7f278f4123723ad978eb # v5.4.0 if: github.ref_type == 'tag' with: prerelease: false From b2c6a88bf48f3fab1f66c61c6193706baf13dda0 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Tue, 24 Sep 2024 16:52:01 +0200 Subject: [PATCH 14/15] more time for macos --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d05942..bb83338 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: build-test-linux: name: Build Linux runs-on: parity-large - timeout-minutes: 30 + timeout-minutes: 50 needs: [set-image, fmt] container: image: ${{ needs.set-image.outputs.CI_IMAGE }} From f35369c7e5daea380eba70acdb8bf43daa8de643 Mon Sep 17 00:00:00 2001 From: alvicsam Date: Wed, 25 Sep 2024 10:48:09 +0200 Subject: [PATCH 15/15] fix artifact name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb83338..bb4e40c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,7 +149,7 @@ jobs: name: build-linux - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - name: build-mac + name: build-macos - name: Pack artifacts run: | tar -czvf ./substrate-contracts-node-linux.tar.gz ./substrate-contracts-node-linux