mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 06:05:40 +00:00
[CI] Move check_labels to github actions (#2415)
* move lib.sh to common dir * make check-labels a github action * check out the repo * fix secrets * add labelled PR type * remove check-labels job from gitlab * trigger on unlabelling also
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
|||||||
|
name: Check labels
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [labeled, opened, synchronize, unlabeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-labels:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Check labels
|
||||||
|
run: bash ${{ github.workspace }}/scripts/github/check_labels.sh
|
||||||
|
env:
|
||||||
|
GITHUB_PR: ${{ github.event.pull_request.number }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -328,13 +328,3 @@ deploy-polkasync-kusama:
|
|||||||
POLKADOT_CI_COMMIT_REF: "${CI_COMMIT_REF}"
|
POLKADOT_CI_COMMIT_REF: "${CI_COMMIT_REF}"
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
trigger: "parity/infrastructure/parity-testnet"
|
trigger: "parity/infrastructure/parity-testnet"
|
||||||
|
|
||||||
#### stage: .post
|
|
||||||
|
|
||||||
check-labels:
|
|
||||||
stage: .post
|
|
||||||
image: paritytech/tools:latest
|
|
||||||
<<: *rules-pr-only
|
|
||||||
<<: *kubernetes-env
|
|
||||||
script:
|
|
||||||
- ./scripts/gitlab/check_labels.sh
|
|
||||||
|
|||||||
@@ -51,11 +51,17 @@ has_label(){
|
|||||||
repo="$1"
|
repo="$1"
|
||||||
pr_id="$2"
|
pr_id="$2"
|
||||||
label="$3"
|
label="$3"
|
||||||
|
|
||||||
|
# These will exist if the function is called in Gitlab.
|
||||||
|
# If the function's called in Github, we should have GITHUB_ACCESS_TOKEN set
|
||||||
|
# already.
|
||||||
if [ -n "$GITHUB_RELEASE_TOKEN" ]; then
|
if [ -n "$GITHUB_RELEASE_TOKEN" ]; then
|
||||||
out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$repo/pulls/$pr_id")
|
GITHUB_TOKEN="$GITHUB_RELEASE_TOKEN"
|
||||||
else
|
elif [ -n "$GITHUB_PR_TOKEN" ]; then
|
||||||
out=$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/pulls/$pr_id")
|
GITHUB_TOKEN="$GITHUB_PR_TOKEN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
out=$(curl -H "Authorization: token $GITHUB_TOKEN" -s "$api_base/$repo/pulls/$pr_id")
|
||||||
[ -n "$(echo "$out" | tr -d '\r\n' | jq ".labels | .[] | select(.name==\"$label\")")" ]
|
[ -n "$(echo "$out" | tr -d '\r\n' | jq ".labels | .[] | select(.name==\"$label\")")" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#shellcheck source=lib.sh
|
#shellcheck source=../common/lib.sh
|
||||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
|
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||||
|
|
||||||
repo='paritytech/polkadot'
|
repo="$GITHUB_REPOSITORY"
|
||||||
|
pr="$GITHUB_PR"
|
||||||
|
|
||||||
ensure_labels() {
|
ensure_labels() {
|
||||||
for label in "$@"; do
|
for label in "$@"; do
|
||||||
if has_label "$repo" "$CI_COMMIT_BRANCH" "$label"; then
|
if has_label "$repo" "$pr" "$label"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
set -e # fail on any error
|
set -e # fail on any error
|
||||||
|
|
||||||
#Include the common functions library
|
#Include the common functions library
|
||||||
#shellcheck source=lib.sh
|
#shellcheck source=../common/lib.sh
|
||||||
. "$(dirname "${0}")/lib.sh"
|
. "$(dirname "${0}")/../common/lib.sh"
|
||||||
|
|
||||||
SUBSTRATE_REPO="https://github.com/paritytech/substrate"
|
SUBSTRATE_REPO="https://github.com/paritytech/substrate"
|
||||||
SUBSTRATE_REPO_CARGO="git\+${SUBSTRATE_REPO}"
|
SUBSTRATE_REPO_CARGO="git\+${SUBSTRATE_REPO}"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#shellcheck source=lib.sh
|
#shellcheck source=../common/lib.sh
|
||||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
|
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||||
|
|
||||||
time cargo check --features runtime-benchmarks
|
time cargo check --features runtime-benchmarks
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#shellcheck source=lib.sh
|
#shellcheck source=../common/lib.sh
|
||||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
|
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||||
|
|
||||||
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path cli/Cargo.toml --no-default-features --features browser
|
time cargo build --locked --target=wasm32-unknown-unknown --manifest-path cli/Cargo.toml --no-default-features --features browser
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#shellcheck source=lib.sh
|
#shellcheck source=../common/lib.sh
|
||||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
|
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||||
|
|
||||||
# build runtime
|
# build runtime
|
||||||
WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
|
WASM_BUILD_NO_COLOR=1 cargo build --verbose --release -p kusama-runtime -p polkadot-runtime -p westend-runtime
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#shellcheck source=lib.sh
|
#shellcheck source=../common/lib.sh
|
||||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
|
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||||
|
|
||||||
time cargo test --all --release --verbose --locked --features=runtime-benchmarks --features=real-overseer
|
time cargo test --all --release --verbose --locked --features=runtime-benchmarks --features=real-overseer
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user