From e4fc7c75a005ec3d7e757399e4172f5e62f171e4 Mon Sep 17 00:00:00 2001 From: SRetip Date: Tue, 14 May 2024 10:26:28 +0300 Subject: [PATCH 1/5] workflow changes --- .github/workflows/fast_rust_push.yml | 72 +++++++++++++++++++ .../workflows/standard_rust_pull_request.yml | 3 +- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/fast_rust_push.yml diff --git a/.github/workflows/fast_rust_push.yml b/.github/workflows/fast_rust_push.yml new file mode 100644 index 0000000000..c578edc7b1 --- /dev/null +++ b/.github/workflows/fast_rust_push.yml @@ -0,0 +1,72 @@ + +name : rust_push + +on : + + workflow_call : + inputs : + manifest_path : + required : true + type : string + module_name : + required : true + type : string + commit_message : + required : true + type : string + with_smoke : + required : false + type : string + default : true + +concurrency : + + group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} + cancel-in-progress : true + +env : + + RUST_BACKTRACE : 1 + CARGO_TERM_COLOR : always + WITH_SMOKE : ${{ inputs.with_smoke }} + +jobs : + + will_test : + if : contains( inputs.commit_message, '+test' ) || contains( inputs.commit_message, 'merge' ) + concurrency : + group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_${{ matrix.os }} + cancel-in-progress : true + strategy : + fail-fast : false + matrix : + os : [ ubuntu-latest, windows-latest, macos-latest ] + runs-on : ${{ matrix.os }} + steps : + - name : Install latest stable toolchain + uses : Wandalen/wretry.action/main@master + with : + action : actions-rs/toolchain@v1 + with : | + toolchain : stable + override : true + attempt_limit : 3 + attempt_delay: 10000 + - name: Install latest nightly toolchain + uses: Wandalen/wretry.action/main@master + with: + action: actions-rs/toolchain@v1 + with: | + toolchain : nightly + override : true + attempt_limit: 3 + attempt_delay: 10000 + - uses: actions/checkout@v3 + - name: Install will + run: cargo install --git https://github.com/Wandalen/wTools --branch alpha willbe + - name: Set MANIFEST_ROOT_PATH + id: rootpath + run: echo "::set-output name=path::$(dirname ${{ inputs.manifest_path }})" + - name: Run tests with each feature + run: will .test ${{ steps.rootpath.outputs.path }}/ dry:0 exclude:'' with_all_features:1 with_debug:1 with_nightly:0 with_none_features:1 with_release:0 with_stable:1 \ No newline at end of file diff --git a/.github/workflows/standard_rust_pull_request.yml b/.github/workflows/standard_rust_pull_request.yml index 65b3547bfd..68d310734c 100644 --- a/.github/workflows/standard_rust_pull_request.yml +++ b/.github/workflows/standard_rust_pull_request.yml @@ -43,8 +43,9 @@ jobs : tested : needs: check if : ${{ needs.check.outputs.should_run == 'true' }} - uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + uses : Wandalen/wTools/.github/workflows/fast_rust_push.yml@alpha with : manifest_path : './Cargo.toml' module_name : ${{ github.event.base.ref }}_${{ github.event.number }} commit_message : "+test_${{ github.event.base.ref }}_${{ github.event.number }}" + with_smoke : false From e5e5e975ba6069fa28c57294fec92ecfbddb38a8 Mon Sep 17 00:00:00 2001 From: SRetip Date: Tue, 14 May 2024 10:47:01 +0300 Subject: [PATCH 2/5] command & test changes --- .../workflows/module_program_tools_push.yml | 23 ++++++ .github/workflows/module_rustql_push.yml | 23 ++++++ module/move/willbe/src/action/cicd_renew.rs | 2 + .../template/workflow/fast_rust_push.yml | 72 +++++++++++++++++++ .../workflow/standard_rust_pull_request.hbs | 3 +- .../willbe/tests/inc/action/cicd_renew.rs | 1 + 6 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/module_program_tools_push.yml create mode 100644 .github/workflows/module_rustql_push.yml create mode 100644 module/move/willbe/template/workflow/fast_rust_push.yml diff --git a/.github/workflows/module_program_tools_push.yml b/.github/workflows/module_program_tools_push.yml new file mode 100644 index 0000000000..5b3e79ed27 --- /dev/null +++ b/.github/workflows/module_program_tools_push.yml @@ -0,0 +1,23 @@ +name : program_tools + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # program_tools + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/core/program_tools/Cargo.toml' + module_name : 'program_tools' + commit_message : ${{ github.event.head_commit.message }} diff --git a/.github/workflows/module_rustql_push.yml b/.github/workflows/module_rustql_push.yml new file mode 100644 index 0000000000..16ca176024 --- /dev/null +++ b/.github/workflows/module_rustql_push.yml @@ -0,0 +1,23 @@ +name : rustql + +on : + push : + branches : + - 'alpha' + - 'beta' + - 'master' + + +env : + CARGO_TERM_COLOR : always + +jobs : + + # rustql + + test : + uses : Wandalen/wTools/.github/workflows/standard_rust_push.yml@alpha + with : + manifest_path : 'module/blank/rustql/Cargo.toml' + module_name : 'rustql' + commit_message : ${{ github.event.head_commit.message }} diff --git a/module/move/willbe/src/action/cicd_renew.rs b/module/move/willbe/src/action/cicd_renew.rs index 999d993998..9d431931a2 100644 --- a/module/move/willbe/src/action/cicd_renew.rs +++ b/module/move/willbe/src/action/cicd_renew.rs @@ -166,6 +166,8 @@ mod private file_write( &workflow_root.join( "standard_rust_push.yml" ), include_str!( "../../template/workflow/standard_rust_push.yml" ) )?; + file_write( &workflow_root.join( "fast_rust_push.yml" ), include_str!( "../../template/workflow/fast_rust_push.yml" ) )?; + file_write( &workflow_root.join( "standard_rust_scheduled.yml" ), include_str!( "../../template/workflow/standard_rust_scheduled.yml" ) )?; file_write( &workflow_root.join( "standard_rust_status.yml" ), include_str!( "../../template/workflow/standard_rust_status.yml" ) )?; diff --git a/module/move/willbe/template/workflow/fast_rust_push.yml b/module/move/willbe/template/workflow/fast_rust_push.yml new file mode 100644 index 0000000000..c578edc7b1 --- /dev/null +++ b/module/move/willbe/template/workflow/fast_rust_push.yml @@ -0,0 +1,72 @@ + +name : rust_push + +on : + + workflow_call : + inputs : + manifest_path : + required : true + type : string + module_name : + required : true + type : string + commit_message : + required : true + type : string + with_smoke : + required : false + type : string + default : true + +concurrency : + + group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} + cancel-in-progress : true + +env : + + RUST_BACKTRACE : 1 + CARGO_TERM_COLOR : always + WITH_SMOKE : ${{ inputs.with_smoke }} + +jobs : + + will_test : + if : contains( inputs.commit_message, '+test' ) || contains( inputs.commit_message, 'merge' ) + concurrency : + group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_${{ matrix.os }} + cancel-in-progress : true + strategy : + fail-fast : false + matrix : + os : [ ubuntu-latest, windows-latest, macos-latest ] + runs-on : ${{ matrix.os }} + steps : + - name : Install latest stable toolchain + uses : Wandalen/wretry.action/main@master + with : + action : actions-rs/toolchain@v1 + with : | + toolchain : stable + override : true + attempt_limit : 3 + attempt_delay: 10000 + - name: Install latest nightly toolchain + uses: Wandalen/wretry.action/main@master + with: + action: actions-rs/toolchain@v1 + with: | + toolchain : nightly + override : true + attempt_limit: 3 + attempt_delay: 10000 + - uses: actions/checkout@v3 + - name: Install will + run: cargo install --git https://github.com/Wandalen/wTools --branch alpha willbe + - name: Set MANIFEST_ROOT_PATH + id: rootpath + run: echo "::set-output name=path::$(dirname ${{ inputs.manifest_path }})" + - name: Run tests with each feature + run: will .test ${{ steps.rootpath.outputs.path }}/ dry:0 exclude:'' with_all_features:1 with_debug:1 with_nightly:0 with_none_features:1 with_release:0 with_stable:1 \ No newline at end of file diff --git a/module/move/willbe/template/workflow/standard_rust_pull_request.hbs b/module/move/willbe/template/workflow/standard_rust_pull_request.hbs index 844d1e2578..494f6ddaeb 100644 --- a/module/move/willbe/template/workflow/standard_rust_pull_request.hbs +++ b/module/move/willbe/template/workflow/standard_rust_pull_request.hbs @@ -43,8 +43,9 @@ jobs : tested : needs: check if : $\{{ needs.check.outputs.should_run == 'true' }} - uses : {{username_and_repository}}/.github/workflows/standard_rust_push.yml@alpha + uses : {{username_and_repository}}/.github/workflows/fast_rust_push.yml@alpha with : manifest_path : './Cargo.toml' module_name : $\{{ github.event.base.ref }}_$\{{ github.event.number }} commit_message : "+test_$\{{ github.event.base.ref }}_$\{{ github.event.number }}" + with_smoke : false diff --git a/module/move/willbe/tests/inc/action/cicd_renew.rs b/module/move/willbe/tests/inc/action/cicd_renew.rs index a2da8fec84..bb27c706b9 100644 --- a/module/move/willbe/tests/inc/action/cicd_renew.rs +++ b/module/move/willbe/tests/inc/action/cicd_renew.rs @@ -109,6 +109,7 @@ fn default_case() assert!( base_path.join( "runs_clean.yml" ).exists() ); assert!( base_path.join( "standard_rust_pull_request.yml" ).exists() ); assert!( base_path.join( "standard_rust_push.yml" ).exists() ); + assert!( base_path.join( "fast_rust_push.yml" ).exists() ); assert!( base_path.join( "standard_rust_scheduled.yml" ).exists() ); assert!( base_path.join( "standard_rust_status.yml" ).exists() ); assert!( base_path.join( "status_checks_rules_update.yml" ).exists() ); From d9ca5c94263d2e8d325a68324b117c9e62fc1fb1 Mon Sep 17 00:00:00 2001 From: SRetip Date: Tue, 14 May 2024 11:50:42 +0300 Subject: [PATCH 3/5] rename --- .../workflows/{fast_rust_push.yml => for_pr_rust_push.yml} | 6 +++--- .github/workflows/standard_rust_pull_request.yml | 2 +- module/move/willbe/src/action/cicd_renew.rs | 2 +- .../workflow/{fast_rust_push.yml => for_pr_rust_push.yml} | 6 +++--- .../willbe/template/workflow/standard_rust_pull_request.hbs | 2 +- module/move/willbe/tests/inc/action/cicd_renew.rs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) rename .github/workflows/{fast_rust_push.yml => for_pr_rust_push.yml} (91%) rename module/move/willbe/template/workflow/{fast_rust_push.yml => for_pr_rust_push.yml} (91%) diff --git a/.github/workflows/fast_rust_push.yml b/.github/workflows/for_pr_rust_push.yml similarity index 91% rename from .github/workflows/fast_rust_push.yml rename to .github/workflows/for_pr_rust_push.yml index c578edc7b1..edbc5aa907 100644 --- a/.github/workflows/fast_rust_push.yml +++ b/.github/workflows/for_pr_rust_push.yml @@ -1,5 +1,5 @@ -name : rust_push +name : for_pr_push on : @@ -21,7 +21,7 @@ on : concurrency : - group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + group : for_pr_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} cancel-in-progress : true @@ -36,7 +36,7 @@ jobs : will_test : if : contains( inputs.commit_message, '+test' ) || contains( inputs.commit_message, 'merge' ) concurrency : - group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_${{ matrix.os }} + group : for_pr_rust_push_${{ inputs.module_name }}_${{ github.ref }}_${{ matrix.os }} cancel-in-progress : true strategy : fail-fast : false diff --git a/.github/workflows/standard_rust_pull_request.yml b/.github/workflows/standard_rust_pull_request.yml index 68d310734c..f71b959fae 100644 --- a/.github/workflows/standard_rust_pull_request.yml +++ b/.github/workflows/standard_rust_pull_request.yml @@ -43,7 +43,7 @@ jobs : tested : needs: check if : ${{ needs.check.outputs.should_run == 'true' }} - uses : Wandalen/wTools/.github/workflows/fast_rust_push.yml@alpha + uses : Wandalen/wTools/.github/workflows/for_pr_rust_push.yml@alpha with : manifest_path : './Cargo.toml' module_name : ${{ github.event.base.ref }}_${{ github.event.number }} diff --git a/module/move/willbe/src/action/cicd_renew.rs b/module/move/willbe/src/action/cicd_renew.rs index 9d431931a2..ab683e86c1 100644 --- a/module/move/willbe/src/action/cicd_renew.rs +++ b/module/move/willbe/src/action/cicd_renew.rs @@ -166,7 +166,7 @@ mod private file_write( &workflow_root.join( "standard_rust_push.yml" ), include_str!( "../../template/workflow/standard_rust_push.yml" ) )?; - file_write( &workflow_root.join( "fast_rust_push.yml" ), include_str!( "../../template/workflow/fast_rust_push.yml" ) )?; + file_write( &workflow_root.join( "for_pr_rust_push.yml" ), include_str!( "../../template/workflow/for_pr_rust_push.yml" ) )?; file_write( &workflow_root.join( "standard_rust_scheduled.yml" ), include_str!( "../../template/workflow/standard_rust_scheduled.yml" ) )?; diff --git a/module/move/willbe/template/workflow/fast_rust_push.yml b/module/move/willbe/template/workflow/for_pr_rust_push.yml similarity index 91% rename from module/move/willbe/template/workflow/fast_rust_push.yml rename to module/move/willbe/template/workflow/for_pr_rust_push.yml index c578edc7b1..edbc5aa907 100644 --- a/module/move/willbe/template/workflow/fast_rust_push.yml +++ b/module/move/willbe/template/workflow/for_pr_rust_push.yml @@ -1,5 +1,5 @@ -name : rust_push +name : for_pr_push on : @@ -21,7 +21,7 @@ on : concurrency : - group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + group : for_pr_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} cancel-in-progress : true @@ -36,7 +36,7 @@ jobs : will_test : if : contains( inputs.commit_message, '+test' ) || contains( inputs.commit_message, 'merge' ) concurrency : - group : fast_rust_push_${{ inputs.module_name }}_${{ github.ref }}_${{ matrix.os }} + group : for_pr_rust_push_${{ inputs.module_name }}_${{ github.ref }}_${{ matrix.os }} cancel-in-progress : true strategy : fail-fast : false diff --git a/module/move/willbe/template/workflow/standard_rust_pull_request.hbs b/module/move/willbe/template/workflow/standard_rust_pull_request.hbs index 494f6ddaeb..dc2999f144 100644 --- a/module/move/willbe/template/workflow/standard_rust_pull_request.hbs +++ b/module/move/willbe/template/workflow/standard_rust_pull_request.hbs @@ -43,7 +43,7 @@ jobs : tested : needs: check if : $\{{ needs.check.outputs.should_run == 'true' }} - uses : {{username_and_repository}}/.github/workflows/fast_rust_push.yml@alpha + uses : {{username_and_repository}}/.github/workflows/for_pr_rust_push.yml@alpha with : manifest_path : './Cargo.toml' module_name : $\{{ github.event.base.ref }}_$\{{ github.event.number }} diff --git a/module/move/willbe/tests/inc/action/cicd_renew.rs b/module/move/willbe/tests/inc/action/cicd_renew.rs index bb27c706b9..849a1f3de3 100644 --- a/module/move/willbe/tests/inc/action/cicd_renew.rs +++ b/module/move/willbe/tests/inc/action/cicd_renew.rs @@ -109,7 +109,7 @@ fn default_case() assert!( base_path.join( "runs_clean.yml" ).exists() ); assert!( base_path.join( "standard_rust_pull_request.yml" ).exists() ); assert!( base_path.join( "standard_rust_push.yml" ).exists() ); - assert!( base_path.join( "fast_rust_push.yml" ).exists() ); + assert!( base_path.join( "for_pr_rust_push.yml" ).exists() ); assert!( base_path.join( "standard_rust_scheduled.yml" ).exists() ); assert!( base_path.join( "standard_rust_status.yml" ).exists() ); assert!( base_path.join( "status_checks_rules_update.yml" ).exists() ); From 219d81b5ce1edf46f77b4fb7b27467e6d1ef0eb4 Mon Sep 17 00:00:00 2001 From: SRetip Date: Tue, 14 May 2024 12:08:58 +0300 Subject: [PATCH 4/5] add description & change badge --- .github/workflows/description.md | 129 +++++++++++++++++++++++++++++++ Readme.md | 2 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/description.md diff --git a/.github/workflows/description.md b/.github/workflows/description.md new file mode 100644 index 0000000000..5927394cd8 --- /dev/null +++ b/.github/workflows/description.md @@ -0,0 +1,129 @@ + +# for_pr_rust_push.yml + +actions: +- install stable rust +- install nightly rust +- install willbe +- run tests with all features, but only on stable toolchain and in debug optimization mode + +Groups creates by strategy: +```yml +for_pr_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} +``` + +inputs.module_name - name of module +github.ref - name of branch +{{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} - returns true if commit message contains directive `+test` or starts with `merge` word. + +runs if commit message contains directive `+test` or starts with `merge` word. + +# standard_rust_push.yml + +actions: +- install stable rust +- install nightly rust +- install cargo-udeps +- install cargo-audit +- checks crate with cargo-udeps +- checks crete with cargo-audit +- install willbe +- run tests with all features, with stable and nightly toolchain, with release and debug optimization mode + +Groups creates by strategy: +```yml +standard_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} +``` + +inputs.module_name - name of module +github.ref - name of branch +{{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} - returns true if commit message contains directive `+test` or starts with `merge` word. + +runs if commit message contains directive `+test` or starts with `merge` word. + +# standard_rust_pool_request.yml + +actions: +- call [for_pr_rust_push.yml](#for_pr_rust_pushyml) for all project. + +# standard_rust_schedule.yml + +actions: +- call [standard_rust_push.yml](#standard_rust_pushyml) for `{module_name}` every day at 1:00 a.m. + +Affects badges in the header of the workspace readme.md file. + +# module_{module_name}_push.yml + +actions: +- call [standard_rust_push.yml](#standard_rust_pushyml) for `{module_name}`. + +Affects badges that are opposite to modules in the main table, as well as badges in the header of the crate readme.md files. + +# appropriate_branch.yml + +This workflow ensures that pull requests are opened against the correct target branches based on a predefined branching strategy (alpha -> beta -> master). It checks whether the destination branch specified in the pull request matches the expected branch according to the branching strategy. If it doesn't match, the pull request is converted to draft mode, and if it still doesn't match, the workflow fails. + +# appropriate_branch_beta.yml + +This workflow delegates the actual validation and actions to another workflow file (appropriate_branch.yml) located in the Wandalen/wTools repository under .github/workflows directory on the "alpha" branch. It ensures that pull requests targeting the "beta" branch are appropriately validated and processed according to the rules defined in the external workflow file. + +# appropriate_branch_master.yml + +Similar to the previous workflow, this one also delegates the validation and processing of pull requests to an external workflow file (appropriate_branch.yml) located in the Wandalen/wTools repository under the .github/workflows directory on the "alpha" branch. +By specifying the "beta" branch as the source branch and dynamically referencing the base branch of the pull request as the destination branch, this workflow ensures that pull requests targeting the "main" or "master" branches are appropriately validated and processed according to the rules defined in the external workflow file. +This setup promotes consistency and reusability of workflow logic across different branches within the repository, helping to maintain a standardized process for handling pull requests. + +# auto_merge_to_beta.yml + +This workflow automates the process of merging changes from the "alpha" branch into the "beta" branch after ensuring that related workflow runs for modules have completed successfully. +It waits for the completion of workflow runs related to modules and checks their statuses before proceeding with the merge process. +If all checks pass, it merges the changes into the "beta" branch using the provided GitHub token. + +# auto_pr.yml + +This workflow automates the process of opening pull requests between specified source and destination branches. +Upon triggering, it checks out the repository and opens a pull request from the source branch (src_branch) to the destination branch (dst_branch). +The pull request title is automatically generated to indicate that it's an automated pull request forwarding from one branch to another. +If a pull request already exists between the specified branches and PASS_IF_EXISTS is set to true, the action will pass without creating a new pull request. + +# auto_pr_to_alpha.yml + +This workflow automates the process of opening pull requests from any branch except for those explicitly excluded to the "alpha" branch. +It leverages branch filtering to include all branches and exclude specific ones such as master, main, alpha, beta, and any branches containing test or experiment in their names. +When triggered by a push event on a qualifying branch, it calls the external workflow (auto_pr.yml) to handle the process of opening a pull request to the "alpha" branch, passing the source and destination branch information along with the GitHub bot token for authentication. + +# auto_pr_to_beta.yml + +This workflow automates the process of opening pull requests from the "alpha" branch to the "beta" branch. +When triggered by a push event on the "alpha" branch, it calls the external workflow (auto_pr.yml) to handle the process of opening a pull request to the "beta" branch, passing the source and destination branch information along with the GitHub bot token for authentication. + +# auto_pr_to_master.yml + +This workflow automates the process of opening pull requests from the "beta" branch to the "master" branch. +When triggered by a push event on the "beta" branch, it calls the external workflow (auto_pr.yml) to handle the process of opening a pull request to the "master" branch, passing the source and destination branch information along with the GitHub bot token for authentication. + +# runs_clean.yml + +This workflow allows manual triggering to clean up workflow runs in the repository. +It first deletes any runs that have been cancelled or skipped, ensuring that they do not clutter the workflow history. +Then, it deletes runs older than a specified number of days, while ensuring that at least 20 runs are preserved regardless of their age. +By regularly cleaning up older workflow runs, this workflow helps maintain a clean and organized workflow history in the repository. + +# standard_rust_status.yml + +This workflow serves as a status monitor for the completion of specific workflows: "auto_merge_to_beta" and "rust_scheduled." +Upon completion of any of these workflows, it checks the status of their runs. +It employs a matrix strategy to iterate over different workflow files to check their statuses. +If the conclusion of any checked workflow run is "failure," "cancelled," or "skipped," the workflow exits with an error, indicating a problem. + +# status_checks_rules_update.yml + +When a pull request is opened targeting branches "alpha" or "beta": +- If the base branch is "beta": + - It compares the contents of the workflow directories between branches "alpha" and "beta". + - If they are not equal, it triggers an update of branch protection rules for the "beta" branch. +- If the base branch is "alpha": + - It directly triggers an update of branch protection rules for the "alpha" branch with specific required status checks for different contexts. \ No newline at end of file diff --git a/Readme.md b/Readme.md index 68922b6d86..84825db302 100644 --- a/Readme.md +++ b/Readme.md @@ -4,7 +4,7 @@ -[![alpha](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/auto_merge_to_beta.yml?label=alpha&logo=github&branch=alpha)](https://github.com/Wandalen/wTools/blob/master/.github/workflows/auto_merge_to_beta.yml) +[![wTools](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/standard_rust_scheduled.yml?label=master&logo=github&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/standard_rust_scheduled.yml) [![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY) [![Open in Gitpod](https://raster.shields.io/static/v1?label=try&message=online&color=eee&logo=gitpod&logoColor=eee)](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=sample%2Frust%2Fwtools_trivial_sample%2Fsrc%2Fmain.rs,RUN_POSTFIX=--example%20wtools_trivial_sample/https://github.com/Wandalen/wTools) [![docs.rs](https://raster.shields.io/static/v1?label=docs&message=online&color=eee&logo=docsdotrs&logoColor=eee)](https://docs.rs/wtools) From d5df3f3a38253b590273e249cb295df0e022fb96 Mon Sep 17 00:00:00 2001 From: SRetip Date: Tue, 14 May 2024 12:52:03 +0300 Subject: [PATCH 5/5] improve description --- .../workflows/{description.md => Readme.md} | 8 +- module/move/willbe/src/action/cicd_renew.rs | 3 + .../move/willbe/template/workflow/Readme.md | 133 ++++++++++++++++++ .../willbe/tests/inc/action/cicd_renew.rs | 1 + 4 files changed, 143 insertions(+), 2 deletions(-) rename .github/workflows/{description.md => Readme.md} (90%) create mode 100644 module/move/willbe/template/workflow/Readme.md diff --git a/.github/workflows/description.md b/.github/workflows/Readme.md similarity index 90% rename from .github/workflows/description.md rename to .github/workflows/Readme.md index 5927394cd8..52ce58143f 100644 --- a/.github/workflows/description.md +++ b/.github/workflows/Readme.md @@ -1,3 +1,6 @@ +# healthtable + +[healthtable](../../Readme.md) - in addition to information about modules, their stability contains the results of CI/CD of the master and alpha branches. # for_pr_rust_push.yml @@ -53,14 +56,15 @@ actions: actions: - call [standard_rust_push.yml](#standard_rust_pushyml) for `{module_name}` every day at 1:00 a.m. -Affects badges in the header of the workspace readme.md file. +Affects badges in the header of the workspace readme.md file, looks like this [![wTools](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/standard_rust_scheduled.yml?label=master&logo=github&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/standard_rust_scheduled.yml). # module_{module_name}_push.yml actions: - call [standard_rust_push.yml](#standard_rust_pushyml) for `{module_name}`. -Affects badges that are opposite to modules in the main table, as well as badges in the header of the crate readme.md files. +Affects badges that are opposite to modules in the **[healthtable](#healthtable)**, as well as badges in the header of the crate readme.md files. + # appropriate_branch.yml diff --git a/module/move/willbe/src/action/cicd_renew.rs b/module/move/willbe/src/action/cicd_renew.rs index ab683e86c1..573a2a13bc 100644 --- a/module/move/willbe/src/action/cicd_renew.rs +++ b/module/move/willbe/src/action/cicd_renew.rs @@ -173,6 +173,9 @@ mod private file_write( &workflow_root.join( "standard_rust_status.yml" ), include_str!( "../../template/workflow/standard_rust_status.yml" ) )?; file_write( &workflow_root.join( "status_checks_rules_update.yml" ), include_str!( "../../template/workflow/status_checks_rules_update.yml" ) )?; + + file_write( &workflow_root.join( "Readme.md" ), include_str!( "../../template/workflow/Readme.md" ) )?; + Ok( () ) } diff --git a/module/move/willbe/template/workflow/Readme.md b/module/move/willbe/template/workflow/Readme.md new file mode 100644 index 0000000000..52ce58143f --- /dev/null +++ b/module/move/willbe/template/workflow/Readme.md @@ -0,0 +1,133 @@ +# healthtable + +[healthtable](../../Readme.md) - in addition to information about modules, their stability contains the results of CI/CD of the master and alpha branches. + +# for_pr_rust_push.yml + +actions: +- install stable rust +- install nightly rust +- install willbe +- run tests with all features, but only on stable toolchain and in debug optimization mode + +Groups creates by strategy: +```yml +for_pr_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} +``` + +inputs.module_name - name of module +github.ref - name of branch +{{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} - returns true if commit message contains directive `+test` or starts with `merge` word. + +runs if commit message contains directive `+test` or starts with `merge` word. + +# standard_rust_push.yml + +actions: +- install stable rust +- install nightly rust +- install cargo-udeps +- install cargo-audit +- checks crate with cargo-udeps +- checks crete with cargo-audit +- install willbe +- run tests with all features, with stable and nightly toolchain, with release and debug optimization mode + +Groups creates by strategy: +```yml +standard_rust_push_${{ inputs.module_name }}_${{ github.ref }}_ + ${{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} +``` + +inputs.module_name - name of module +github.ref - name of branch +{{ contains( inputs.commit_message, '+test' ) || startsWith( inputs.commit_message, 'merge' ) }} - returns true if commit message contains directive `+test` or starts with `merge` word. + +runs if commit message contains directive `+test` or starts with `merge` word. + +# standard_rust_pool_request.yml + +actions: +- call [for_pr_rust_push.yml](#for_pr_rust_pushyml) for all project. + +# standard_rust_schedule.yml + +actions: +- call [standard_rust_push.yml](#standard_rust_pushyml) for `{module_name}` every day at 1:00 a.m. + +Affects badges in the header of the workspace readme.md file, looks like this [![wTools](https://img.shields.io/github/actions/workflow/status/Wandalen/wTools/standard_rust_scheduled.yml?label=master&logo=github&branch=master)](https://github.com/Wandalen/wTools/actions/workflows/standard_rust_scheduled.yml). + +# module_{module_name}_push.yml + +actions: +- call [standard_rust_push.yml](#standard_rust_pushyml) for `{module_name}`. + +Affects badges that are opposite to modules in the **[healthtable](#healthtable)**, as well as badges in the header of the crate readme.md files. + + +# appropriate_branch.yml + +This workflow ensures that pull requests are opened against the correct target branches based on a predefined branching strategy (alpha -> beta -> master). It checks whether the destination branch specified in the pull request matches the expected branch according to the branching strategy. If it doesn't match, the pull request is converted to draft mode, and if it still doesn't match, the workflow fails. + +# appropriate_branch_beta.yml + +This workflow delegates the actual validation and actions to another workflow file (appropriate_branch.yml) located in the Wandalen/wTools repository under .github/workflows directory on the "alpha" branch. It ensures that pull requests targeting the "beta" branch are appropriately validated and processed according to the rules defined in the external workflow file. + +# appropriate_branch_master.yml + +Similar to the previous workflow, this one also delegates the validation and processing of pull requests to an external workflow file (appropriate_branch.yml) located in the Wandalen/wTools repository under the .github/workflows directory on the "alpha" branch. +By specifying the "beta" branch as the source branch and dynamically referencing the base branch of the pull request as the destination branch, this workflow ensures that pull requests targeting the "main" or "master" branches are appropriately validated and processed according to the rules defined in the external workflow file. +This setup promotes consistency and reusability of workflow logic across different branches within the repository, helping to maintain a standardized process for handling pull requests. + +# auto_merge_to_beta.yml + +This workflow automates the process of merging changes from the "alpha" branch into the "beta" branch after ensuring that related workflow runs for modules have completed successfully. +It waits for the completion of workflow runs related to modules and checks their statuses before proceeding with the merge process. +If all checks pass, it merges the changes into the "beta" branch using the provided GitHub token. + +# auto_pr.yml + +This workflow automates the process of opening pull requests between specified source and destination branches. +Upon triggering, it checks out the repository and opens a pull request from the source branch (src_branch) to the destination branch (dst_branch). +The pull request title is automatically generated to indicate that it's an automated pull request forwarding from one branch to another. +If a pull request already exists between the specified branches and PASS_IF_EXISTS is set to true, the action will pass without creating a new pull request. + +# auto_pr_to_alpha.yml + +This workflow automates the process of opening pull requests from any branch except for those explicitly excluded to the "alpha" branch. +It leverages branch filtering to include all branches and exclude specific ones such as master, main, alpha, beta, and any branches containing test or experiment in their names. +When triggered by a push event on a qualifying branch, it calls the external workflow (auto_pr.yml) to handle the process of opening a pull request to the "alpha" branch, passing the source and destination branch information along with the GitHub bot token for authentication. + +# auto_pr_to_beta.yml + +This workflow automates the process of opening pull requests from the "alpha" branch to the "beta" branch. +When triggered by a push event on the "alpha" branch, it calls the external workflow (auto_pr.yml) to handle the process of opening a pull request to the "beta" branch, passing the source and destination branch information along with the GitHub bot token for authentication. + +# auto_pr_to_master.yml + +This workflow automates the process of opening pull requests from the "beta" branch to the "master" branch. +When triggered by a push event on the "beta" branch, it calls the external workflow (auto_pr.yml) to handle the process of opening a pull request to the "master" branch, passing the source and destination branch information along with the GitHub bot token for authentication. + +# runs_clean.yml + +This workflow allows manual triggering to clean up workflow runs in the repository. +It first deletes any runs that have been cancelled or skipped, ensuring that they do not clutter the workflow history. +Then, it deletes runs older than a specified number of days, while ensuring that at least 20 runs are preserved regardless of their age. +By regularly cleaning up older workflow runs, this workflow helps maintain a clean and organized workflow history in the repository. + +# standard_rust_status.yml + +This workflow serves as a status monitor for the completion of specific workflows: "auto_merge_to_beta" and "rust_scheduled." +Upon completion of any of these workflows, it checks the status of their runs. +It employs a matrix strategy to iterate over different workflow files to check their statuses. +If the conclusion of any checked workflow run is "failure," "cancelled," or "skipped," the workflow exits with an error, indicating a problem. + +# status_checks_rules_update.yml + +When a pull request is opened targeting branches "alpha" or "beta": +- If the base branch is "beta": + - It compares the contents of the workflow directories between branches "alpha" and "beta". + - If they are not equal, it triggers an update of branch protection rules for the "beta" branch. +- If the base branch is "alpha": + - It directly triggers an update of branch protection rules for the "alpha" branch with specific required status checks for different contexts. \ No newline at end of file diff --git a/module/move/willbe/tests/inc/action/cicd_renew.rs b/module/move/willbe/tests/inc/action/cicd_renew.rs index 849a1f3de3..4f9b0bc17b 100644 --- a/module/move/willbe/tests/inc/action/cicd_renew.rs +++ b/module/move/willbe/tests/inc/action/cicd_renew.rs @@ -113,6 +113,7 @@ fn default_case() assert!( base_path.join( "standard_rust_scheduled.yml" ).exists() ); assert!( base_path.join( "standard_rust_status.yml" ).exists() ); assert!( base_path.join( "status_checks_rules_update.yml" ).exists() ); + assert!( base_path.join( "Readme.md" ).exists() ); } // aaa : for Petro : fix styles