From 1af43f0e4dfa048be3c9a84cc434f7d45f812225 Mon Sep 17 00:00:00 2001 From: gera Date: Mon, 19 Aug 2024 11:16:54 +0200 Subject: [PATCH 01/50] test mounting cargo cache --- .github/workflows/cargo-clippy.yml | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/cargo-clippy.yml diff --git a/.github/workflows/cargo-clippy.yml b/.github/workflows/cargo-clippy.yml new file mode 100644 index 000000000..99c8b6974 --- /dev/null +++ b/.github/workflows/cargo-clippy.yml @@ -0,0 +1,44 @@ +name: Build and Deploy Chain docs + +on: + push: + branches: + - github-runner + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-clippy- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and Deploy in Container + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c " + RUSTDOCFLAGS='-D warnings' SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --quiet" From 0b98788f715be874c192d9454b149b92def1d451 Mon Sep 17 00:00:00 2001 From: gera Date: Mon, 19 Aug 2024 12:05:54 +0200 Subject: [PATCH 02/50] fix permission --- .github/workflows/cargo-clippy.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cargo-clippy.yml b/.github/workflows/cargo-clippy.yml index 99c8b6974..8daa133a5 100644 --- a/.github/workflows/cargo-clippy.yml +++ b/.github/workflows/cargo-clippy.yml @@ -1,4 +1,4 @@ -name: Build and Deploy Chain docs +name: Cargo Clippy on: push: @@ -6,7 +6,7 @@ on: - github-runner jobs: - build-and-deploy: + cargo-clippy: runs-on: ubuntu-latest steps: - name: Free Disk Space @@ -41,4 +41,5 @@ jobs: -w /workspace \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - RUSTDOCFLAGS='-D warnings' SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --quiet" + RUSTDOCFLAGS='-D warnings' SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --quiet && \ + chown -R $(id -u):$(id -g) target/" From ad2819bddecf691d3206e003529c3e6e9177405e Mon Sep 17 00:00:00 2001 From: gera Date: Mon, 19 Aug 2024 16:13:34 +0200 Subject: [PATCH 03/50] build images in gh --- .github/workflows/build-images.yml | 86 ++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/build-images.yml diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml new file mode 100644 index 000000000..ff380ef3b --- /dev/null +++ b/.github/workflows/build-images.yml @@ -0,0 +1,86 @@ +name: Build Images + +on: + push: + branches: + - github-runner + +jobs: + build-images: + runs-on: ubuntu-latest + timeout-minutes: 120 + env: + DOCKER_HUB_PARACHAIN: kiltprotocol/kilt-node + DOCKER_HUB_STANDALONE: kiltprotocol/standalone-node + DOCKER_HUB_DIP_PROVIDER_TEMPLATE: kiltprotocol/dip-provider-node-template + DOCKER_HUB_DIP_CONSUMER_TEMPLATE: kiltprotocol/dip-consumer-node-template + AWS_REGISTRY: ${{ secrets.ECR_REGISTRY }} + CI_COMMIT_SHORT_SHA: ${{ github.sha }} + CI_COMMIT_BRANCH: ${{ github.ref_name }} + CI_COMMIT_TAG: ${{ github.ref_name }} + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-build-images-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-build-images- + + - name: Display AWS and Docker Versions + run: | + aws --version + docker --version + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.ECR_ROLE }} + aws-region: ${{ secrets.ECR_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build Docker Images + run: | + ./.maintain/build-image.sh build + + - name: Push Image - Commit SHA + if: github.ref_type == 'branch' + run: | + ./.maintain/push-image.sh build "${{ env.CI_COMMIT_SHORT_SHA }}" + + - name: Push Image - Latest Branch + if: github.ref_type == 'branch' + run: | + ./.maintain/push-image.sh build "latest-${{ env.CI_COMMIT_BRANCH }}" + + - name: Push Image - Tag + if: startsWith(github.ref, 'refs/tags/') + run: | + ./.maintain/push-image.sh build "${{ env.CI_COMMIT_TAG }}" + + - name: Push Image - Latest + if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-rc') && !contains(github.ref, 'dev-') + run: | + ./.maintain/push-image.sh build "latest" From 0b90a1e8c18cb66e3b44b8f8bc3b62993587b17a Mon Sep 17 00:00:00 2001 From: gera Date: Mon, 19 Aug 2024 16:20:42 +0200 Subject: [PATCH 04/50] fix ecr login --- .github/workflows/build-images.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index ff380ef3b..22aa0e99f 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -51,15 +51,12 @@ jobs: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 + - name: Login to ECR + uses: docker/login-action@v3 with: - role-to-assume: ${{ secrets.ECR_ROLE }} - aws-region: ${{ secrets.ECR_REGION }} - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 + registry: ${{ secrets.ECR_REGISTRY }} + username: ${{ secrets.AWS_ACCESS_KEY_ID }} + password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Build Docker Images run: | From d535977c0a4a722074e7569d34705ba50672d936 Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 10:39:25 +0200 Subject: [PATCH 05/50] macos runner --- .github/workflows/build-images.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 22aa0e99f..7d33de5c4 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -7,7 +7,7 @@ on: jobs: build-images: - runs-on: ubuntu-latest + runs-on: macos-13 timeout-minutes: 120 env: DOCKER_HUB_PARACHAIN: kiltprotocol/kilt-node @@ -19,27 +19,9 @@ jobs: CI_COMMIT_BRANCH: ${{ github.ref_name }} CI_COMMIT_TAG: ${{ github.ref_name }} steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - name: Checkout uses: actions/checkout@v4 - - name: Set up Cargo Cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-build-images-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-build-images- - - name: Display AWS and Docker Versions run: | aws --version From cd186f83747386d23290df2181679af5eead177f Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 10:58:06 +0200 Subject: [PATCH 06/50] run sequentially to release resouces --- .github/workflows/build-images.yml | 7 ++++++- .maintain/build-image.sh | 18 +++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 7d33de5c4..a1c6f22f9 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -7,7 +7,7 @@ on: jobs: build-images: - runs-on: macos-13 + runs-on: ubuntu-latest timeout-minutes: 120 env: DOCKER_HUB_PARACHAIN: kiltprotocol/kilt-node @@ -19,6 +19,11 @@ jobs: CI_COMMIT_BRANCH: ${{ github.ref_name }} CI_COMMIT_TAG: ${{ github.ref_name }} steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Checkout uses: actions/checkout@v4 diff --git a/.maintain/build-image.sh b/.maintain/build-image.sh index ad88929b4..09236f90e 100755 --- a/.maintain/build-image.sh +++ b/.maintain/build-image.sh @@ -4,17 +4,15 @@ set -e target_tag=$1 -# Build the builder image and push it in the background +# Build the builder image and push it sequentially docker build \ --target builder \ --cache-from $AWS_REGISTRY/kilt-parachain/collator:builder \ -t $AWS_REGISTRY/kilt-parachain/collator:builder \ - . & -docker push $AWS_REGISTRY/kilt-parachain/collator:builder & + . -wait +docker push $AWS_REGISTRY/kilt-parachain/collator:builder -# Build and tag images in parallel build_and_tag() { local node_type=$1 local image_name=$2 @@ -28,12 +26,10 @@ build_and_tag() { . } -build_and_tag "kilt-parachain" "kilt-node" "kilt-parachain/collator" & +build_and_tag "kilt-parachain" "kilt-node" "kilt-parachain/collator" -build_and_tag "standalone-node" "standalone-node" "kilt/prototype-chain" & +build_and_tag "standalone-node" "standalone-node" "kilt/prototype-chain" -build_and_tag "dip-provider-node-template" "dip-provider-node-template" "kilt-parachain/collator" & +build_and_tag "dip-provider-node-template" "dip-provider-node-template" "kilt-parachain/collator" -build_and_tag "dip-consumer-node-template" "dip-consumer-node-template" "kilt-parachain/collator" & - -wait +build_and_tag "dip-consumer-node-template" "dip-consumer-node-template" "kilt-parachain/collator" From 344fbc20b4629f341ea9085cb8f3abfb8003f92c Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 13:02:03 +0200 Subject: [PATCH 07/50] build release outside docker --- .github/workflows/build-images.yml | 4 +- .github/workflows/cargo-clippy.yml | 45 -------------- .../workflows/check-clippy-all-features.yml | 60 +++++++++++++++++++ .github/workflows/check-clippy.yml | 59 ++++++++++++++++++ .github/workflows/check-rustdoc.yml | 59 ++++++++++++++++++ .github/workflows/test-all-features.yml | 59 ++++++++++++++++++ .github/workflows/test.yml | 59 ++++++++++++++++++ Dockerfile | 17 +----- 8 files changed, 300 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/cargo-clippy.yml create mode 100644 .github/workflows/check-clippy-all-features.yml create mode 100644 .github/workflows/check-clippy.yml create mode 100644 .github/workflows/check-rustdoc.yml create mode 100644 .github/workflows/test-all-features.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index a1c6f22f9..047cfba6c 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -47,7 +47,9 @@ jobs: - name: Build Docker Images run: | - ./.maintain/build-image.sh build + cargo build --locked --release --features default + docker build -t kilt-node . + - name: Push Image - Commit SHA if: github.ref_type == 'branch' diff --git a/.github/workflows/cargo-clippy.yml b/.github/workflows/cargo-clippy.yml deleted file mode 100644 index 8daa133a5..000000000 --- a/.github/workflows/cargo-clippy.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Cargo Clippy - -on: - push: - branches: - - github-runner - -jobs: - cargo-clippy: - runs-on: ubuntu-latest - steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Cargo Cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-clippy- - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and Deploy in Container - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - RUSTDOCFLAGS='-D warnings' SKIP_WASM_BUILD=1 cargo clippy --all-targets --locked --quiet && \ - chown -R $(id -u):$(id -g) target/" diff --git a/.github/workflows/check-clippy-all-features.yml b/.github/workflows/check-clippy-all-features.yml new file mode 100644 index 000000000..29db35824 --- /dev/null +++ b/.github/workflows/check-clippy-all-features.yml @@ -0,0 +1,60 @@ +name: Check Clippy all-features + +on: + pull_request: + +jobs: + get-head-commit-msg: + runs-on: ubuntu-latest + outputs: + head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + + check-clippy-all-features: + runs-on: ubuntu-latest + needs: get-head-commit-msg + if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: $ ${{ github.job }}-${{ github.ref }}-clippy-all-features-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + $ ${{ github.job }}-${{ github.ref }}-clippy-all-features- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run Clippy + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c " + cargo clippy --all-targets --all-features --locked --quiet && \ + chown -R $(id -u):$(id -g) target/" + diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml new file mode 100644 index 000000000..91ed93801 --- /dev/null +++ b/.github/workflows/check-clippy.yml @@ -0,0 +1,59 @@ +name: Check Clippy + +on: + pull_request: + +jobs: + get-head-commit-msg: + runs-on: ubuntu-latest + outputs: + head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + + check-clippy: + runs-on: ubuntu-latest + needs: get-head-commit-msg + if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + $ ${{ github.job }}-${{ github.ref }}-clippy- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run Clippy + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c " + cargo clippy --all-targets --locked --quiet && \ + chown -R $(id -u):$(id -g) target/" diff --git a/.github/workflows/check-rustdoc.yml b/.github/workflows/check-rustdoc.yml new file mode 100644 index 000000000..b1a55db25 --- /dev/null +++ b/.github/workflows/check-rustdoc.yml @@ -0,0 +1,59 @@ +name: Cargo Clippy + +on: + pull_request: + +jobs: + get-head-commit-msg: + runs-on: ubuntu-latest + outputs: + head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + + check-clippy: + runs-on: ubuntu-latest + needs: get-head-commit-msg + if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: $ ${{ github.job }}-${{ github.ref }}-rustdoc-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + $ ${{ github.job }}-${{ github.ref }}-rustdoc- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run doc + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c " + cargo doc --all-features --no-deps --locked && \ + chown -R $(id -u):$(id -g) target/" diff --git a/.github/workflows/test-all-features.yml b/.github/workflows/test-all-features.yml new file mode 100644 index 000000000..2fd0514ee --- /dev/null +++ b/.github/workflows/test-all-features.yml @@ -0,0 +1,59 @@ +name: Check Clippy + +on: + pull_request: + +jobs: + get-head-commit-msg: + runs-on: ubuntu-latest + outputs: + head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + + check-clippy: + runs-on: ubuntu-latest + needs: get-head-commit-msg + if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + $ ${{ github.job }}-${{ github.ref }}-clippy- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run Clippy + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c " + cargo test --all-features --all-targets --locked && \ + chown -R $(id -u):$(id -g) target/" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..df0939479 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,59 @@ +name: Check Clippy + +on: + pull_request: + +jobs: + get-head-commit-msg: + runs-on: ubuntu-latest + outputs: + head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + + check-clippy: + runs-on: ubuntu-latest + needs: get-head-commit-msg + if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} + steps: + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Cargo Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + $ ${{ github.job }}-${{ github.ref }}-clippy- + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run Clippy + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c " + cargo test --all-targets --locked && \ + chown -R $(id -u):$(id -g) target/" diff --git a/Dockerfile b/Dockerfile index 816664b84..99a13e8b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,9 @@ -# this container builds the kilt-parachain binary from source files and the runtime library -# pinned the version to avoid build cache invalidation - -FROM paritytech/ci-unified:bullseye-1.70.0 as builder - -WORKDIR /build - -ARG FEATURES=default - -COPY . . - -RUN cargo build --locked --release --features $FEATURES - -# ===== SECOND STAGE ====== - FROM docker.io/library/ubuntu:20.04 LABEL description="This is the 2nd stage: a very small image where we copy the kilt-parachain binary." ARG NODE_TYPE=kilt-parachain -COPY --from=builder /build/target/release/$NODE_TYPE /usr/local/bin/node-executable +COPY ./target/release/$NODE_TYPE /usr/local/bin/node-executable RUN useradd -m -u 1000 -U -s /bin/sh -d /node node && \ mkdir -p /node/.local/share/node && \ From 5dfd5690f144563bc4bbc37ea41b602bfeb9533d Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 13:52:06 +0200 Subject: [PATCH 08/50] undo Dockerfile changes --- .github/workflows/build-images.yml | 14 +------------- Dockerfile | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 047cfba6c..562d264f4 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -47,19 +47,7 @@ jobs: - name: Build Docker Images run: | - cargo build --locked --release --features default - docker build -t kilt-node . - - - - name: Push Image - Commit SHA - if: github.ref_type == 'branch' - run: | - ./.maintain/push-image.sh build "${{ env.CI_COMMIT_SHORT_SHA }}" - - - name: Push Image - Latest Branch - if: github.ref_type == 'branch' - run: | - ./.maintain/push-image.sh build "latest-${{ env.CI_COMMIT_BRANCH }}" + ./.maintain/build-image.sh build - name: Push Image - Tag if: startsWith(github.ref, 'refs/tags/') diff --git a/Dockerfile b/Dockerfile index 99a13e8b4..9fa381b33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,25 @@ +# this container builds the kilt-parachain binary from source files and the runtime library +# pinned the version to avoid build cache invalidation + +FROM paritytech/ci-unified:bullseye-1.70.0 as builder + +WORKDIR /build + +ARG FEATURES=default + +COPY Cargo.toml Cargo.lock ./ +COPY ./src ./src + +RUN cargo build --locked --release --features $FEATURES + +# ===== SECOND STAGE ====== + FROM docker.io/library/ubuntu:20.04 LABEL description="This is the 2nd stage: a very small image where we copy the kilt-parachain binary." ARG NODE_TYPE=kilt-parachain -COPY ./target/release/$NODE_TYPE /usr/local/bin/node-executable +COPY --from=builder /build/target/release/$NODE_TYPE /usr/local/bin/node-executable RUN useradd -m -u 1000 -U -s /bin/sh -d /node node && \ mkdir -p /node/.local/share/node && \ From 8e264116d0f3242423e16f5029104f7e4f2a9555 Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 14:03:15 +0200 Subject: [PATCH 09/50] minor --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9fa381b33..816664b84 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,7 @@ WORKDIR /build ARG FEATURES=default -COPY Cargo.toml Cargo.lock ./ -COPY ./src ./src +COPY . . RUN cargo build --locked --release --features $FEATURES From 1986c5d6a1bdd10b06b498d83628ec851086a580 Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 17:30:58 +0200 Subject: [PATCH 10/50] trigger gitlab pipleine from gh action --- .github/workflows/build-images.yml | 68 ++++--------------- .../workflows/check-clippy-all-features.yml | 7 +- .github/workflows/check-clippy.yml | 7 +- .github/workflows/check-rustdoc.yml | 7 +- .github/workflows/docs-publish.yml | 2 +- .github/workflows/test-all-features.yml | 7 +- .github/workflows/test.yml | 7 +- .gitlab-ci.yml | 52 +++++++------- .gitlab/build.yml | 29 -------- .gitlab/check.yml | 41 ----------- .gitlab/test.yml | 23 ------- .maintain/build-image.sh | 18 +++-- 12 files changed, 70 insertions(+), 198 deletions(-) delete mode 100644 .gitlab/build.yml delete mode 100644 .gitlab/check.yml delete mode 100644 .gitlab/test.yml diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 562d264f4..2890b52c1 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -1,60 +1,22 @@ -name: Build Images +name: Trigger GitLab CI on: - push: - branches: - - github-runner + workflow_run: + workflows: ["Srtool build", "Deploy Chain docs"] + types: + - completed jobs: - build-images: + trigger_gitlab: + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest - timeout-minutes: 120 - env: - DOCKER_HUB_PARACHAIN: kiltprotocol/kilt-node - DOCKER_HUB_STANDALONE: kiltprotocol/standalone-node - DOCKER_HUB_DIP_PROVIDER_TEMPLATE: kiltprotocol/dip-provider-node-template - DOCKER_HUB_DIP_CONSUMER_TEMPLATE: kiltprotocol/dip-consumer-node-template - AWS_REGISTRY: ${{ secrets.ECR_REGISTRY }} - CI_COMMIT_SHORT_SHA: ${{ github.sha }} - CI_COMMIT_BRANCH: ${{ github.ref_name }} - CI_COMMIT_TAG: ${{ github.ref_name }} steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Checkout - uses: actions/checkout@v4 - - - name: Display AWS and Docker Versions - run: | - aws --version - docker --version - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to ECR - uses: docker/login-action@v3 - with: - registry: ${{ secrets.ECR_REGISTRY }} - username: ${{ secrets.AWS_ACCESS_KEY_ID }} - password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - - name: Build Docker Images - run: | - ./.maintain/build-image.sh build - - - name: Push Image - Tag - if: startsWith(github.ref, 'refs/tags/') - run: | - ./.maintain/push-image.sh build "${{ env.CI_COMMIT_TAG }}" - - - name: Push Image - Latest - if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-rc') && !contains(github.ref, 'dev-') + - name: Trigger GitLab CI + env: + GITLAB_TRIGGER_TOKEN: ${{ secrets.GITLAB_TRIGGER_TOKEN }} + GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }} run: | - ./.maintain/push-image.sh build "latest" + curl -X POST \ + -F token=$GITLAB_TRIGGER_TOKEN \ + -F ref=${{ github.ref_name }} \ + https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_ID/trigger/pipeline diff --git a/.github/workflows/check-clippy-all-features.yml b/.github/workflows/check-clippy-all-features.yml index 29db35824..4c027b16c 100644 --- a/.github/workflows/check-clippy-all-features.yml +++ b/.github/workflows/check-clippy-all-features.yml @@ -38,9 +38,9 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref }}-clippy-all-features-${{ hashFiles('**/Cargo.lock') }} + key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-all-features-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - $ ${{ github.job }}-${{ github.ref }}-clippy-all-features- + $ ${{ github.job }}-${{ github.ref_name }}-clippy-all-features- - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -55,6 +55,5 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo clippy --all-targets --all-features --locked --quiet && \ - chown -R $(id -u):$(id -g) target/" + cargo clippy --all-targets --all-features --locked --quiet diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml index 91ed93801..a531c1505 100644 --- a/.github/workflows/check-clippy.yml +++ b/.github/workflows/check-clippy.yml @@ -38,9 +38,9 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }} + key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - $ ${{ github.job }}-${{ github.ref }}-clippy- + $ ${{ github.job }}-${{ github.ref_name }}-clippy- - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -55,5 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo clippy --all-targets --locked --quiet && \ - chown -R $(id -u):$(id -g) target/" + cargo clippy --all-targets --locked --quiet diff --git a/.github/workflows/check-rustdoc.yml b/.github/workflows/check-rustdoc.yml index b1a55db25..d4c64c290 100644 --- a/.github/workflows/check-rustdoc.yml +++ b/.github/workflows/check-rustdoc.yml @@ -38,9 +38,9 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref }}-rustdoc-${{ hashFiles('**/Cargo.lock') }} + key: $ ${{ github.job }}-${{ github.ref_name }}-rustdoc-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - $ ${{ github.job }}-${{ github.ref }}-rustdoc- + $ ${{ github.job }}-${{ github.ref_name }}-rustdoc- - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -55,5 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo doc --all-features --no-deps --locked && \ - chown -R $(id -u):$(id -g) target/" + cargo doc --all-features --no-deps --locked diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 5221f36d2..052607017 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -1,4 +1,4 @@ -name: Build and Deploy Chain docs +name: Deploy Chain docs on: push: diff --git a/.github/workflows/test-all-features.yml b/.github/workflows/test-all-features.yml index 2fd0514ee..51752fac5 100644 --- a/.github/workflows/test-all-features.yml +++ b/.github/workflows/test-all-features.yml @@ -38,9 +38,9 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }} + key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - $ ${{ github.job }}-${{ github.ref }}-clippy- + $ ${{ github.job }}-${{ github.ref_name }}-clippy- - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -55,5 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo test --all-features --all-targets --locked && \ - chown -R $(id -u):$(id -g) target/" + cargo test --all-features --all-targets --locked diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df0939479..5556cc204 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,9 +38,9 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref }}-clippy-${{ hashFiles('**/Cargo.lock') }} + key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - $ ${{ github.job }}-${{ github.ref }}-clippy- + $ ${{ github.job }}-${{ github.ref_name }}-clippy- - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -55,5 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo test --all-targets --locked && \ - chown -R $(id -u):$(id -g) target/" + cargo test --all-targets --locked diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be251cfa2..b9cb181c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,27 +1,31 @@ -default: - interruptible: true - -.check_skip_rust: +build-images: + timeout: 2 hours + image: + name: kiltprotocol/kilt-ci:2.7.31 + entrypoint: [""] + stage: build + only: + refs: + - develop + - master + - /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/ + - /^[dev-](\w*-)*[0-9]?$/ + variables: + DOCKER_HUB_PARACHAIN: "kiltprotocol/kilt-node" + DOCKER_HUB_STANDALONE: "kiltprotocol/standalone-node" + DOCKER_HUB_DIP_PROVIDER_TEMPLATE: "kiltprotocol/dip-provider-node-template" + DOCKER_HUB_DIP_CONSUMER_TEMPLATE: "kiltprotocol/dip-consumer-node-template" before_script: - - |- - if echo "$CI_COMMIT_TITLE" | grep -q "ci-skip-rust"; then - echo "Skipping rust tests due to commit title" - exit 0 - fi -include: - - local: '.gitlab/check.yml' - - local: '.gitlab/test.yml' - - local: '.gitlab/build.yml' - -variables: - CARGO_CACHE_PATH: $CARGO_CACHE_PATH - CARGO_HOME: ${CI_PROJECT_DIR}/.cargo + - aws --version + - docker --version + script: + - echo -n $CI_REGISTRY_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY + - aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_REGISTRY + - ./.maintain/docker-auth-config.sh -workflow: - auto_cancel: - on_new_commit: interruptible + - ./.maintain/build-image.sh build + - "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_SHORT_SHA}; fi" + - "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build latest-${CI_COMMIT_BRANCH}; fi" + - "if [[ ! -z ${CI_COMMIT_TAG} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_TAG}; fi" + - "if [[ ! -z ${CI_COMMIT_TAG} && ! -z ${CI_COMMIT_TAG##*-rc*} && ! -z ${CI_COMMIT_TAG##*dev-*} ]]; then ./.maintain/push-image.sh build latest; fi" -stages: - - check - - test - - build diff --git a/.gitlab/build.yml b/.gitlab/build.yml deleted file mode 100644 index ad162b7f7..000000000 --- a/.gitlab/build.yml +++ /dev/null @@ -1,29 +0,0 @@ -build-images: - timeout: 2 hours - image: - name: kiltprotocol/kilt-ci:2.7.31 - entrypoint: [""] - stage: build - only: - refs: - - develop - - master - - /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/ - - /^[dev-](\w*-)*[0-9]?$/ - variables: - DOCKER_HUB_PARACHAIN: "kiltprotocol/kilt-node" - DOCKER_HUB_STANDALONE: "kiltprotocol/standalone-node" - DOCKER_HUB_DIP_PROVIDER_TEMPLATE: "kiltprotocol/dip-provider-node-template" - DOCKER_HUB_DIP_CONSUMER_TEMPLATE: "kiltprotocol/dip-consumer-node-template" - before_script: - - aws --version - - docker --version - script: - - echo -n $CI_REGISTRY_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY - - aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_REGISTRY - - ./.maintain/docker-auth-config.sh - - ./.maintain/build-image.sh build - - "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_SHORT_SHA}; fi" - - "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build latest-${CI_COMMIT_BRANCH}; fi" - - "if [[ ! -z ${CI_COMMIT_TAG} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_TAG}; fi" - - "if [[ ! -z ${CI_COMMIT_TAG} && ! -z ${CI_COMMIT_TAG##*-rc*} && ! -z ${CI_COMMIT_TAG##*dev-*} ]]; then ./.maintain/push-image.sh build latest; fi" diff --git a/.gitlab/check.yml b/.gitlab/check.yml deleted file mode 100644 index a14dda0f2..000000000 --- a/.gitlab/check.yml +++ /dev/null @@ -1,41 +0,0 @@ -cargo-clippy: - extends: .check_skip_rust - image: paritytech/ci-unified:bullseye-1.74.0 - variables: - RUSTDOCFLAGS: '-D warnings' - SKIP_WASM_BUILD: 1 - stage: check - cache: - key: cargo-clippy-${CI_COMMIT_REF_NAME} - paths: - - ${CARGO_CACHE_PATH} - script: - - cargo clippy --all-targets --locked --quiet - -cargo-clippy-all-features: - extends: .check_skip_rust - image: paritytech/ci-unified:bullseye-1.74.0 - variables: - RUSTDOCFLAGS: '-D warnings' - SKIP_WASM_BUILD: 1 - stage: check - cache: - key: cargo-clippy-all-features-${CI_COMMIT_REF_NAME} - paths: - - ${CARGO_CACHE_PATH} - script: - - cargo clippy --all-targets --all-features --locked --quiet - -check-rustdoc: - extends: .check_skip_rust - image: paritytech/ci-unified:bullseye-1.74.0 - variables: - SKIP_WASM_BUILD: 1 - RUSTDOCFLAGS: '-D warnings' - stage: check - cache: - key: cargo-check-rustdoc-${CI_COMMIT_REF_NAME} - paths: - - ${CARGO_CACHE_PATH} - script: - - cargo doc --all-features --no-deps --locked diff --git a/.gitlab/test.yml b/.gitlab/test.yml deleted file mode 100644 index 99bd6f8ef..000000000 --- a/.gitlab/test.yml +++ /dev/null @@ -1,23 +0,0 @@ -test: - extends: .check_skip_rust - timeout: 2 hours - image: paritytech/ci-unified:bullseye-1.74.0 - stage: test - cache: - key: cargo-test-${CI_COMMIT_REF_NAME} - paths: - - ${CARGO_CACHE_PATH} - script: - - cargo test --all-targets --locked - -test-features: - extends: .check_skip_rust - timeout: 2 hours - image: paritytech/ci-unified:bullseye-1.74.0 - stage: test - cache: - key: cargo-test-features-${CI_COMMIT_REF_NAME} - paths: - - ${CARGO_CACHE_PATH} - script: - - cargo test --all-features --all-targets --locked diff --git a/.maintain/build-image.sh b/.maintain/build-image.sh index 09236f90e..ad88929b4 100755 --- a/.maintain/build-image.sh +++ b/.maintain/build-image.sh @@ -4,15 +4,17 @@ set -e target_tag=$1 -# Build the builder image and push it sequentially +# Build the builder image and push it in the background docker build \ --target builder \ --cache-from $AWS_REGISTRY/kilt-parachain/collator:builder \ -t $AWS_REGISTRY/kilt-parachain/collator:builder \ - . + . & +docker push $AWS_REGISTRY/kilt-parachain/collator:builder & -docker push $AWS_REGISTRY/kilt-parachain/collator:builder +wait +# Build and tag images in parallel build_and_tag() { local node_type=$1 local image_name=$2 @@ -26,10 +28,12 @@ build_and_tag() { . } -build_and_tag "kilt-parachain" "kilt-node" "kilt-parachain/collator" +build_and_tag "kilt-parachain" "kilt-node" "kilt-parachain/collator" & -build_and_tag "standalone-node" "standalone-node" "kilt/prototype-chain" +build_and_tag "standalone-node" "standalone-node" "kilt/prototype-chain" & -build_and_tag "dip-provider-node-template" "dip-provider-node-template" "kilt-parachain/collator" +build_and_tag "dip-provider-node-template" "dip-provider-node-template" "kilt-parachain/collator" & -build_and_tag "dip-consumer-node-template" "dip-consumer-node-template" "kilt-parachain/collator" +build_and_tag "dip-consumer-node-template" "dip-consumer-node-template" "kilt-parachain/collator" & + +wait From a31fa3c0b088fe0efc4230886eb5c0f8c9e77661 Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 17:41:05 +0200 Subject: [PATCH 11/50] fix: formatting --- .github/workflows/check-clippy-all-features.yml | 2 +- .github/workflows/check-clippy.yml | 2 +- .github/workflows/check-rustdoc.yml | 2 +- .github/workflows/test-all-features.yml | 2 +- .github/workflows/test.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-clippy-all-features.yml b/.github/workflows/check-clippy-all-features.yml index 4c027b16c..e6a131625 100644 --- a/.github/workflows/check-clippy-all-features.yml +++ b/.github/workflows/check-clippy-all-features.yml @@ -55,5 +55,5 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo clippy --all-targets --all-features --locked --quiet + cargo clippy --all-targets --all-features --locked --quiet" diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml index a531c1505..83c351ee5 100644 --- a/.github/workflows/check-clippy.yml +++ b/.github/workflows/check-clippy.yml @@ -55,4 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo clippy --all-targets --locked --quiet + cargo clippy --all-targets --locked --quiet" diff --git a/.github/workflows/check-rustdoc.yml b/.github/workflows/check-rustdoc.yml index d4c64c290..c5522d2e5 100644 --- a/.github/workflows/check-rustdoc.yml +++ b/.github/workflows/check-rustdoc.yml @@ -55,4 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo doc --all-features --no-deps --locked + cargo doc --all-features --no-deps --locked" diff --git a/.github/workflows/test-all-features.yml b/.github/workflows/test-all-features.yml index 51752fac5..d89a393e7 100644 --- a/.github/workflows/test-all-features.yml +++ b/.github/workflows/test-all-features.yml @@ -55,4 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo test --all-features --all-targets --locked + cargo test --all-features --all-targets --locked" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5556cc204..fde1e3bd5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,4 +55,4 @@ jobs: -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ bash -c " - cargo test --all-targets --locked + cargo test --all-targets --locked" From 3116e960a0d98d0b983d161915dada7651be7a55 Mon Sep 17 00:00:00 2001 From: gera Date: Tue, 20 Aug 2024 18:04:27 +0200 Subject: [PATCH 12/50] formatting --- .github/workflows/check-clippy-all-features.yml | 3 +-- .github/workflows/check-clippy.yml | 7 +++---- .github/workflows/check-rustdoc.yml | 5 ++--- .github/workflows/docs-publish.yml | 4 ++-- .github/workflows/test-all-features.yml | 7 +++---- .github/workflows/test.yml | 9 ++++----- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check-clippy-all-features.yml b/.github/workflows/check-clippy-all-features.yml index e6a131625..98f48fbfd 100644 --- a/.github/workflows/check-clippy-all-features.yml +++ b/.github/workflows/check-clippy-all-features.yml @@ -54,6 +54,5 @@ jobs: -e RUSTDOCFLAGS='-D warnings' \ -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - cargo clippy --all-targets --all-features --locked --quiet" + bash -c "cargo clippy --all-targets --all-features --locked --quiet" diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml index 83c351ee5..aad896ea5 100644 --- a/.github/workflows/check-clippy.yml +++ b/.github/workflows/check-clippy.yml @@ -17,7 +17,7 @@ jobs: id: step-head-commit run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - check-clippy: + cargo-test-all-features: runs-on: ubuntu-latest needs: get-head-commit-msg if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} @@ -45,7 +45,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Run Clippy + - name: Run Test run: | docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ @@ -54,5 +54,4 @@ jobs: -e RUSTDOCFLAGS='-D warnings' \ -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - cargo clippy --all-targets --locked --quiet" + bash -c "cargo clippy --all-targets --locked --quiet" diff --git a/.github/workflows/check-rustdoc.yml b/.github/workflows/check-rustdoc.yml index c5522d2e5..4f20cc290 100644 --- a/.github/workflows/check-rustdoc.yml +++ b/.github/workflows/check-rustdoc.yml @@ -1,4 +1,4 @@ -name: Cargo Clippy +name: Check rustdoc on: pull_request: @@ -54,5 +54,4 @@ jobs: -e RUSTDOCFLAGS='-D warnings' \ -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - cargo doc --all-features --no-deps --locked" + bash -c "cargo doc --all-features --no-deps --locked" diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 052607017..a80d13ccb 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -26,10 +26,10 @@ jobs: docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ -v "${HOME}/.cargo:/root/.cargo" \ + -e RUSTDOCFLAGS='-D warnings' \ -w /workspace \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - RUSTDOCFLAGS='-D warnings' cargo doc --all-features --no-deps --locked && \ + bash -c "cargo doc --all-features --no-deps --locked && \ chown -R $(id -u):$(id -g) target/doc" - name: Deploy diff --git a/.github/workflows/test-all-features.yml b/.github/workflows/test-all-features.yml index d89a393e7..039fba447 100644 --- a/.github/workflows/test-all-features.yml +++ b/.github/workflows/test-all-features.yml @@ -1,4 +1,4 @@ -name: Check Clippy +name: Test all-features on: pull_request: @@ -45,7 +45,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Run Clippy + - name: Run Test all-features run: | docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ @@ -54,5 +54,4 @@ jobs: -e RUSTDOCFLAGS='-D warnings' \ -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - cargo test --all-features --all-targets --locked" + bash -c "cargo test --all-features --all-targets --locked" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fde1e3bd5..33f57f59e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Check Clippy +name: Cargo Test on: pull_request: @@ -17,7 +17,7 @@ jobs: id: step-head-commit run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - check-clippy: + cargo-test: runs-on: ubuntu-latest needs: get-head-commit-msg if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} @@ -45,7 +45,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Run Clippy + - name: Run Test run: | docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ @@ -54,5 +54,4 @@ jobs: -e RUSTDOCFLAGS='-D warnings' \ -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c " - cargo test --all-targets --locked" + bash -c "cargo test --all-targets --locked" From 30bd9c97e1ad710f5971b127afe20d65d74bd1fa Mon Sep 17 00:00:00 2001 From: gera Date: Wed, 21 Aug 2024 11:49:26 +0200 Subject: [PATCH 13/50] get commit message in a step --- .../workflows/check-clippy-all-features.yml | 58 ------------- .github/workflows/check-clippy.yml | 73 ++++++++--------- .github/workflows/check-fmt.yml | 18 ++--- .github/workflows/check-rustdoc.yml | 21 ++--- .github/workflows/docs-publish.yml | 7 +- .github/workflows/integration-tests.yml | 37 ++++----- .github/workflows/srtool-build.yml | 81 ------------------- .github/workflows/test-all-features.yml | 57 ------------- .github/workflows/test.yml | 40 ++++----- ...images.yml => trigger-gitlab-pipeline.yml} | 10 ++- .github/workflows/try-runtime.yml | 31 ++++--- .gitlab-ci.yml | 38 +++++++-- 12 files changed, 143 insertions(+), 328 deletions(-) delete mode 100644 .github/workflows/check-clippy-all-features.yml delete mode 100644 .github/workflows/srtool-build.yml delete mode 100644 .github/workflows/test-all-features.yml rename .github/workflows/{build-images.yml => trigger-gitlab-pipeline.yml} (71%) diff --git a/.github/workflows/check-clippy-all-features.yml b/.github/workflows/check-clippy-all-features.yml deleted file mode 100644 index 98f48fbfd..000000000 --- a/.github/workflows/check-clippy-all-features.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Check Clippy all-features - -on: - pull_request: - -jobs: - get-head-commit-msg: - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - check-clippy-all-features: - runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} - steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Cargo Cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-all-features-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - $ ${{ github.job }}-${{ github.ref_name }}-clippy-all-features- - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run Clippy - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - -e RUSTDOCFLAGS='-D warnings' \ - -e SKIP_WASM_BUILD=1 \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo clippy --all-targets --all-features --locked --quiet" - diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml index aad896ea5..19f8fbc59 100644 --- a/.github/workflows/check-clippy.yml +++ b/.github/workflows/check-clippy.yml @@ -1,36 +1,39 @@ -name: Check Clippy +name: Clippy-checks on: pull_request: + push: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + RUSTDOCFLAGS: '-D warnings' jobs: - get-head-commit-msg: + clippy: + name: Run Clippy with different features combinations runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + strategy: + matrix: + features: + - + - --all-features - cargo-test-all-features: - runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Checkout + - name: Download repository uses: actions/checkout@v4 - - name: Set up Cargo Cache + - name: Set up Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Set up cargo cache uses: actions/cache@v4 with: path: | @@ -38,20 +41,12 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - $ ${{ github.job }}-${{ github.ref_name }}-clippy- - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run Test - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - -e RUSTDOCFLAGS='-D warnings' \ - -e SKIP_WASM_BUILD=1 \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo clippy --all-targets --locked --quiet" + target/ + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-cargo-cache + + - name: Run Clippy with "${{ matrix.features }}" + run: cargo clippy --all-targets --locked ${{ matrix.features }} + + + + diff --git a/.github/workflows/check-fmt.yml b/.github/workflows/check-fmt.yml index ed0f0a4b3..5366e4d4b 100644 --- a/.github/workflows/check-fmt.yml +++ b/.github/workflows/check-fmt.yml @@ -8,12 +8,15 @@ concurrency: cancel-in-progress: true jobs: - get-head-commit-msg: + check-fmt: runs-on: ubuntu-latest outputs: head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + container: + image: paritytech/ci-unified:bullseye-1.74.0 steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -21,17 +24,10 @@ jobs: id: step-head-commit run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - check-fmt: - runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} - container: - image: paritytech/ci-unified:bullseye-1.74.0 - steps: - - uses: actions/checkout@v4 - - name: Run cargo fmt + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} run: cargo fmt -- --check - name: Run taplo + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} run: taplo fmt --check diff --git a/.github/workflows/check-rustdoc.yml b/.github/workflows/check-rustdoc.yml index 4f20cc290..5b8d052ae 100644 --- a/.github/workflows/check-rustdoc.yml +++ b/.github/workflows/check-rustdoc.yml @@ -4,12 +4,13 @@ on: pull_request: jobs: - get-head-commit-msg: + check-rustdoc: runs-on: ubuntu-latest outputs: head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -17,20 +18,14 @@ jobs: id: step-head-commit run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - check-clippy: - runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} - steps: - name: Free Disk Space + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} uses: jlumbroso/free-disk-space@main with: tool-cache: true - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Cargo Cache + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} uses: actions/cache@v4 with: path: | @@ -42,10 +37,8 @@ jobs: restore-keys: | $ ${{ github.job }}-${{ github.ref_name }}-rustdoc- - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run doc + - name: Run cargo doc + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} run: | docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index a80d13ccb..3f743f67f 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -1,4 +1,4 @@ -name: Deploy Chain docs +name: Deploy rustdoc on: push: @@ -18,10 +18,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and Deploy in Container + - name: Run cargo doc run: | docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 55dccfc54..d57f41b92 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,31 +1,20 @@ -name: Integration tests +name: Integration-tests on: pull_request: + push: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true jobs: - get-head-commit-msg: - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - integration-tests: runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-integration-tests') }} env: working-dir: ./integration-tests/chopsticks CI: "true" @@ -36,24 +25,36 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - name: Setup Node.js environment + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} uses: actions/setup-node@v4 with: node-version-file: "${{ env.working-dir }}/.nvmrc" - name: Install dependencies + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} run: yarn --immutable - name: Type Checking + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} run: yarn ts-check - name: Linting + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} run: yarn lint - + - name: Build Runtime + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} run: cargo build -p peregrine-runtime - name: Test Suite + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} run: yarn test:CI diff --git a/.github/workflows/srtool-build.yml b/.github/workflows/srtool-build.yml deleted file mode 100644 index b9fc663a0..000000000 --- a/.github/workflows/srtool-build.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Srtool build - -on: - push: - branches: - - develop - - master - - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -env: - SUBWASM_VERSION: v0.21.3 - -jobs: - build-wasm: - runs-on: ubuntu-latest - - strategy: - matrix: - runtime: [peregrine, spiritnet] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Srtool build - id: srtool_build - uses: chevdor/srtool-actions@v0.9.2 - env: - PARACHAIN_PALLET_ID: "0x50" - AUTHORIZE_UPGRADE_PREFIX: "0x02" - AUTHORIZE_UPGRADE_CHECK_VERSION: "true" - with: - chain: ${{ matrix.runtime }} - runtime_dir: runtimes/${{ matrix.runtime }} - - - name: Summary - run: | - echo '${{ steps.srtool_build.outputs.json }}' | jq | tee ${{ matrix.runtime }}-srtool-digest.json - echo "Compressed Runtime: ${{ steps.srtool_build.outputs.wasm_compressed }}" - - - name: Install subwasm - run: | - wget /~https://github.com/chevdor/subwasm/releases/download/${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb - sudo dpkg -i subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb - subwasm --version - - - name: Show Runtime information - shell: bash - run: | - subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} - subwasm info --json ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-compressed-info.json - - - name: Extract the metadata - shell: bash - run: | - subwasm meta ${{ steps.srtool_build.outputs.wasm_compressed }} - subwasm meta --format=json+scale ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-metadata.json - - - name: Check the metadata diff - shell: bash - run: | - subwasm get -o ${{ matrix.runtime }}-live.wasm wss://${{ matrix.runtime }}.kilt.io - subwasm diff --no-color ${{ matrix.runtime }}-live.wasm ${{ steps.srtool_build.outputs.wasm_compressed }} || \ - echo "Subwasm call failed, check the logs. This is likely because ${{ matrix.runtime }} is not known by subwasm" | \ - tee ${{ matrix.runtime }}-diff.txt - - - name: Archive Subwasm results - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.runtime }}-runtime - path: | - ${{ matrix.runtime }}-compressed-info.json - ${{ matrix.runtime }}-metadata.json - ${{ matrix.runtime }}-diff.txt - ${{ steps.srtool_build.outputs.wasm_compressed }} - ${{ matrix.runtime }}-srtool-digest.json - diff --git a/.github/workflows/test-all-features.yml b/.github/workflows/test-all-features.yml deleted file mode 100644 index 039fba447..000000000 --- a/.github/workflows/test-all-features.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Test all-features - -on: - pull_request: - -jobs: - get-head-commit-msg: - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - check-clippy: - runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} - steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Cargo Cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - $ ${{ github.job }}-${{ github.ref_name }}-clippy- - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run Test all-features - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - -e RUSTDOCFLAGS='-D warnings' \ - -e SKIP_WASM_BUILD=1 \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo test --all-features --all-targets --locked" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33f57f59e..783926c9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,15 +1,23 @@ -name: Cargo Test +name: Cargo Tests on: pull_request: + push: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' jobs: - get-head-commit-msg: + test: runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} + strategy: + matrix: + features: ["", "--all-features"] + steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -17,20 +25,14 @@ jobs: id: step-head-commit run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - cargo-test: - runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} - steps: - name: Free Disk Space + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} uses: jlumbroso/free-disk-space@main with: tool-cache: true - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Cargo Cache + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} uses: actions/cache@v4 with: path: | @@ -38,14 +40,12 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref_name }}-clippy-${{ hashFiles('**/Cargo.lock') }} + key: ${{ github.job }}-${{ github.ref_name }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - $ ${{ github.job }}-${{ github.ref_name }}-clippy- - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + ${{ github.job }}-${{ github.ref_name }}-${{ matrix.features }}- - - name: Run Test + - name: Run Tests + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} run: | docker run --rm \ -v "${GITHUB_WORKSPACE}:/workspace" \ @@ -54,4 +54,4 @@ jobs: -e RUSTDOCFLAGS='-D warnings' \ -e SKIP_WASM_BUILD=1 \ paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo test --all-targets --locked" + bash -c "cargo test --all-targets --locked ${{ matrix.features }}" diff --git a/.github/workflows/build-images.yml b/.github/workflows/trigger-gitlab-pipeline.yml similarity index 71% rename from .github/workflows/build-images.yml rename to .github/workflows/trigger-gitlab-pipeline.yml index 2890b52c1..db4466450 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/trigger-gitlab-pipeline.yml @@ -1,13 +1,17 @@ -name: Trigger GitLab CI +name: Trigger GitLab Pipeline on: workflow_run: - workflows: ["Srtool build", "Deploy Chain docs"] + workflows: ["Clippy-checks", "Cargo-tests", "Try-runtime", "Integration-tests"] + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' types: - completed jobs: - trigger_gitlab: + trigger-gitlab: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index ea1c0a04f..7ffa5319b 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -2,6 +2,11 @@ name: Try-runtime on: pull_request: + push: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} @@ -12,34 +17,27 @@ env: CARGO_HOME: ./.cargo jobs: - get-head-commit-msg: - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - test-try-runtime: strategy: matrix: runtime: [peregrine, spiritnet] runs-on: ubuntu-latest - needs: get-head-commit-msg - if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }} + outputs: + head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} container: image: paritytech/ci-unified:bullseye-1.74.0 steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Get Head Commit Message + id: step-head-commit + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - name: Set up caching for Cargo + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} uses: actions/cache@v4 with: path: ${{ secrets.CARGO_CACHE_PATH }} @@ -48,6 +46,7 @@ jobs: cargo-try-runtime-${{ matrix.runtime }}-${{ github.ref_name }}- - name: Run try-runtime + if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} run: | echo "Running ${{ matrix.runtime }} runtime migration check" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9cb181c7..b48379ecd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,41 @@ +stages: + - build + +variables: + PARACHAIN_PALLET_ID: 0x50 + AUTHORIZE_UPGRADE_PREFIX: 0x02 + +build-wasm: + image: + name: paritytech/srtool:1.70.0 + entrypoint: [""] + stage: build + parallel: + matrix: + - RUNTIME: ["peregrine", "spiritnet"] + script: + - export PACKAGE=${RUNTIME}-runtime + - export RUNTIME_DIR=runtimes/${RUNTIME} + - cp -r * /build + - /srtool/build build + - subwasm meta --format=json+scale /out/${RUNTIME}_runtime.compact.wasm > /out/${RUNTIME}-metadata.json + - subwasm get -o ${RUNTIME}-live.wasm wss://${RUNTIME}.kilt.io + - subwasm diff --no-color ${RUNTIME}-live.wasm /out/${RUNTIME}_runtime.compact.wasm | tee /out/${RUNTIME}-diff.txt + - mkdir -p ./out + - mv /out/* ./out/ + artifacts: + paths: + - out/*.wasm + - out/*.json + - out/*.txt + expire_in: 12 week + build-images: timeout: 2 hours image: name: kiltprotocol/kilt-ci:2.7.31 entrypoint: [""] stage: build - only: - refs: - - develop - - master - - /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/ - - /^[dev-](\w*-)*[0-9]?$/ variables: DOCKER_HUB_PARACHAIN: "kiltprotocol/kilt-node" DOCKER_HUB_STANDALONE: "kiltprotocol/standalone-node" From c5f38b2a99b36db118975dc7e5827a0b3d6d108f Mon Sep 17 00:00:00 2001 From: gera Date: Wed, 21 Aug 2024 11:56:58 +0200 Subject: [PATCH 14/50] fix clippy --- .github/workflows/check-clippy.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml index 19f8fbc59..791e67673 100644 --- a/.github/workflows/check-clippy.yml +++ b/.github/workflows/check-clippy.yml @@ -44,9 +44,13 @@ jobs: target/ key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-cargo-cache - - name: Run Clippy with "${{ matrix.features }}" - run: cargo clippy --all-targets --locked ${{ matrix.features }} - - - - + - name: Run Test + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ + bash -c "cargo clippy --locked --quiet ${{ matrix.features }}" From e4abc79eedede0af25afab8490e45236463554a4 Mon Sep 17 00:00:00 2001 From: gera Date: Wed, 21 Aug 2024 12:23:54 +0200 Subject: [PATCH 15/50] remove target from cache --- .github/workflows/check-clippy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml index 791e67673..75ac42f77 100644 --- a/.github/workflows/check-clippy.yml +++ b/.github/workflows/check-clippy.yml @@ -41,7 +41,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-cargo-cache - name: Run Test From 1a0e05da89fdd19e37158c0c093a4fb75e1af335 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 09:38:08 +0200 Subject: [PATCH 16/50] Use single workflow --- .github/workflows/check-clippy.yml | 55 ---- .github/workflows/check-code.yml | 242 ++++++++++++++++++ .github/workflows/check-fmt.yml | 33 --- .github/workflows/check-rustdoc.yml | 50 ---- .github/workflows/docs-publish.yml | 36 --- .github/workflows/integration-tests.yml | 60 ----- .github/workflows/publish-rustdocs.yml | 50 ++++ .github/workflows/semantic-pr-title.yml | 16 -- .github/workflows/test.yml | 57 ----- .github/workflows/trigger-gitlab-pipeline.yml | 13 +- .github/workflows/try-runtime.yml | 64 ----- .github/workflows/validate-pr-title.yml | 21 ++ .gitlab-ci.yml | 12 +- 13 files changed, 327 insertions(+), 382 deletions(-) delete mode 100644 .github/workflows/check-clippy.yml create mode 100644 .github/workflows/check-code.yml delete mode 100644 .github/workflows/check-fmt.yml delete mode 100644 .github/workflows/check-rustdoc.yml delete mode 100644 .github/workflows/docs-publish.yml delete mode 100644 .github/workflows/integration-tests.yml create mode 100644 .github/workflows/publish-rustdocs.yml delete mode 100644 .github/workflows/semantic-pr-title.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/try-runtime.yml create mode 100644 .github/workflows/validate-pr-title.yml diff --git a/.github/workflows/check-clippy.yml b/.github/workflows/check-clippy.yml deleted file mode 100644 index 75ac42f77..000000000 --- a/.github/workflows/check-clippy.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Clippy-checks - -on: - pull_request: - push: - branches: - - develop - - master - - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - RUSTDOCFLAGS: '-D warnings' - -jobs: - clippy: - name: Run Clippy with different features combinations - runs-on: ubuntu-latest - - strategy: - matrix: - features: - - - - --all-features - - steps: - - name: Download repository - uses: actions/checkout@v4 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Set up cargo cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-cargo-cache - - - name: Run Test - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - -e RUSTDOCFLAGS='-D warnings' \ - -e SKIP_WASM_BUILD=1 \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo clippy --locked --quiet ${{ matrix.features }}" diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml new file mode 100644 index 000000000..244304be9 --- /dev/null +++ b/.github/workflows/check-code.yml @@ -0,0 +1,242 @@ +name: Check codebase + +on: + pull_request: + push: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + get-commit-head: + name: Get HEAD commit message + runs-on: ubuntu-latest + outputs: + headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg }} + + steps: + - name: Get HEAD commit message + id: get-head-commit-message + run: echo "headCommitMsg=$(git show -s --format=%s)" >> $GITHUB_OUTPUT + + cargo-clippy: + name: Run Clippy checks + runs-on: ubuntu-latest + needs: get-commit-head + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + + strategy: + matrix: + features: + - + - --all-features + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }} + + - name: Run `cargo clippy` + run: | + docker run --rm + -v "${GITHUB_WORKSPACE}:/workspace" + -v "${HOME}/.cargo:/root/.cargo" + -w /workspace + -e SKIP_WASM_BUILD=1 + paritytech/ci-unified:bullseye-1.74.0 + bash -c "cargo clippy --all-targets --locked ${{ matrix.features }} -- -D warnings" + + cargo-test: + name: Run Cargo tests + runs-on: ubuntu-latest + needs: get-commit-head + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + + strategy: + matrix: + features: + - + - --all-features + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }} + + - name: Run `cargo test` + run: | + docker run --rm + -v "${GITHUB_WORKSPACE}:/workspace" + -v "${HOME}/.cargo:/root/.cargo" + -w /workspace + -e SKIP_WASM_BUILD=1 + paritytech/ci-unified:bullseye-1.74.0 + bash -c "cargo test --all-targets --locked ${{ matrix.features }}" + + cargo-fmt: + name: Check formatting + runs-on: ubuntu-latest + container: + image: paritytech/ci-unified:bullseye-1.74.0 + needs: get-commit-head + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly-2024-08-20 + components: rustfmt + + - name: Run `cargo fmt` + run: cargo fmt -- --check + + - name: Run `taplo` + run: taplo fmt --check + + cargo-doc: + name: Check Rustdoc + runs-on: ubuntu-latest + needs: get-commit-head + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + + strategy: + matrix: + features: + - + - --all-features + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }} + + - name: Run `cargo doc` + run: | + docker run --rm + -v "${GITHUB_WORKSPACE}:/workspace" + -v "${HOME}/.cargo:/root/.cargo" + -w /workspace + -e RUSTDOCFLAGS='-D warnings' + -e SKIP_WASM_BUILD=1 + paritytech/ci-unified:bullseye-1.74.0 + bash -c "cargo doc --no-deps --locked ${{ matrix.features }}" + + try-runtime: + name: Run try-runtime + runs-on: ubuntu-latest + env: + TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0 + container: + image: paritytech/ci-unified:bullseye-1.74.0 + + strategy: + matrix: + runtime: + - peregrine + - spiritnet + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }} + + - name: Install try-runtime + run: | + curl -sL /~https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_CLI_VERSION_TAG }}/try-runtime-x86_64-unknown-linux-musl -o try-runtime + chmod +x ./try-runtime + ./try-runtime --version + + - name: Build runtime + run: cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime + + - name: Run `try-runtime` + run: | + ./try-runtime + --runtime=./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm + on-runtime-upgrade + --disable-spec-version-check + --checks=all + live + --uri=wss://${{ matrix.runtime }}.kilt.io + + integration-tests: + name: Run Chopsticks tests + runs-on: ubuntu-latest + env: + working-dir: ./integration-tests/chopsticks + CI: true + PEREGRINE_WASM_OVERRIDE: ../../target/debug/wbuild/peregrine-runtime/peregrine_runtime.wasm + defaults: + run: + working-directory: ${{ env.working-dir }} + needs: get-commit-head + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup environment + uses: actions/setup-node@v4 + with: + node-version-file: "${{ env.working-dir }}/.nvmrc" + + - name: Install dependencies + run: yarn --immutable + + - name: Check TS + run: yarn ts-check + + - name: Check lints + run: yarn lint + + - name: Build Peregrine runtime + run: cargo build -p peregrine-runtime + + - name: Run Chopsticks tests + run: yarn test:CI diff --git a/.github/workflows/check-fmt.yml b/.github/workflows/check-fmt.yml deleted file mode 100644 index 5366e4d4b..000000000 --- a/.github/workflows/check-fmt.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Check fmt - -on: - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - check-fmt: - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - container: - image: paritytech/ci-unified:bullseye-1.74.0 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - - name: Run cargo fmt - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - run: cargo fmt -- --check - - - name: Run taplo - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - run: taplo fmt --check diff --git a/.github/workflows/check-rustdoc.yml b/.github/workflows/check-rustdoc.yml deleted file mode 100644 index 5b8d052ae..000000000 --- a/.github/workflows/check-rustdoc.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Check rustdoc - -on: - pull_request: - -jobs: - check-rustdoc: - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - - name: Free Disk Space - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Set up Cargo Cache - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: $ ${{ github.job }}-${{ github.ref_name }}-rustdoc-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - $ ${{ github.job }}-${{ github.ref_name }}-rustdoc- - - - name: Run cargo doc - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - -e RUSTDOCFLAGS='-D warnings' \ - -e SKIP_WASM_BUILD=1 \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo doc --all-features --no-deps --locked" diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml deleted file mode 100644 index 3f743f67f..000000000 --- a/.github/workflows/docs-publish.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Deploy rustdoc - -on: - push: - branches: - - develop - - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Checkout - uses: actions/checkout@v4 - - - name: Run cargo doc - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -e RUSTDOCFLAGS='-D warnings' \ - -w /workspace \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo doc --all-features --no-deps --locked && \ - chown -R $(id -u):$(id -g) target/doc" - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: gh-pages - folder: target/doc diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml deleted file mode 100644 index d57f41b92..000000000 --- a/.github/workflows/integration-tests.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Integration-tests - -on: - pull_request: - push: - branches: - - develop - - master - - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - integration-tests: - runs-on: ubuntu-latest - env: - working-dir: ./integration-tests/chopsticks - CI: "true" - PEREGRINE_WASM_OVERRIDE: ../../target/debug/wbuild/peregrine-runtime/peregrine_runtime.wasm - defaults: - run: - working-directory: ${{ env.working-dir }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - - name: Setup Node.js environment - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - uses: actions/setup-node@v4 - with: - node-version-file: "${{ env.working-dir }}/.nvmrc" - - - name: Install dependencies - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - run: yarn --immutable - - - name: Type Checking - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - run: yarn ts-check - - - name: Linting - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - run: yarn lint - - - name: Build Runtime - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - run: cargo build -p peregrine-runtime - - - name: Test Suite - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - run: yarn test:CI - diff --git a/.github/workflows/publish-rustdocs.yml b/.github/workflows/publish-rustdocs.yml new file mode 100644 index 000000000..4b6a3ba02 --- /dev/null +++ b/.github/workflows/publish-rustdocs.yml @@ -0,0 +1,50 @@ +name: Deploy rustdoc + +on: + push: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + deploy-rustdocs: + name: Deploy rustdoc + runs-on: ubuntu-latest + env: + DOCS_TARGET: target/doc + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }} + + - name: Run `cargo doc` + run: | + docker run --rm + -v "${GITHUB_WORKSPACE}:/workspace" + -v "${HOME}/.cargo:/root/.cargo" + -w /workspace + -e RUSTDOCFLAGS='-D warnings' + paritytech/ci-unified:bullseye-1.74.0 + bash -c "cargo doc --all-features --no-deps --locked + && chown -R $(id -u):$(id -g) ${{ env.DOCS_TARGET }}" + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages-${{ github.ref_name }} + folder: ${{ env.DOCS_TARGET }} diff --git a/.github/workflows/semantic-pr-title.yml b/.github/workflows/semantic-pr-title.yml deleted file mode 100644 index c4ba39bf9..000000000 --- a/.github/workflows/semantic-pr-title.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Validate PR title" - -on: - pull_request_target: - types: - - opened - - edited - - synchronize - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 783926c9b..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Cargo Tests - -on: - pull_request: - push: - branches: - - develop - - master - - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - features: ["", "--all-features"] - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - - name: Free Disk Space - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - - - name: Set up Cargo Cache - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref_name }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ github.job }}-${{ github.ref_name }}-${{ matrix.features }}- - - - name: Run Tests - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}:/workspace" \ - -v "${HOME}/.cargo:/root/.cargo" \ - -w /workspace \ - -e RUSTDOCFLAGS='-D warnings' \ - -e SKIP_WASM_BUILD=1 \ - paritytech/ci-unified:bullseye-1.74.0 \ - bash -c "cargo test --all-targets --locked ${{ matrix.features }}" diff --git a/.github/workflows/trigger-gitlab-pipeline.yml b/.github/workflows/trigger-gitlab-pipeline.yml index db4466450..b5735a681 100644 --- a/.github/workflows/trigger-gitlab-pipeline.yml +++ b/.github/workflows/trigger-gitlab-pipeline.yml @@ -1,8 +1,8 @@ -name: Trigger GitLab Pipeline +name: Trigger GitLab Deploy Pipeline on: workflow_run: - workflows: ["Clippy-checks", "Cargo-tests", "Try-runtime", "Integration-tests"] + workflows: ["Check codebase"] branches: - develop - master @@ -12,15 +12,16 @@ on: jobs: trigger-gitlab: - if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: - name: Trigger GitLab CI env: GITLAB_TRIGGER_TOKEN: ${{ secrets.GITLAB_TRIGGER_TOKEN }} GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }} run: | - curl -X POST \ - -F token=$GITLAB_TRIGGER_TOKEN \ - -F ref=${{ github.ref_name }} \ + curl -X POST + -F token=$GITLAB_TRIGGER_TOKEN + -F ref=${{ github.ref_name }} https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_ID/trigger/pipeline diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml deleted file mode 100644 index 7ffa5319b..000000000 --- a/.github/workflows/try-runtime.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Try-runtime - -on: - pull_request: - push: - branches: - - develop - - master - - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -env: - TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0 - CARGO_HOME: ./.cargo - -jobs: - test-try-runtime: - strategy: - matrix: - runtime: [peregrine, spiritnet] - runs-on: ubuntu-latest - outputs: - head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }} - container: - image: paritytech/ci-unified:bullseye-1.74.0 - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Get Head Commit Message - id: step-head-commit - run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - - name: Set up caching for Cargo - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - uses: actions/cache@v4 - with: - path: ${{ secrets.CARGO_CACHE_PATH }} - key: cargo-try-runtime-${{ matrix.runtime }}-${{ github.ref_name }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - cargo-try-runtime-${{ matrix.runtime }}-${{ github.ref_name }}- - - - name: Run try-runtime - if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }} - run: | - echo "Running ${{ matrix.runtime }} runtime migration check" - - echo "---------- Downloading try-runtime CLI ----------" - curl -sL /~https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_CLI_VERSION_TAG }}/try-runtime-x86_64-unknown-linux-musl -o try-runtime - chmod +x ./try-runtime - echo "Using try-runtime-cli version:" - ./try-runtime --version - - echo "---------- Building ${{ matrix.runtime }} runtime ----------" - cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime - - echo "---------- Executing on-runtime-upgrade for ${{ matrix.runtime }} ----------" - ./try-runtime --runtime ./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm \ - on-runtime-upgrade --disable-spec-version-check --checks=all live --uri wss://${{ matrix.runtime }}.kilt.io diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml new file mode 100644 index 000000000..8efd20dfc --- /dev/null +++ b/.github/workflows/validate-pr-title.yml @@ -0,0 +1,21 @@ +name: Validate PR title + +on: + pull_request_target: + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' + types: + - opened + - edited + - synchronize + +jobs: + validate-pr-title: + runs-on: ubuntu-latest + steps: + - name: Check title + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b48379ecd..ea47dc813 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,15 +4,18 @@ stages: variables: PARACHAIN_PALLET_ID: 0x50 AUTHORIZE_UPGRADE_PREFIX: 0x02 + AUTHORIZE_UPGRADE_CHECK_VERSION: true -build-wasm: +build-wasms: image: - name: paritytech/srtool:1.70.0 + name: paritytech/srtool:1.74.0 entrypoint: [""] stage: build parallel: matrix: - - RUNTIME: ["peregrine", "spiritnet"] + - RUNTIME + - peregrine + - spiritnet script: - export PACKAGE=${RUNTIME}-runtime - export RUNTIME_DIR=runtimes/${RUNTIME} @@ -30,7 +33,7 @@ build-wasm: - out/*.txt expire_in: 12 week -build-images: +build-docker-images: timeout: 2 hours image: name: kiltprotocol/kilt-ci:2.7.31 @@ -54,4 +57,3 @@ build-images: - "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build latest-${CI_COMMIT_BRANCH}; fi" - "if [[ ! -z ${CI_COMMIT_TAG} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_TAG}; fi" - "if [[ ! -z ${CI_COMMIT_TAG} && ! -z ${CI_COMMIT_TAG##*-rc*} && ! -z ${CI_COMMIT_TAG##*dev-*} ]]; then ./.maintain/push-image.sh build latest; fi" - From 3156339a9986d7d523b8a37c73526e4a38c9b4fc Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 09:40:15 +0200 Subject: [PATCH 17/50] Add delimiters --- .github/workflows/check-code.yml | 50 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 244304be9..e12946e4c 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -52,12 +52,12 @@ jobs: - name: Run `cargo clippy` run: | - docker run --rm - -v "${GITHUB_WORKSPACE}:/workspace" - -v "${HOME}/.cargo:/root/.cargo" - -w /workspace - -e SKIP_WASM_BUILD=1 - paritytech/ci-unified:bullseye-1.74.0 + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ bash -c "cargo clippy --all-targets --locked ${{ matrix.features }} -- -D warnings" cargo-test: @@ -88,12 +88,12 @@ jobs: - name: Run `cargo test` run: | - docker run --rm - -v "${GITHUB_WORKSPACE}:/workspace" - -v "${HOME}/.cargo:/root/.cargo" - -w /workspace - -e SKIP_WASM_BUILD=1 - paritytech/ci-unified:bullseye-1.74.0 + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ bash -c "cargo test --all-targets --locked ${{ matrix.features }}" cargo-fmt: @@ -148,13 +148,13 @@ jobs: - name: Run `cargo doc` run: | - docker run --rm - -v "${GITHUB_WORKSPACE}:/workspace" - -v "${HOME}/.cargo:/root/.cargo" - -w /workspace - -e RUSTDOCFLAGS='-D warnings' - -e SKIP_WASM_BUILD=1 - paritytech/ci-unified:bullseye-1.74.0 + docker run --rm \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -v "${HOME}/.cargo:/root/.cargo" \ + -w /workspace \ + -e RUSTDOCFLAGS='-D warnings' \ + -e SKIP_WASM_BUILD=1 \ + paritytech/ci-unified:bullseye-1.74.0 \ bash -c "cargo doc --no-deps --locked ${{ matrix.features }}" try-runtime: @@ -196,12 +196,12 @@ jobs: - name: Run `try-runtime` run: | - ./try-runtime - --runtime=./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm - on-runtime-upgrade - --disable-spec-version-check - --checks=all - live + ./try-runtime \ + --runtime=./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm \ + on-runtime-upgrade \ + --disable-spec-version-check \ + --checks=all \ + live \ --uri=wss://${{ matrix.runtime }}.kilt.io integration-tests: From 1b83179d43d3c556870311648f03ae7ee1c9bfcb Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 09:51:43 +0200 Subject: [PATCH 18/50] Update nightly version and add job dependencies --- .github/workflows/check-code.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index e12946e4c..b8ace699f 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -111,7 +111,8 @@ jobs: - name: Set up Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: nightly-2024-08-20 + # Latest 1.74 nightly release + toolchain: nightly-2023-10-01 components: rustfmt - name: Run `cargo fmt` From b442ab0141d21e5fd3b701fd3aa320dc42882a24 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 09:53:48 +0200 Subject: [PATCH 19/50] Add job dependencies --- .github/workflows/check-code.yml | 131 +++++++++++++++---------------- 1 file changed, 65 insertions(+), 66 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index b8ace699f..451e79e35 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -60,12 +60,73 @@ jobs: paritytech/ci-unified:bullseye-1.74.0 \ bash -c "cargo clippy --all-targets --locked ${{ matrix.features }} -- -D warnings" - cargo-test: - name: Run Cargo tests + cargo-fmt: + name: Check formatting runs-on: ubuntu-latest + container: + image: paritytech/ci-unified:bullseye-1.74.0 needs: get-commit-head if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + # Latest 1.74 nightly release + toolchain: nightly-2023-10-01 + components: rustfmt + + - name: Run `cargo fmt` + run: cargo fmt -- --check + + - name: Run `taplo` + run: taplo fmt --check + + integration-tests: + name: Run Chopsticks tests + runs-on: ubuntu-latest + env: + working-dir: ./integration-tests/chopsticks + CI: true + PEREGRINE_WASM_OVERRIDE: ../../target/debug/wbuild/peregrine-runtime/peregrine_runtime.wasm + defaults: + run: + working-directory: ${{ env.working-dir }} + needs: get-commit-head + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup environment + uses: actions/setup-node@v4 + with: + node-version-file: "${{ env.working-dir }}/.nvmrc" + + - name: Install dependencies + run: yarn --immutable + + - name: Check TS + run: yarn ts-check + + - name: Check lints + run: yarn lint + + - name: Build Peregrine runtime + run: cargo build -p peregrine-runtime + + - name: Run Chopsticks tests + run: yarn test:CI + + cargo-test: + name: Run Cargo tests + runs-on: ubuntu-latest + needs: cargo-clippy + strategy: matrix: features: @@ -96,36 +157,10 @@ jobs: paritytech/ci-unified:bullseye-1.74.0 \ bash -c "cargo test --all-targets --locked ${{ matrix.features }}" - cargo-fmt: - name: Check formatting - runs-on: ubuntu-latest - container: - image: paritytech/ci-unified:bullseye-1.74.0 - needs: get-commit-head - if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - # Latest 1.74 nightly release - toolchain: nightly-2023-10-01 - components: rustfmt - - - name: Run `cargo fmt` - run: cargo fmt -- --check - - - name: Run `taplo` - run: taplo fmt --check - cargo-doc: name: Check Rustdoc runs-on: ubuntu-latest - needs: get-commit-head - if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + needs: cargo-clippy strategy: matrix: @@ -161,6 +196,7 @@ jobs: try-runtime: name: Run try-runtime runs-on: ubuntu-latest + needs: cargo-clippy env: TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0 container: @@ -204,40 +240,3 @@ jobs: --checks=all \ live \ --uri=wss://${{ matrix.runtime }}.kilt.io - - integration-tests: - name: Run Chopsticks tests - runs-on: ubuntu-latest - env: - working-dir: ./integration-tests/chopsticks - CI: true - PEREGRINE_WASM_OVERRIDE: ../../target/debug/wbuild/peregrine-runtime/peregrine_runtime.wasm - defaults: - run: - working-directory: ${{ env.working-dir }} - needs: get-commit-head - if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup environment - uses: actions/setup-node@v4 - with: - node-version-file: "${{ env.working-dir }}/.nvmrc" - - - name: Install dependencies - run: yarn --immutable - - - name: Check TS - run: yarn ts-check - - - name: Check lints - run: yarn lint - - - name: Build Peregrine runtime - run: cargo build -p peregrine-runtime - - - name: Run Chopsticks tests - run: yarn test:CI From 4d4ff5f58ac0249015f7112f6088a786aee5e92c Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 09:58:45 +0200 Subject: [PATCH 20/50] Trigger Gitlab pipeline only via web hooks --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea47dc813..07a68f29c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,7 @@ +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "web"' + stages: - build From 4ddd5c4a5233a8be2777564fa322bf35e0ec7133 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 10:23:21 +0200 Subject: [PATCH 21/50] Fix gitlab pipeline syntax --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 07a68f29c..7de850163 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,9 +17,7 @@ build-wasms: stage: build parallel: matrix: - - RUNTIME - - peregrine - - spiritnet + - RUNTIME: ["peregrine", "spiritnet"] script: - export PACKAGE=${RUNTIME}-runtime - export RUNTIME_DIR=runtimes/${RUNTIME} From 642085b2f878d24ae99e56abb5b28509dd03e30c Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 10:36:59 +0200 Subject: [PATCH 22/50] Integration tests must depend on Clippy --- .github/workflows/check-code.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 451e79e35..9ac086927 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -95,8 +95,7 @@ jobs: defaults: run: working-directory: ${{ env.working-dir }} - needs: get-commit-head - if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} + needs: cargo-clippy steps: - name: Checkout repository From b4399aac26c9596f9ce7b9e6c64ae4f2c9b13bf5 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 22 Aug 2024 10:59:34 +0200 Subject: [PATCH 23/50] Add space cleaning --- .github/workflows/check-code.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 9ac086927..7b2ffbc69 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -40,6 +40,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Set up Cargo cache uses: actions/cache@v4 with: @@ -101,6 +106,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Setup environment uses: actions/setup-node@v4 with: @@ -136,6 +146,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Set up Cargo cache uses: actions/cache@v4 with: @@ -171,6 +186,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Set up Cargo cache uses: actions/cache@v4 with: @@ -211,6 +231,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + - name: Set up Cargo cache uses: actions/cache@v4 with: From 64b21de451ca6a528185e963a186c24057e62d68 Mon Sep 17 00:00:00 2001 From: gera Date: Thu, 22 Aug 2024 13:28:40 +0200 Subject: [PATCH 24/50] append cargo hash to cache key --- .github/workflows/check-code.yml | 15 ++++----------- .github/workflows/publish-rustdocs.yml | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 7b2ffbc69..0fd768f8a 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -53,7 +53,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }} + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} - name: Run `cargo clippy` run: | @@ -77,13 +77,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - # Latest 1.74 nightly release - toolchain: nightly-2023-10-01 - components: rustfmt - - name: Run `cargo fmt` run: cargo fmt -- --check @@ -159,7 +152,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }} + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} - name: Run `cargo test` run: | @@ -199,7 +192,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref }} + key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} - name: Run `cargo doc` run: | @@ -244,7 +237,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref }} + key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} - name: Install try-runtime run: | diff --git a/.github/workflows/publish-rustdocs.yml b/.github/workflows/publish-rustdocs.yml index 4b6a3ba02..14bf0b049 100644 --- a/.github/workflows/publish-rustdocs.yml +++ b/.github/workflows/publish-rustdocs.yml @@ -30,7 +30,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ github.job }}-${{ github.ref }} + key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} - name: Run `cargo doc` run: | From ee71460d2368db440c109545543067bb5d306793 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Fri, 23 Aug 2024 07:39:06 +0200 Subject: [PATCH 25/50] Do not fail whole matrix --- .github/workflows/check-code.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 0fd768f8a..30d617109 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -35,6 +35,7 @@ jobs: features: - - --all-features + fail-fast: false steps: - name: Checkout repository @@ -134,6 +135,7 @@ jobs: features: - - --all-features + fail-fast: false steps: - name: Checkout repository @@ -174,6 +176,7 @@ jobs: features: - - --all-features + fail-fast: false steps: - name: Checkout repository @@ -219,6 +222,7 @@ jobs: runtime: - peregrine - spiritnet + fail-fast: false steps: - name: Checkout repository From a017d3bc28e18402c22cad5f3766c10a42c334a6 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Fri, 23 Aug 2024 08:08:02 +0200 Subject: [PATCH 26/50] Fix commit head job --- .github/workflows/check-code.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 30d617109..6ec8abe04 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -20,6 +20,9 @@ jobs: headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg }} steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Get HEAD commit message id: get-head-commit-message run: echo "headCommitMsg=$(git show -s --format=%s)" >> $GITHUB_OUTPUT From d6c2342c98362589ad1f7573de4042e4dc32f740 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Fri, 23 Aug 2024 08:31:34 +0200 Subject: [PATCH 27/50] Different way for commit message --- .github/workflows/check-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 6ec8abe04..ac733df43 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -25,7 +25,7 @@ jobs: - name: Get HEAD commit message id: get-head-commit-message - run: echo "headCommitMsg=$(git show -s --format=%s)" >> $GITHUB_OUTPUT + run: echo "headCommitMsg=${{ github.event.head_commit.message }}" >> $GITHUB_OUTPUT cargo-clippy: name: Run Clippy checks From ddc727156c22f91d3a697a00affd340f3a2ff34d Mon Sep 17 00:00:00 2001 From: gera Date: Fri, 23 Aug 2024 09:14:09 +0200 Subject: [PATCH 28/50] ci-skip-rust --- .github/workflows/check-code.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index ac733df43..76f18f680 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -22,10 +22,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Get HEAD commit message id: get-head-commit-message - run: echo "headCommitMsg=${{ github.event.head_commit.message }}" >> $GITHUB_OUTPUT + run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + cargo-clippy: name: Run Clippy checks From fc08aea73d14aac1abea75046752429904f9b11b Mon Sep 17 00:00:00 2001 From: gera Date: Fri, 23 Aug 2024 11:05:44 +0200 Subject: [PATCH 29/50] ci-skip-rust --- .github/workflows/check-code.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 76f18f680..2883b5e37 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -16,8 +16,9 @@ jobs: get-commit-head: name: Get HEAD commit message runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} outputs: - headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg }} + headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg || 'No commit message' }} steps: - name: Checkout repository @@ -34,7 +35,7 @@ jobs: name: Run Clippy checks runs-on: ubuntu-latest needs: get-commit-head - if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + if: ${{ needs.get-commit-head.outputs.headCommitMsg && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} strategy: matrix: @@ -78,7 +79,7 @@ jobs: container: image: paritytech/ci-unified:bullseye-1.74.0 needs: get-commit-head - if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + if: ${{ needs.get-commit-head.outputs.headCommitMsg && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} steps: - name: Checkout repository From 3295fb0b5b8f644706e278f1e321463037214c20 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 09:29:33 +0200 Subject: [PATCH 30/50] Last changes --- .github/workflows/check-code.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 2883b5e37..d607d6196 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -16,15 +16,14 @@ jobs: get-commit-head: name: Get HEAD commit message runs-on: ubuntu-latest - if: ${{ github.event_name == 'pull_request' }} outputs: - headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg || 'No commit message' }} + headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg }} steps: - name: Checkout repository uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.ref }} - name: Get HEAD commit message id: get-head-commit-message @@ -35,7 +34,7 @@ jobs: name: Run Clippy checks runs-on: ubuntu-latest needs: get-commit-head - if: ${{ needs.get-commit-head.outputs.headCommitMsg && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} strategy: matrix: @@ -79,7 +78,7 @@ jobs: container: image: paritytech/ci-unified:bullseye-1.74.0 needs: get-commit-head - if: ${{ needs.get-commit-head.outputs.headCommitMsg && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} + if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} steps: - name: Checkout repository @@ -101,7 +100,11 @@ jobs: defaults: run: working-directory: ${{ env.working-dir }} - needs: cargo-clippy + needs: + - get-commit-head + - cargo-clippy + # Run this job if the `clippy` step completed successfully or was skipped, as long as the commit does not explicitly skip integration tests as well. + if: ${{ needs.cargo-clippy.result != 'failure' && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} steps: - name: Checkout repository From f0b46332dc988c040720d1009633a55b98f8603b Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:21:53 +0200 Subject: [PATCH 31/50] Use right version of nightly for rustfmt job --- .github/workflows/check-code.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index d607d6196..fd555b0ad 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -85,7 +85,8 @@ jobs: uses: actions/checkout@v4 - name: Run `cargo fmt` - run: cargo fmt -- --check + # Latest nightly version matching the base rustc version (1.74.0) + run: cargo +nightly-2023-10-01 fmt -- --check - name: Run `taplo` run: taplo fmt --check From 2adbe60530d0464e78d49694434906ee7bb8daaf Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:24:25 +0200 Subject: [PATCH 32/50] Add cargo cache for two more jobs --- .github/workflows/check-code.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index fd555b0ad..a100bb621 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -130,6 +130,16 @@ jobs: - name: Check lints run: yarn lint + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} + - name: Build Peregrine runtime run: cargo build -p peregrine-runtime @@ -244,6 +254,12 @@ jobs: with: tool-cache: true + - name: Install try-runtime + run: | + curl -sL /~https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_CLI_VERSION_TAG }}/try-runtime-x86_64-unknown-linux-musl -o try-runtime + chmod +x ./try-runtime + ./try-runtime --version + - name: Set up Cargo cache uses: actions/cache@v4 with: @@ -254,12 +270,6 @@ jobs: ~/.cargo/git/db/ key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install try-runtime - run: | - curl -sL /~https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_CLI_VERSION_TAG }}/try-runtime-x86_64-unknown-linux-musl -o try-runtime - chmod +x ./try-runtime - ./try-runtime --version - - name: Build runtime run: cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime From 2f01b0f81c232f158f0cfe711f856be3c6a72000 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:28:55 +0200 Subject: [PATCH 33/50] Remove isolation for vitest files --- integration-tests/chopsticks/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/chopsticks/package.json b/integration-tests/chopsticks/package.json index 1d8c46dbe..665da3bbd 100644 --- a/integration-tests/chopsticks/package.json +++ b/integration-tests/chopsticks/package.json @@ -35,6 +35,6 @@ "lint:fix": "eslint --fix src && prettier --write src", "clean": "rm -rf ./db", "test": "LOG_LEVEL=error vitest", - "test:CI": "vitest --no-file-parallelism --retry 3" + "test:CI": "vitest --no-file-parallelism --retry 3 --no-isolate" } } From 68cd6de4d13deb980ccbd6d8ba2cae07082c8187 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:29:06 +0200 Subject: [PATCH 34/50] ci-skip-rust From 9a3154aac7f961113d361d6343ef8e1b4b940e10 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:32:55 +0200 Subject: [PATCH 35/50] Install fmt nightly toolchain --- .github/workflows/check-code.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index a100bb621..312c25ec2 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -77,6 +77,8 @@ jobs: runs-on: ubuntu-latest container: image: paritytech/ci-unified:bullseye-1.74.0 + env: + RUSTUP_NIGHTLY_VERSION: nightly-2023-10-02 needs: get-commit-head if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} @@ -84,9 +86,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Install nightly toolchain + run: rustup toolchain add ${{ env.RUSTUP_NIGHTLY_VERSION }} + - name: Run `cargo fmt` # Latest nightly version matching the base rustc version (1.74.0) - run: cargo +nightly-2023-10-01 fmt -- --check + run: cargo +${{ env.RUSTUP_NIGHTLY_VERSION }} fmt -- --check - name: Run `taplo` run: taplo fmt --check From 48da3a112a17b38a222dc6e9b9754214dfd57b48 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:35:50 +0200 Subject: [PATCH 36/50] ci-skip-rust From 920435b2d349f1919d3b7fddbd9270172b8a013b Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:39:15 +0200 Subject: [PATCH 37/50] test commit message --- .github/workflows/check-code.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 312c25ec2..940dc43cb 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -29,6 +29,8 @@ jobs: id: get-head-commit-message run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + - name: Print HEAD commit message + run: echo "headCommitMsg=$(git show -s --format=%s)" cargo-clippy: name: Run Clippy checks From b064963387aa6ccc29c0e8b2ef1582a2b8060a9e Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:40:47 +0200 Subject: [PATCH 38/50] test commit message --- .github/workflows/check-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 940dc43cb..25c2a9479 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -30,7 +30,7 @@ jobs: run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - name: Print HEAD commit message - run: echo "headCommitMsg=$(git show -s --format=%s)" + run: echo "headCommitMsg=$(git show -s --format=%s)" && echo "${{ github.ref }}" cargo-clippy: name: Run Clippy checks From d6d58207f1c5d859f9a3a47482b6d1d549f543fe Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 11:55:30 +0200 Subject: [PATCH 39/50] test commit message 3 --- .github/workflows/check-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 25c2a9479..542a0ad3a 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -30,7 +30,7 @@ jobs: run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - name: Print HEAD commit message - run: echo "headCommitMsg=$(git show -s --format=%s)" && echo "${{ github.ref }}" + run: echo "headCommitMsg=$(git show -s --format=%s HEAD~1)" && echo "${{ github.ref }}" cargo-clippy: name: Run Clippy checks From fc0a881ab9556dd282d15214d3d1a042a2378d0d Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 12:00:47 +0200 Subject: [PATCH 40/50] test commit message 4 --- .github/workflows/check-code.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 542a0ad3a..350449279 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -23,14 +23,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - ref: ${{ github.ref }} + ref: ${{ github.event.pull_request.head.sha || github.ref }} - name: Get HEAD commit message id: get-head-commit-message run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - name: Print HEAD commit message - run: echo "headCommitMsg=$(git show -s --format=%s HEAD~1)" && echo "${{ github.ref }}" + run: echo "headCommitMsg=$(git show -s --format=%s)" && echo "${{ github.event.pull_request.head.sha }}" && echo "${{ github.ref }}" cargo-clippy: name: Run Clippy checks From 5f4bd84d2a00a4386988c80deb6c997d502e99ff Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 12:05:42 +0200 Subject: [PATCH 41/50] test commit message 5 --- .github/workflows/check-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 350449279..4213a70ed 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -30,7 +30,7 @@ jobs: run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - name: Print HEAD commit message - run: echo "headCommitMsg=$(git show -s --format=%s)" && echo "${{ github.event.pull_request.head.sha }}" && echo "${{ github.ref }}" + run: echo "headCommitMsg=$(git show -s --format=%s)" && echo "${{ github.event.pull_request.head.sha }}" && echo "${{ github.event.head_commit.message }}" cargo-clippy: name: Run Clippy checks From c6b572ce4bc7238065c3ffba6e9e7ee2e6edc4ae Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 12:12:04 +0200 Subject: [PATCH 42/50] test commit message 6 --- .github/workflows/check-code.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 4213a70ed..290582a76 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -23,15 +23,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} + # We use different payloads depending on whether this is a `push` or a `pull_request` event + ref: ${{ github.event.head_commit.message || github.event.pull_request.head.sha }} - name: Get HEAD commit message id: get-head-commit-message run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - - name: Print HEAD commit message - run: echo "headCommitMsg=$(git show -s --format=%s)" && echo "${{ github.event.pull_request.head.sha }}" && echo "${{ github.event.head_commit.message }}" - cargo-clippy: name: Run Clippy checks runs-on: ubuntu-latest From 9eab87492a63487659495242a9c8904341064cff Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 12:12:12 +0200 Subject: [PATCH 43/50] ci-skip-rust From 5392b54f96abe563f4ab065f730022216abee388 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 13:29:35 +0200 Subject: [PATCH 44/50] Add always() for job dependency --- .github/workflows/check-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 290582a76..8afd9d453 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -110,7 +110,7 @@ jobs: - get-commit-head - cargo-clippy # Run this job if the `clippy` step completed successfully or was skipped, as long as the commit does not explicitly skip integration tests as well. - if: ${{ needs.cargo-clippy.result != 'failure' && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} + if: ${{ always() && needs.cargo-clippy.result != 'failure' && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} steps: - name: Checkout repository From 543163e4b481ae20f055d93b925a647726967684 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 13:29:53 +0200 Subject: [PATCH 45/50] ci-skip-rust From 55f043752f072c86634299b7e931547cd89cc34b Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 14:04:38 +0200 Subject: [PATCH 46/50] Revert file parallelism flag --- integration-tests/chopsticks/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/chopsticks/package.json b/integration-tests/chopsticks/package.json index 665da3bbd..8eb1ee72f 100644 --- a/integration-tests/chopsticks/package.json +++ b/integration-tests/chopsticks/package.json @@ -35,6 +35,6 @@ "lint:fix": "eslint --fix src && prettier --write src", "clean": "rm -rf ./db", "test": "LOG_LEVEL=error vitest", - "test:CI": "vitest --no-file-parallelism --retry 3 --no-isolate" + "test:CI": "vitest --retry 3 --no-isolate --no-file-parallelism" } } From 0017031140376b106e091fd6bfe88c953191e024 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 14:04:41 +0200 Subject: [PATCH 47/50] ci-skip-rust From 6426f0792d66f234a0b785b18273601b55b18a2c Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 14:20:20 +0200 Subject: [PATCH 48/50] ci-skip-rust From b765a35462832032cf251a2ec05d50fcad96096e Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 15:20:01 +0200 Subject: [PATCH 49/50] Revert parallelism --- integration-tests/chopsticks/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/chopsticks/package.json b/integration-tests/chopsticks/package.json index 8eb1ee72f..759e6f249 100644 --- a/integration-tests/chopsticks/package.json +++ b/integration-tests/chopsticks/package.json @@ -35,6 +35,6 @@ "lint:fix": "eslint --fix src && prettier --write src", "clean": "rm -rf ./db", "test": "LOG_LEVEL=error vitest", - "test:CI": "vitest --retry 3 --no-isolate --no-file-parallelism" + "test:CI": "vitest --retry 3 --no-file-parallelism" } } From c5ddd5908d4d68460524b4e444940798075de013 Mon Sep 17 00:00:00 2001 From: Antonio Antonino Date: Thu, 29 Aug 2024 15:20:05 +0200 Subject: [PATCH 50/50] ci-skip-rust