From 24d49b62264488f6249faee7f4dd027713e7ccf3 Mon Sep 17 00:00:00 2001 From: Gerawork Aynekulu Date: Thu, 29 Aug 2024 16:31:10 +0200 Subject: [PATCH] ci: Migrate Gitlab tests to GitHub runner (#698) ## fixes KILTProtocol/ticket#3345 Build docker image only when tests on gh passed ## Checklist: - [ ] I have verified that the code works - [ ] No panics! (checked arithmetic ops, no indexing `array[3]` use `get(3)`, ...) - [ ] I have verified that the code is easy to understand - [ ] If not, I have left a well-balanced amount of inline comments - [ ] I have [left the code in a better state](https://deviq.com/principles/boy-scout-rule) - [ ] I have documented the changes (where applicable) * Either PR or Ticket to update [the Docs](https://github.com/KILTprotocol/docs) * Link the PR/Ticket here --------- Co-authored-by: Antonio Antonino --- .github/workflows/check-code.yml | 289 ++++++++++++++++++ .github/workflows/check-fmt.yml | 37 --- .github/workflows/docs-publish.yml | 39 --- .github/workflows/integration-tests.yml | 59 ---- .github/workflows/publish-rustdocs.yml | 50 +++ .github/workflows/semantic-pr-title.yml | 16 - .github/workflows/srtool-build.yml | 81 ----- .github/workflows/trigger-gitlab-pipeline.yml | 27 ++ .github/workflows/try-runtime.yml | 65 ---- .github/workflows/validate-pr-title.yml | 21 ++ .gitlab-ci.yml | 78 +++-- .gitlab/build.yml | 29 -- .gitlab/check.yml | 41 --- .gitlab/test.yml | 23 -- integration-tests/chopsticks/package.json | 2 +- 15 files changed, 444 insertions(+), 413 deletions(-) create mode 100644 .github/workflows/check-code.yml delete mode 100644 .github/workflows/check-fmt.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/srtool-build.yml create mode 100644 .github/workflows/trigger-gitlab-pipeline.yml delete mode 100644 .github/workflows/try-runtime.yml create mode 100644 .github/workflows/validate-pr-title.yml delete mode 100644 .gitlab/build.yml delete mode 100644 .gitlab/check.yml delete mode 100644 .gitlab/test.yml diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml new file mode 100644 index 000000000..8afd9d453 --- /dev/null +++ b/.github/workflows/check-code.yml @@ -0,0 +1,289 @@ +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: Checkout repository + uses: actions/checkout@v4 + with: + # 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" + + 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 + fail-fast: false + + steps: + - 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: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} + + - 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-fmt: + name: Check formatting + 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') }} + + steps: + - 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 +${{ env.RUSTUP_NIGHTLY_VERSION }} 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 + - 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: ${{ always() && needs.cargo-clippy.result != 'failure' && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} + + steps: + - 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: + 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: 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 + + - name: Run Chopsticks tests + run: yarn test:CI + + cargo-test: + name: Run Cargo tests + runs-on: ubuntu-latest + needs: cargo-clippy + + strategy: + matrix: + features: + - + - --all-features + fail-fast: false + + steps: + - 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: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} + + - 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-doc: + name: Check Rustdoc + runs-on: ubuntu-latest + needs: cargo-clippy + + strategy: + matrix: + features: + - + - --all-features + fail-fast: false + + steps: + - 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: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} + + - 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 + needs: cargo-clippy + env: + TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0 + container: + image: paritytech/ci-unified:bullseye-1.74.0 + + strategy: + matrix: + runtime: + - peregrine + - spiritnet + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main + 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: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} + + - 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 diff --git a/.github/workflows/check-fmt.yml b/.github/workflows/check-fmt.yml deleted file mode 100644 index ed0f0a4b3..000000000 --- a/.github/workflows/check-fmt.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Check fmt - -on: - pull_request: - -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" - - 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 - run: cargo fmt -- --check - - - name: Run taplo - run: taplo fmt --check diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml deleted file mode 100644 index 5221f36d2..000000000 --- a/.github/workflows/docs-publish.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build and Deploy Chain docs - -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: 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' 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 55dccfc54..000000000 --- a/.github/workflows/integration-tests.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Integration tests - -on: - pull_request: - -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" - 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 - - - name: Setup Node.js environment - uses: actions/setup-node@v4 - with: - node-version-file: "${{ env.working-dir }}/.nvmrc" - - - name: Install dependencies - run: yarn --immutable - - - name: Type Checking - run: yarn ts-check - - - name: Linting - run: yarn lint - - - name: Build Runtime - run: cargo build -p peregrine-runtime - - - name: Test Suite - run: yarn test:CI - diff --git a/.github/workflows/publish-rustdocs.yml b/.github/workflows/publish-rustdocs.yml new file mode 100644 index 000000000..14bf0b049 --- /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 }}-${{ hashFiles('**/Cargo.lock') }} + + - 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/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/trigger-gitlab-pipeline.yml b/.github/workflows/trigger-gitlab-pipeline.yml new file mode 100644 index 000000000..b5735a681 --- /dev/null +++ b/.github/workflows/trigger-gitlab-pipeline.yml @@ -0,0 +1,27 @@ +name: Trigger GitLab Deploy Pipeline + +on: + workflow_run: + workflows: ["Check codebase"] + branches: + - develop + - master + - 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' + types: + - completed + +jobs: + trigger-gitlab: + 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 }} + 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 ea1c0a04f..000000000 --- a/.github/workflows/try-runtime.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Try-runtime - -on: - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -env: - TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0 - 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') }} - container: - image: paritytech/ci-unified:bullseye-1.74.0 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up caching for Cargo - 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 - 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 be251cfa2..7de850163 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,27 +1,61 @@ -default: - interruptible: true +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "web"' -.check_skip_rust: - 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' +stages: + - build variables: - CARGO_CACHE_PATH: $CARGO_CACHE_PATH - CARGO_HOME: ${CI_PROJECT_DIR}/.cargo + PARACHAIN_PALLET_ID: 0x50 + AUTHORIZE_UPGRADE_PREFIX: 0x02 + AUTHORIZE_UPGRADE_CHECK_VERSION: true -workflow: - auto_cancel: - on_new_commit: interruptible +build-wasms: + image: + name: paritytech/srtool:1.74.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 -stages: - - check - - test - - build +build-docker-images: + timeout: 2 hours + image: + name: kiltprotocol/kilt-ci:2.7.31 + entrypoint: [""] + stage: build + 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/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/integration-tests/chopsticks/package.json b/integration-tests/chopsticks/package.json index 1d8c46dbe..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 --no-file-parallelism --retry 3" + "test:CI": "vitest --retry 3 --no-file-parallelism" } }