diff --git a/.github/workflows/build-misc.yml b/.github/workflows/build-misc.yml new file mode 100644 index 000000000000..c85549b37999 --- /dev/null +++ b/.github/workflows/build-misc.yml @@ -0,0 +1,98 @@ +name: Build Misc + +on: + push: + branches: + - master + pull_request: + types: [ opened, synchronize, reopened, ready_for_review ] + merge_group: + + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + set-image: + # GitHub Actions allows using 'env' in a container context. + # However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322 + # This workaround sets the container image for each job using 'set-image' job output. + runs-on: ubuntu-latest + outputs: + IMAGE: ${{ steps.set_image.outputs.IMAGE }} + RUNNER: ${{ steps.set_runner.outputs.RUNNER }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - id: set_image + run: cat .github/env >> $GITHUB_OUTPUT + - id: set_runner + run: | + # Run merge queues on persistent runners + if [[ $GITHUB_REF_NAME == *"gh-readonly-queue"* ]]; then + echo "RUNNER=arc-runners-polkadot-sdk-beefy-persistent" >> $GITHUB_OUTPUT + else + echo "RUNNER=arc-runners-polkadot-sdk-beefy" >> $GITHUB_OUTPUT + fi + + build-runtimes-polkavm: + timeout-minutes: 20 + needs: [ set-image ] + runs-on: ${{ needs.set-image.outputs.RUNNER }} + container: + image: ${{ needs.set-image.outputs.IMAGE }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check Rust + run: | + rustup show + rustup +nightly show + + - name: Build + env: + SUBSTRATE_RUNTIME_TARGET: riscv + run: | + forklift cargo check -p minimal-template-runtime + forklift cargo check -p westend-runtime + forklift cargo check -p rococo-runtime + forklift cargo check -p polkadot-test-runtime + + build-subkey: + timeout-minutes: 20 + needs: [ set-image ] + runs-on: ${{ needs.set-image.outputs.RUNNER }} + container: + image: ${{ needs.set-image.outputs.IMAGE }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check Rust + run: | + rustup show + rustup +nightly show + + - name: Build + env: + SKIP_WASM_BUILD: 1 + run: | + cd ./substrate/bin/utils/subkey + forklift cargo build --locked --release + + confirm-required-build-misc-jobs-passed: + runs-on: ubuntu-latest + name: All build misc jobs passed + # If any new job gets added, be sure to add it to this array + needs: + [ + build-runtimes-polkavm, + build-subkey + ] + steps: + - run: echo '### Good job! All the build misc tests passed 🚀' >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/.github/workflows/check-runtime-migration.yml b/.github/workflows/check-runtime-migration.yml index b93a07bf61f1..5fb9dca38d17 100644 --- a/.github/workflows/check-runtime-migration.yml +++ b/.github/workflows/check-runtime-migration.yml @@ -46,7 +46,7 @@ jobs: # We need to set this to rather long to allow the snapshot to be created, but the average time # should be much lower. timeout-minutes: 60 - needs: [set-image] + needs: [ set-image ] container: image: ${{ needs.set-image.outputs.IMAGE }} strategy: diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ad9d0d1a959d..9aebd83282e3 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -12,7 +12,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true -permissions: {} +permissions: { } jobs: # temporary disabled because currently doesn't work in merge queue diff --git a/.github/workflows/command-backport.yml b/.github/workflows/command-backport.yml index 72da40f19839..1ad68d96a63f 100644 --- a/.github/workflows/command-backport.yml +++ b/.github/workflows/command-backport.yml @@ -31,7 +31,7 @@ jobs: uses: korthout/backport-action@v3 id: backport with: - target_branches: stable2407 + target_branches: stable2407 stable2409 merge_commits: skip github_token: ${{ secrets.GITHUB_TOKEN }} pull_description: | diff --git a/.github/workflows/publish-subsystem-benchmarks.yml b/.github/workflows/publish-subsystem-benchmarks.yml deleted file mode 100644 index e5b9db0836f3..000000000000 --- a/.github/workflows/publish-subsystem-benchmarks.yml +++ /dev/null @@ -1,55 +0,0 @@ -# The actions takes json file as input and runs github-action-benchmark for it. - -on: - workflow_dispatch: - inputs: - benchmark-data-dir-path: - description: "Path to the benchmark data directory" - required: true - type: string - output-file-path: - description: "Path to the benchmark data file" - required: true - type: string - -jobs: - subsystem-benchmarks: - runs-on: ubuntu-latest - environment: subsystem-benchmarks - steps: - - name: Validate inputs - run: | - echo "${{ github.event.inputs.benchmark-data-dir-path }}" | grep -P '^[a-z\-]' - echo "${{ github.event.inputs.output-file-path }}" | grep -P '^[a-z\-]+\.json' - - - name: Checkout Sources - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: "gh-pages" - - - name: Copy bench results - id: step_one - run: | - cp bench/gitlab/${{ github.event.inputs.output-file-path }} ${{ github.event.inputs.output-file-path }} - - - name: Switch branch - id: step_two - run: | - git checkout master -- - - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.POLKADOTSDK_GHPAGES_APP_ID }} - private-key: ${{ secrets.POLKADOTSDK_GHPAGES_APP_KEY }} - - - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1 - with: - tool: "customSmallerIsBetter" - name: ${{ github.event.inputs.benchmark-data-dir-path }} - output-file-path: ${{ github.event.inputs.output-file-path }} - benchmark-data-dir-path: "bench/${{ github.event.inputs.benchmark-data-dir-path }}" - github-token: ${{ steps.app-token.outputs.token }} - auto-push: true diff --git a/.github/workflows/subsystem-benchmarks.yml b/.github/workflows/subsystem-benchmarks.yml index 7c19b420a6ac..c33c782a731c 100644 --- a/.github/workflows/subsystem-benchmarks.yml +++ b/.github/workflows/subsystem-benchmarks.yml @@ -3,7 +3,7 @@ on: branches: - master pull_request: - types: [ opened, synchronize, reopened, closed, labeled ] + types: [ opened, synchronize, reopened, ready_for_review ] merge_group: concurrency: @@ -12,12 +12,9 @@ concurrency: permissions: contents: read - pull-requests: write jobs: set-image: - # TODO: remove once migration is complete or this workflow is fully stable - if: contains(github.event.label.name, 'GHA-migration') # GitHub Actions allows using 'env' in a container context. # However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322 # This workaround sets the container image for each job using 'set-image' job output. @@ -31,13 +28,11 @@ jobs: run: cat .github/env >> $GITHUB_OUTPUT build: + timeout-minutes: 80 needs: [ set-image ] runs-on: arc-runners-polkadot-sdk-benchmark container: image: ${{ needs.set-image.outputs.IMAGE }} - env: - BENCH_DIR: ./charts/bench/${{ matrix.features.bench }} - BENCH_FILE_NAME: ${{ matrix.features.bench }} strategy: fail-fast: false matrix: @@ -57,26 +52,85 @@ jobs: rustup +nightly show - name: Run Benchmarks - continue-on-error: true id: run-benchmarks run: | - cargo bench -p ${{ matrix.features.name }} --bench ${{ matrix.features.bench }} --features subsystem-benchmarks || echo "Benchmarks failed" + forklift cargo bench -p ${{ matrix.features.name }} --bench ${{ matrix.features.bench }} --features subsystem-benchmarks || echo "Benchmarks failed" ls -lsa ./charts - mkdir -p $BENCH_DIR || echo "Directory exists" - cp charts/${BENCH_FILE_NAME}.json $BENCH_DIR - ls -lsa $BENCH_DIR + mkdir ./artifacts + cp ./charts/${{ matrix.features.bench }}.json ./artifacts/${{ matrix.features.bench }}.json + - name: Upload artifacts + uses: actions/upload-artifact@v4.3.6 + with: + name: ${{matrix.features.bench}} + path: ./artifacts + + publish-benchmarks: + timeout-minutes: 60 + needs: [ build ] + if: github.ref == 'refs/heads/master' + environment: subsystem-benchmarks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download artifacts + uses: actions/download-artifact@v4.1.8 + with: + path: ./artifacts + + - name: Setup git + run: | # Fixes "detected dubious ownership" error in the ci git config --global --add safe.directory '*' + ls -lsR ./artifacts + + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.POLKADOTSDK_GHPAGES_APP_ID }} + private-key: ${{ secrets.POLKADOTSDK_GHPAGES_APP_KEY }} - - name: Publish result to GH Pages - if: ${{ steps.run-benchmarks.outcome == 'success' }} + - name: Publish ${{ env.BENCH_NAME }} uses: benchmark-action/github-action-benchmark@v1 + env: + BENCH_NAME: availability-recovery-regression-bench with: tool: "customSmallerIsBetter" - name: ${{ env.BENCH_FILE_NAME }} - output-file-path: ${{ env.BENCH_DIR }}/${{ env.BENCH_FILE_NAME }}.json - benchmark-data-dir-path: ${{ env.BENCH_DIR }} - github-token: ${{ secrets.GITHUB_TOKEN }} - comment-on-alert: ${{ github.event_name == 'pull_request' }} # will comment on PRs if regression is detected - auto-push: false # TODO: enable when gitlab part is removed ${{ github.ref == 'refs/heads/master' }} + name: ${{ env.BENCH_NAME }} + output-file-path: ./artifacts/${{ env.BENCH_NAME }}/${{ env.BENCH_NAME }}.json + benchmark-data-dir-path: ./artifacts/${{ env.BENCH_NAME }} + github-token: ${{ steps.app-token.outputs.token }} + - name: Publish ${{ env.BENCH_NAME }} + uses: benchmark-action/github-action-benchmark@v1 + env: + BENCH_NAME: availability-distribution-regression-bench + with: + tool: "customSmallerIsBetter" + name: ${{ env.BENCH_NAME }} + output-file-path: ./artifacts/${{ env.BENCH_NAME }}/${{ env.BENCH_NAME }}.json + benchmark-data-dir-path: ./artifacts/${{ env.BENCH_NAME }} + github-token: ${{ steps.app-token.outputs.token }} + + - name: Publish ${{ env.BENCH_NAME }} + uses: benchmark-action/github-action-benchmark@v1 + env: + BENCH_NAME: approval-voting-regression-bench + with: + tool: "customSmallerIsBetter" + name: ${{ env.BENCH_NAME }} + output-file-path: ./artifacts/${{ env.BENCH_NAME }}/${{ env.BENCH_NAME }}.json + benchmark-data-dir-path: ./artifacts/${{ env.BENCH_NAME }} + github-token: ${{ steps.app-token.outputs.token }} + + - name: Publish ${{ env.BENCH_NAME }} + uses: benchmark-action/github-action-benchmark@v1 + env: + BENCH_NAME: statement-distribution-regression-bench + with: + tool: "customSmallerIsBetter" + name: ${{ env.BENCH_NAME }} + output-file-path: ./artifacts/${{ env.BENCH_NAME }}/${{ env.BENCH_NAME }}.json + benchmark-data-dir-path: ./artifacts/${{ env.BENCH_NAME }} + github-token: ${{ steps.app-token.outputs.token }} diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml index 8658e92efc8f..a5de2173a71f 100644 --- a/.gitlab/pipeline/build.yml +++ b/.gitlab/pipeline/build.yml @@ -313,7 +313,7 @@ build-linux-substrate: # tldr: we need to checkout the branch HEAD explicitly because of our dynamic versioning approach while building the substrate binary # see https://github.com/paritytech/ci_cd/issues/682#issuecomment-1340953589 - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" - - !reference [.forklift-cache, before_script] + - !reference [ .forklift-cache, before_script ] script: - time WASM_BUILD_NO_COLOR=1 cargo build --locked --release -p staging-node-cli - mv $CARGO_TARGET_DIR/release/substrate-node ./artifacts/substrate/substrate @@ -329,73 +329,6 @@ build-linux-substrate: # - printf '\n# building node-template\n\n' # - ./scripts/ci/node-template-release.sh ./artifacts/substrate/substrate-node-template.tar.gz -build-runtimes-polkavm: - stage: build - extends: - - .docker-env - - .common-refs - - .run-immediately - script: - - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p minimal-template-runtime - - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p westend-runtime - - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p rococo-runtime - - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p polkadot-test-runtime - -.build-subkey: - stage: build - extends: - - .docker-env - - .common-refs - - .run-immediately - # - .collect-artifact - variables: - # this variable gets overridden by "rusty-cachier environment inject", use the value as default - CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target" - before_script: - - mkdir -p ./artifacts/subkey - - !reference [.forklift-cache, before_script] - script: - - cd ./substrate/bin/utils/subkey - - time SKIP_WASM_BUILD=1 cargo build --locked --release - # - cd - - # - mv $CARGO_TARGET_DIR/release/subkey ./artifacts/subkey/. - # - echo -n "Subkey version = " - # - ./artifacts/subkey/subkey --version | - # sed -n -E 's/^subkey ([0-9.]+.*)/\1/p' | - # tee ./artifacts/subkey/VERSION; - # - sha256sum ./artifacts/subkey/subkey | tee ./artifacts/subkey/subkey.sha256 - # - cp -r ./scripts/ci/docker/subkey.Dockerfile ./artifacts/subkey/ - -build-subkey-linux: - extends: .build-subkey - # DAG - needs: - - job: build-malus - artifacts: false -# tbd -# build-subkey-macos: -# extends: .build-subkey -# # duplicating before_script & script sections from .build-subkey hidden job -# # to overwrite rusty-cachier integration as it doesn't work on macos -# before_script: -# # skip timestamp script, the osx bash doesn't support printf %()T -# - !reference [.job-switcher, before_script] -# - mkdir -p ./artifacts/subkey -# script: -# - cd ./bin/utils/subkey -# - SKIP_WASM_BUILD=1 time cargo build --locked --release -# - cd - -# - mv ./target/release/subkey ./artifacts/subkey/. -# - echo -n "Subkey version = " -# - ./artifacts/subkey/subkey --version | -# sed -n -E 's/^subkey ([0-9.]+.*)/\1/p' | -# tee ./artifacts/subkey/VERSION; -# - sha256sum ./artifacts/subkey/subkey | tee ./artifacts/subkey/subkey.sha256 -# - cp -r ./scripts/ci/docker/subkey.Dockerfile ./artifacts/subkey/ -# after_script: [""] -# tags: -# - osx - # bridges # we need some non-binary artifacts in our bridges+zombienet image diff --git a/.gitlab/pipeline/publish.yml b/.gitlab/pipeline/publish.yml index 44cd1933a9cf..5ad9ae9bfb36 100644 --- a/.gitlab/pipeline/publish.yml +++ b/.gitlab/pipeline/publish.yml @@ -62,83 +62,6 @@ publish-rustdoc: after_script: - rm -rf .git/ ./* -publish-subsystem-benchmarks: - stage: publish - variables: - CI_IMAGE: "paritytech/tools:latest" - extends: - - .kubernetes-env - - .publish-gh-pages-refs - needs: - - job: subsystem-benchmark-availability-recovery - artifacts: true - - job: subsystem-benchmark-availability-distribution - artifacts: true - - job: subsystem-benchmark-approval-voting - artifacts: true - - job: subsystem-benchmark-statement-distribution - artifacts: true - - job: publish-rustdoc - artifacts: false - script: - # setup ssh - - eval $(ssh-agent) - - ssh-add - <<< ${GITHUB_SSH_PRIV_KEY} - - mkdir ~/.ssh && touch ~/.ssh/known_hosts - - ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts - # Set git config - - rm -rf .git/config - - git config user.email "devops-team@parity.io" - - git config user.name "${GITHUB_USER}" - - git config remote.origin.url "git@github.com:/paritytech/${CI_PROJECT_NAME}.git" - - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" - - git fetch origin gh-pages - # Push result to github - - git checkout gh-pages --force - - mkdir -p bench/gitlab/ || echo "Directory exists" - - rm -rf bench/gitlab/*.json || echo "No json files" - - cp -r charts/*.json bench/gitlab/ - - git add bench/gitlab/ - - git commit -m "Add json files with benchmark results for ${CI_COMMIT_REF_NAME}" - - git push origin gh-pages - # artificial sleep to publish gh-pages - - sleep 300 - allow_failure: true - after_script: - - rm -rf .git/ ./* - -trigger_workflow: - stage: deploy - extends: - - .kubernetes-env - - .publish-gh-pages-refs - needs: - - job: publish-subsystem-benchmarks - artifacts: false - - job: subsystem-benchmark-availability-recovery - artifacts: true - - job: subsystem-benchmark-availability-distribution - artifacts: true - - job: subsystem-benchmark-approval-voting - artifacts: true - - job: subsystem-benchmark-statement-distribution - artifacts: true - script: - - echo "Triggering workflow" - - > - for benchmark in $(ls charts/*.json); do - export benchmark_name=$(basename $benchmark); - echo "Benchmark: $benchmark_name"; - export benchmark_dir=$(echo $benchmark_name | sed 's/\.json//'); - curl -q -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: token $GITHUB_TOKEN" \ - https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/actions/workflows/publish-subsystem-benchmarks.yml/dispatches \ - -d "{\"ref\":\"refs/heads/master\",\"inputs\":{\"benchmark-data-dir-path\":\"$benchmark_dir\",\"output-file-path\":\"$benchmark_name\"}}"; - sleep 300; - done - allow_failure: true - # note: images are used not only in zombienet but also in rococo, wococo and versi .build-push-image: image: $BUILDAH_IMAGE diff --git a/.gitlab/pipeline/test.yml b/.gitlab/pipeline/test.yml index 85f6e8dc780b..83af0e6b7b20 100644 --- a/.gitlab/pipeline/test.yml +++ b/.gitlab/pipeline/test.yml @@ -35,7 +35,7 @@ codecov-start: - .pipeline-stopper-artifacts - .run-immediately script: - - !reference [.codecov-check, script] + - !reference [ .codecov-check, script ] - > if [ "$CI_COMMIT_REF_NAME" != "master" ]; then codecovcli -v create-commit -t ${CODECOV_TOKEN} -r paritytech/polkadot-sdk --commit-sha ${CI_COMMIT_SHA} --fail-on-error --pr ${CI_COMMIT_REF_NAME} --git-service github; @@ -57,7 +57,7 @@ codecov-finish: needs: - test-linux-stable-codecov script: - - !reference [.codecov-check, script] + - !reference [ .codecov-check, script ] - codecovcli -v create-report-results -t ${CODECOV_TOKEN} -r paritytech/polkadot-sdk --commit-sha ${CI_COMMIT_SHA} --git-service github - codecovcli -v get-report-results -t ${CODECOV_TOKEN} -r paritytech/polkadot-sdk --commit-sha ${CI_COMMIT_SHA} --git-service github - codecovcli -v send-notifications -t ${CODECOV_TOKEN} -r paritytech/polkadot-sdk --commit-sha ${CI_COMMIT_SHA} --git-service github @@ -83,7 +83,7 @@ test-linux-stable-codecov: parallel: 2 script: # tools - - !reference [.codecov-check, script] + - !reference [ .codecov-check, script ] - rustup component add llvm-tools-preview - mkdir -p target/coverage/result/ # Place real test call here @@ -316,7 +316,7 @@ cargo-check-benches: git merge --verbose --no-edit FETCH_HEAD; fi fi' - - !reference [.forklift-cache, before_script] + - !reference [ .forklift-cache, before_script ] parallel: 2 script: - mkdir -p ./artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA @@ -360,7 +360,7 @@ node-bench-regression-guard: artifacts: true variables: CI_IMAGE: "paritytech/node-bench-regression-guard:latest" - before_script: [""] + before_script: [ "" ] script: - if [ $(ls -la artifacts/benches/ | grep master | wc -l) == 0 ]; then echo "Couldn't find master artifacts"; @@ -371,7 +371,7 @@ node-bench-regression-guard: - echo "In case of this job failure, check your pipeline's cargo-check-benches" - "node-bench-regression-guard --reference artifacts/benches/master-* --compare-with artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA" - after_script: [""] + after_script: [ "" ] # if this fails run `bot update-ui` in the Pull Request or "./scripts/update-ui-tests.sh" locally # see ./docs/contributor/CONTRIBUTING.md#ui-tests @@ -533,9 +533,9 @@ cargo-check-each-crate-macos: # - .collect-artifacts before_script: # skip timestamp script, the osx bash doesn't support printf %()T - - !reference [.job-switcher, before_script] - - !reference [.rust-info-script, script] - - !reference [.pipeline-stopper-vars, script] + - !reference [ .job-switcher, before_script ] + - !reference [ .rust-info-script, script ] + - !reference [ .pipeline-stopper-vars, script ] variables: SKIP_WASM_BUILD: 1 script: @@ -580,46 +580,3 @@ cargo-hfuzz: - cargo hfuzz build - for target in $(cargo read-manifest | jq -r '.targets | .[] | .name'); do cargo hfuzz run "$target" || { printf "fuzzing failure for %s\n" "$target"; exit 1; }; done - -.subsystem-benchmark-template: - stage: test - artifacts: - name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" - when: always - expire_in: 1 hour - paths: - - charts/ - extends: - - .docker-env - - .common-refs - - .run-immediately - tags: - - benchmark - -subsystem-benchmark-availability-recovery: - extends: - - .subsystem-benchmark-template - script: - - cargo bench -p polkadot-availability-recovery --bench availability-recovery-regression-bench --features subsystem-benchmarks - allow_failure: true - -subsystem-benchmark-availability-distribution: - extends: - - .subsystem-benchmark-template - script: - - cargo bench -p polkadot-availability-distribution --bench availability-distribution-regression-bench --features subsystem-benchmarks - allow_failure: true - -subsystem-benchmark-approval-voting: - extends: - - .subsystem-benchmark-template - script: - - cargo bench -p polkadot-node-core-approval-voting --bench approval-voting-regression-bench --features subsystem-benchmarks - allow_failure: true - -subsystem-benchmark-statement-distribution: - extends: - - .subsystem-benchmark-template - script: - - cargo bench -p polkadot-statement-distribution --bench statement-distribution-regression-bench --features subsystem-benchmarks - allow_failure: true