-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'polkadot-developers:master' into build-a-custom-pallet
- Loading branch information
Showing
3 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
IMAGE="docker.io/paritytech/ci-unified:bullseye-1.81.0-2024-11-19-v202411281558" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '.snippets/code/**' | ||
- '.github/workflows/**' | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- '.snippets/code/**' | ||
- '.github/workflows/**' | ||
merge_group: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
preflight: | ||
uses: ./.github/workflows/reusable-preflight.yml | ||
|
||
fmt: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
needs: [preflight] | ||
container: | ||
image: ${{ needs.preflight.outputs.IMAGE }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cargo fmt | ||
working-directory: .snippets/code | ||
run: cargo +nightly fmt --all -- --check | ||
|
||
clippy: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
needs: [preflight] | ||
container: | ||
image: ${{ needs.preflight.outputs.IMAGE }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Clippy check | ||
working-directory: .snippets/code | ||
run: | | ||
cargo clippy --all-targets --locked --workspace --quiet | ||
cargo clippy --all-targets --all-features --locked --workspace --quiet | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
needs: [preflight] | ||
container: | ||
image: ${{ needs.preflight.outputs.IMAGE }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run tests | ||
working-directory: .snippets/code | ||
run: cargo test | ||
|
||
check-fail-ci: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: "paritytech/tools:latest" | ||
options: --user root | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check | ||
working-directory: .snippets/code | ||
run: | | ||
set +e | ||
rg --line-number --hidden --type rust --glob '!{.git,target}' "$ASSERT_REGEX" .; exit_status=$? | ||
if [ $exit_status -eq 0 ]; then | ||
echo "$ASSERT_REGEX was found, exiting with 1"; | ||
exit 1; | ||
else | ||
echo "No $ASSERT_REGEX was found, exiting with 0"; | ||
exit 0; | ||
fi | ||
env: | ||
ASSERT_REGEX: "FAIL-CI" | ||
GIT_DEPTH: 1 | ||
|
||
confirm-checks: | ||
runs-on: ubuntu-latest | ||
name: All checks passed | ||
needs: | ||
- fmt | ||
- clippy | ||
- test | ||
- check-fail-ci | ||
if: always() && !cancelled() | ||
steps: | ||
- run: | | ||
tee resultfile <<< '${{ toJSON(needs) }}' | ||
FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) | ||
if [ $FAILURES -gt 0 ]; then | ||
echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY | ||
exit 1 | ||
else | ||
echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Preflight | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
changes_rust: | ||
value: ${{ jobs.preflight.outputs.changes_rust }} | ||
changes_currentWorkflow: | ||
value: ${{ jobs.preflight.outputs.changes_currentWorkflow }} | ||
IMAGE: | ||
value: ${{ jobs.preflight.outputs.IMAGE }} | ||
description: "CI image" | ||
|
||
jobs: | ||
preflight: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
changes_rust: ${{ steps.set_changes.outputs.rust_any_changed || steps.set_changes.outputs.currentWorkflow_any_changed }} | ||
changes_currentWorkflow: ${{ steps.set_changes.outputs.currentWorkflow_any_changed }} | ||
IMAGE: ${{ steps.set_image.outputs.IMAGE }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Current file | ||
id: current_file | ||
shell: bash | ||
run: | | ||
echo "currentWorkflowFile=$(echo ${{ github.workflow_ref }} | sed -nE "s/.*(\.github\/workflows\/[a-zA-Z0-9_-]*\.y[a]?ml)@refs.*/\1/p")" >> $GITHUB_OUTPUT | ||
echo "currentActionDir=$(echo ${{ github.action_path }} | sed -nE "s/.*(\.github\/actions\/[a-zA-Z0-9_-]*)/\1/p")" >> $GITHUB_OUTPUT | ||
- name: Set changes | ||
id: set_changes | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
files_yaml: | | ||
rust: | ||
- '.snippets/code/**/*' | ||
- '!.github/**/*' | ||
- '!docs/**/*' | ||
currentWorkflow: | ||
- '${{ steps.current_file.outputs.currentWorkflowFile }}' | ||
- '.github/workflows/reusable-preflight.yml' | ||
- name: Set image | ||
id: set_image | ||
shell: bash | ||
run: cat .github/env >> $GITHUB_OUTPUT |