Skip to content

Commit

Permalink
major milestone
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed Jun 1, 2024
0 parents commit 9d1ed58
Show file tree
Hide file tree
Showing 2,040 changed files with 149,773 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

[env]
MODULES_PATH = { value = "module", relative = true }
WORKSPACE_PATH = { value = ".", relative = true }

[net]
# offline = true
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.s linguist-language=JavaScript
*.ss linguist-language=JavaScript
*.js linguist-language=JavaScript
* -text
133 changes: 133 additions & 0 deletions .github/workflows/Readme.md
Original file line number Diff line number Diff line change
@@ -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.
58 changes: 58 additions & 0 deletions .github/workflows/appropriate_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

name : appropriate_branch

on :

workflow_call :
inputs :
src_branch :
required : true
type : string
dst_branch :
required : true
type : string
secrets :
PRIVATE_GITHUB_BOT_TOKEN :
description : 'Github bot token'
required : true

env :

CARGO_TERM_COLOR : always

concurrency :

group : appropraite_branch_${{ inputs.src_branch }}_${{ inputs.dst_branch }}
cancel-in-progress : true

jobs :

check :
runs-on : ubuntu-latest
outputs :
shouldSkip : ${{ steps.validation.outputs.wrong-target }}
steps :
- name : Check branch
id : validation
uses : Vankka/[email protected]
env :
GITHUB_TOKEN : ${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}
with :
target : ${{ inputs.dst_branch }}
exclude : ${{ inputs.src_branch }}
comment : |
To maintain stability of the module the repository uses 3-stages system to forward changes from an unstable branch to a stable.
The unstable branch is `alpha`. All user pull requests should be opened to this branch.
The staging branch is `beta`. Changes to this branch are forwarded by a pull request from branch `alpha` automatically.
The stable branch is `master`. Changes to this branch are forwarded by a pull request from branch `beta` automatically.
The pull request was automatically converted to draft.
Please, change base branch taking into account the described system `alpha -> beta -> master`.
- name : Convert to draft
if : ${{ steps.validation.outputs.wrong-target == 'true' }}
uses: voiceflow/draft-pr@latest
with:
token: ${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}
- name : Failure
if : ${{ steps.validation.outputs.wrong-target == 'true' }}
run : exit 1
17 changes: 17 additions & 0 deletions .github/workflows/appropriate_branch_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

name : appropriate_branch_beta

on :
pull_request_target :
branches :
- beta

jobs :

appropriate_branch :
uses : Wandalen/wTools/.github/workflows/appropriate_branch.yml@alpha
with :
src_branch : 'alpha'
dst_branch : '${{ github.base_ref }}'
secrets :
PRIVATE_GITHUB_BOT_TOKEN : '${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}'
18 changes: 18 additions & 0 deletions .github/workflows/appropriate_branch_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

name : appropriate_branch_master

on :
pull_request_target :
branches :
- main
- master

jobs :

appropriate_branch :
uses : Wandalen/wTools/.github/workflows/appropriate_branch.yml@alpha
with :
src_branch : 'beta'
dst_branch : '${{ github.base_ref }}'
secrets :
PRIVATE_GITHUB_BOT_TOKEN : '${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}'
95 changes: 95 additions & 0 deletions .github/workflows/auto_merge_to_beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

name : auto_merge_to_beta

on :
push :
branches : [ alpha ]

concurrency :

group : auto_merge_to_beta
cancel-in-progress : true

jobs :

get_modules:
outputs :
workflow_files: ${{ steps.workflow_files.outputs.files }}
workflow_names: ${{ steps.workflow_names.outputs.names }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: workflow_files
run: |
WORKFLOWS=$(ls .github/workflows | grep module)
for WORKFLOW in $WORKFLOWS ; do
NAME=$(echo $WORKFLOW | sed 's/\(\S\+\).yml/\1/')
NAMES="$NAMES $NAME"
done;
NAMES=$(sed 's/\s\+/\n/g' <<< $NAMES)
OUTPUT=$(echo "$NAMES" | jq -R -s -c 'split("\n")[1:-1]')
echo "files={\"modules\":$OUTPUT}" >> $GITHUB_OUTPUT
- id: workflow_names
run: |
WORKFLOWS=$(ls .github/workflows | grep module)
for WORKFLOW in $WORKFLOWS ; do
NAME=$(cat .github/workflows/$WORKFLOW | grep -G '^name :' | sed 's/name\s*:\s\+\(\S*\)/\1/')
NAMES="$NAMES%0A$NAME"
done;
echo "names=$NAMES" >> $GITHUB_OUTPUT
wait_for_modules :
needs : get_modules
runs-on : ubuntu-latest
steps :
- name : Waiting ...
uses : willgarcia/workflow-wait-action@main
with :
timeout : 21600
interval : 60
initial_delay : 60
workflows : ${{ needs.get_modules.outputs.workflow_names }}

runs_check :
needs :
- get_modules
- wait_for_modules
strategy :
matrix : ${{ fromJSON( needs.get_modules.outputs.workflow_files ) }}
runs-on : ubuntu-latest
steps :
- name : Check workflow run status
id : check_ci
uses : ronymeyer/[email protected]
with :
token : ${{ secrets.GITHUB_TOKEN }}
workflow : ${{ matrix.modules }}.yml
event : push
branch : alpha
- name : Check failure conclusion
if : ${{ steps.check_ci.outputs.conclusion == 'failure' }}
run : exit 1
- name : Check cancelled conclusion
if : ${{ steps.check_ci.outputs.conclusion == 'cancelled' }}
run : exit 1
- name : Check skipped conclusion
if : ${{ steps.check_ci.outputs.conclusion == 'skipped' }}
run : exit 1

merge :
needs : runs_check
runs-on : ubuntu-latest
steps :
- name : Find PR number for current commit
uses : jwalton/gh-find-current-pr@v1
id : find
with :
state: open
- name: Automerge passed pull request
if : ${{ success() }}
uses: juliangruber/merge-pull-request-action@v1
with:
github-token: ${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}
repo: ${{ github.repository }}
number: ${{ steps.find.outputs.number }}
method: merge
36 changes: 36 additions & 0 deletions .github/workflows/auto_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

name : auto_pr

on :

workflow_call :
inputs :
src_branch :
required : true
type : string
dst_branch :
required : true
type : string
secrets :
PRIVATE_GITHUB_BOT_TOKEN :
description : 'Github bot token'
required : true

concurrency :

group : auto_pr_${{ inputs.src_branch }}_${{ inputs.dst_branch }}
cancel-in-progress : true

jobs :

build :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v3
- name : Open PR
uses : vsoch/[email protected]
env :
GITHUB_TOKEN : ${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}
PULL_REQUEST_BRANCH : ${{ inputs.dst_branch }}
PULL_REQUEST_TITLE : 'AUTO : Forward from ${{ inputs.src_branch }} to ${{ inputs.dst_branch }}'
PASS_IF_EXISTS : true
Loading

0 comments on commit 9d1ed58

Please sign in to comment.