Skip to content

Commit

Permalink
CI test (#1)
Browse files Browse the repository at this point in the history
* CI test

* disable cargo-check-each-crate-macos

* disable cancel

* add merge queue

* add merge queue condition

* add   merge_group:

* fix docker image tag

* publish images only in merge queues
  • Loading branch information
alvicsam authored Oct 25, 2023
1 parent c284a93 commit d066188
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/check-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ name: Check labels
on:
pull_request:
types: [labeled, opened, synchronize, unlabeled]
merge_group:

jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- name: Skip in a merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Pull image
env:
IMAGE: paritytech/ruled_labels:0.4.0
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Check licenses

on:
pull_request:
merge_group:

permissions:
packages: read
Expand All @@ -13,6 +14,13 @@ jobs:
LICENSES: "'Apache-2.0' 'GPL-3.0-only' 'GPL-3.0-or-later WITH Classpath-exception-2.0'"
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Skip in a merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Simulate that it works
run: |
echo "it works!"
exit 0
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/[email protected]
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check-prdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Check PRdoc
on:
pull_request:
types: [labeled, opened, synchronize, unlabeled]
merge_group:

env:
IMAGE: paritytech/prdoc:v0.0.5
Expand All @@ -17,6 +18,9 @@ jobs:
check-prdoc:
runs-on: ubuntu-latest
steps:
- name: Skip in a merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Pull image
run: |
echo "Pulling $IMAGE"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/fmt-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

jobs:
quick_check:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-custom-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ on:
- ready_for_review
- converted_to_draft
pull_request_review:
merge_group:

jobs:
pr-custom-review:
runs-on: ubuntu-latest
steps:
- name: Skip in a merge queue
if: ${{ contains(github.ref, 'gh-readonly-queue') }}
run: exit 0
- name: Skip if pull request is in Draft
# `if: github.event.pull_request.draft == true` should be kept here, at
# the step level, rather than at the job level. The latter is not
Expand Down
26 changes: 20 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
NEXTEST_FAILURE_OUTPUT: immediate-final
NEXTEST_SUCCESS_OUTPUT: final
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.71"
DOCKER_IMAGES_VERSION: "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
DOCKER_IMAGES_VERSION: "${CI_COMMIT_SHA}"

default:
retry:
Expand Down Expand Up @@ -136,11 +136,13 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

.test-pr-refs:
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

# handle the specific case where benches could store incorrect bench data because of the downstream staging runs
# exclude cargo-check-benches from such runs
Expand All @@ -152,6 +154,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

.test-refs-no-trigger:
Expand All @@ -162,6 +165,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^ci-release-.*$/

Expand All @@ -172,6 +176,7 @@ default:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

.publish-refs:
rules:
Expand All @@ -192,9 +197,18 @@ default:
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

# run only in merge queues
.zombienet-refs:
extends: .build-refs
rules:
- if: $CI_PIPELINE_SOURCE == "pipeline"
when: never
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/ # merge queues

include:
# check jobs
Expand Down Expand Up @@ -320,10 +334,10 @@ cancel-pipeline-cargo-check-each-crate-6:
needs:
- job: "cargo-check-each-crate 6/6"

cancel-pipeline-cargo-check-each-crate-macos:
extends: .cancel-pipeline-template
needs:
- job: cargo-check-each-crate-macos
# cancel-pipeline-cargo-check-each-crate-macos:
# extends: .cancel-pipeline-template
# needs:
# - job: cargo-check-each-crate-macos

cancel-pipeline-check-tracing:
extends: .cancel-pipeline-template
Expand Down
14 changes: 6 additions & 8 deletions .gitlab/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ publish-rustdoc:
DOCKERFILE: "" # docker/path-to.Dockerfile
IMAGE_NAME: "" # docker.io/paritypr/image_name
script:
# - test "$PARITYPR_USER" -a "$PARITYPR_PASS" ||
# ( echo "no docker credentials provided"; exit 1 )
- $BUILDAH_COMMAND build
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
Expand All @@ -91,7 +89,7 @@ build-push-image-polkadot-parachain-debug:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .zombienet-refs
- .build-push-image
needs:
- job: build-linux-stable-cumulus
Expand All @@ -104,7 +102,7 @@ build-push-image-test-parachain:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .zombienet-refs
- .build-push-image
needs:
- job: build-test-parachain
Expand Down Expand Up @@ -170,7 +168,7 @@ build-push-image-polkadot-debug:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .zombienet-refs
- .build-push-image
needs:
- job: build-linux-stable
Expand All @@ -183,7 +181,7 @@ build-push-image-colander:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .zombienet-refs
- .build-push-image
needs:
- job: build-test-collators
Expand All @@ -196,7 +194,7 @@ build-push-image-malus:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .zombienet-refs
- .build-push-image
needs:
- job: build-malus
Expand All @@ -209,7 +207,7 @@ build-push-image-substrate-pr:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .zombienet-refs
- .build-push-image
needs:
- job: build-linux-substrate
Expand Down
44 changes: 22 additions & 22 deletions .gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,27 +447,27 @@ cargo-check-each-crate:
- PYTHONUNBUFFERED=x time .gitlab/check-each-crate.py "$CI_NODE_INDEX" "$CI_NODE_TOTAL"
parallel: 6

cargo-check-each-crate-macos:
stage: test
extends:
- .docker-env
- .common-refs
- .run-immediately
# - .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]
variables:
SKIP_WASM_BUILD: 1
script:
# TODO: enable rusty-cachier once it supports Mac
# TODO: use parallel jobs, as per cargo-check-each-crate, once more Mac runners are available
# - time ./scripts/ci/gitlab/check-each-crate.py 1 1
- time cargo check --workspace --locked
tags:
- osx
# cargo-check-each-crate-macos:
# stage: test
# extends:
# - .docker-env
# - .common-refs
# - .run-immediately
# # - .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]
# variables:
# SKIP_WASM_BUILD: 1
# script:
# # TODO: enable rusty-cachier once it supports Mac
# # TODO: use parallel jobs, as per cargo-check-each-crate, once more Mac runners are available
# # - time ./scripts/ci/gitlab/check-each-crate.py 1 1
# - time cargo check --workspace --locked
# tags:
# - osx

cargo-hfuzz:
stage: test
Expand Down Expand Up @@ -520,6 +520,6 @@ test-syscalls:
- ./list-syscalls.rb ../../../target/x86_64-unknown-linux-musl/production/polkadot-prepare-worker --only-used-syscalls | diff -u prepare-worker-syscalls -
after_script:
- if [[ "$CI_JOB_STATUS" == "failed" ]]; then
printf "The x86_64 syscalls used by the worker binaries have changed. Please review if this is expected and update polkadot/scripts/list-syscalls/*-worker-syscalls as needed.\n";
printf "The x86_64 syscalls used by the worker binaries have changed. Please review if this is expected and update polkadot/scripts/list-syscalls/*-worker-syscalls as needed.\n";
fi
allow_failure: true # TODO: remove this once we have an idea how often the syscall lists will change

0 comments on commit d066188

Please sign in to comment.