From 9f9a3e1fc517d14577f68e7bc5fe969c1973d14d Mon Sep 17 00:00:00 2001 From: Ahzyuan Date: Mon, 23 Jun 2025 18:13:18 +0800 Subject: [PATCH 1/2] ci(test): change the type of test triggered by PR - **compability test**: only trigger manually before mergeing - **minimal test**: triggered in most of the cases to quickly locate bugs --- .github/workflows/compatibility_test.yml | 16 +--------------- .github/workflows/minimal_test.yml | 8 ++++---- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/compatibility_test.yml b/.github/workflows/compatibility_test.yml index c72b31e..d7708ad 100644 --- a/.github/workflows/compatibility_test.yml +++ b/.github/workflows/compatibility_test.yml @@ -4,12 +4,7 @@ # This workflow ensures code quality and cross-platform compatibility. # -# Trigger Conditions: -# - PR events (open/review-ready) with changes to: -# - Source code (/torchmeter) -# - Test cases (/tests) -# - Configuration files -# - Manual trigger via GitHub UI +# Trigger Conditions: Manual trigger via GitHub UI # # Core functions: # 1. Automated Linting & Formatting via Ruff @@ -20,15 +15,6 @@ name: โœ… Compatibility Test โŒ on: - pull_request: - types: - - opened - - ready_for_review - paths: - - 'tests/**' - - 'torchmeter/**' - - 'default_cfg.yml' - - 'requirements.txt' workflow_dispatch: env: diff --git a/.github/workflows/minimal_test.yml b/.github/workflows/minimal_test.yml index 3d8432e..61c4c08 100644 --- a/.github/workflows/minimal_test.yml +++ b/.github/workflows/minimal_test.yml @@ -5,10 +5,9 @@ # This workflow ensures quick code quality checks and code logic validation. # # Trigger Conditions: -# - PR events (reopened/synchronize) with changes to: +# - PR events (open/review-ready/reopened/synchronize) with changes to: # - Source code (/torchmeter) # - Test cases (/tests) -# - Examples (/examples) # - Configuration files (default_cfg.yml, requirements.txt) # - Manual trigger via GitHub UI: # - Select OS: ubuntu/macOS/windows @@ -25,10 +24,11 @@ name: โœ” Minimal Test โœ˜ on: pull_request: types: - - reopened + - opened + - ready_for_review - synchronize + - reopened paths: - - 'examples/**' - 'tests/**' - 'torchmeter/**' - 'default_cfg.yml' From 8dd9fc56f5755533242befd876899df959f38acc Mon Sep 17 00:00:00 2001 From: Ahzyuan Date: Tue, 24 Jun 2025 21:09:41 +0800 Subject: [PATCH 2/2] docs: update all contents related to both the types of test --- docs/src/en/contribute/conventions.md | 1 + docs/src/en/contribute/prs.md | 18 +++++++++--------- docs/src/en/others/management.md | 12 ++++++++++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/src/en/contribute/conventions.md b/docs/src/en/contribute/conventions.md index 19eb2f6..2818c6c 100644 --- a/docs/src/en/contribute/conventions.md +++ b/docs/src/en/contribute/conventions.md @@ -44,6 +44,7 @@ Consistent naming rule helps us: | `bugfix` | Bug corrections | Fixing unexpected behavior | `bugfix/div-zero-error` | | `docs` | Documentation updates | Improving guides/comments | `docs/add-install-notes` | | `test` | Testing improvements | Enhancing test coverage | `test/add-edge-cases` | + | `ci` | Workflow Modification | Add/remove/improve workflows | `ci/change-test-pipeline` | | `refactor` | Code restructuring | Improving code structure | `refactor/metrics-handler` | | `hotfix` | Critical fixes | Urgent production fixes | `hotfix/memory-leak-patch` | | `chore` | Project maintenance | Updating dependencies/builds | `chore/update-requirements` | diff --git a/docs/src/en/contribute/prs.md b/docs/src/en/contribute/prs.md index a6174db..8e52a8e 100644 --- a/docs/src/en/contribute/prs.md +++ b/docs/src/en/contribute/prs.md @@ -815,14 +815,14 @@ Once you feel that your changes have made phased progress, you can incorporate t 2. ๐Ÿ™‹โ€โ™‚๏ธ The `-u` parameter indicates that the `` branch in local repository will track the `` branch in remote repository. Thus, when you make new commits on `` in local repository, you can easily push them to the `` branch in remote repository with a simple `git push` command, no need to re-type the remote repository's target branch name. 2. If you have enabled the `Github Actions` for your `fork` repository, you can submit a PR to the `master` branch of the remote repository (i.e., **your `fork` repository**) to automatically trigger the compatibility test we've prepared for you: - 1. Open the page of your fork repository. Shortly after pushing your changes, you'll find a prominent `Compare & pull request` button. (1)([Illustration](https://docs.github.com/assets/cb-34097/mw-1440/images/help/pull_requests/pull-request-compare-pull-request.webp){ data-preview }) + 1. Open the page of your fork repository. Shortly after pushing your changes, you'll find a prominent `Compare & pull request` button. ([Illustration](https://docs.github.com/assets/cb-34097/mw-1440/images/help/pull_requests/pull-request-compare-pull-request.webp){ data-preview }) 2. Click this button. In the pop-up page, select the `base` branch as the `master` branch of **your fork repository**, and select the `head` branch as the `` branch you just pushed. {++Please double-check that the `base` branch is the `master` branch of **your `fork` repository**, not the `master` branch of the official `torchmeter` repository.++} 3. Fill in the PR title. See [PR Title Convention :material-link-variant:](conventions.md#Pull-Request-Title){ data-preview }. 4. Fill in the PR description. Since you are just testing, the description can be brief, no need to fill it in according to the predefined template. 5. Click the `Create Pull Request` button below, and you have created a PR targeting the `master` branch in your fork repository. - 6. Click on the `Actions` tab. You will see a task named `โœ… Compatibility Test โŒ` is running. It is the compatibility test workflow of the `torchmeter` project. - 7. Wait for the task to finish running. If the task fails, check the error, modify the code locally, and then re-commit to the remote repository. This will update the commit history of the PR and trigger the minimal test `โœ… Minimal Test โŒ`. - 8. If the minimum test is passed, click on the `Actions` tab, select `โœ… Compatibility Test โŒ`, click `Run workflow`, choose your branch and run. This will re-trigger the compatibility test, do it until it is passed. + 6. Click on the `Actions` tab. You will see a task named `โœ” Minimal Test โœ˜ ` is running. It is the minimal test workflow of the `torchmeter` project. + 7. Wait for the task to finish running. If the task fails, check the error, modify the code locally, and then re-commit to the remote repository. This will update the commit history of the PR and trigger the minimal test `โœ” Minimal Test โœ˜ ` again. + 8. If the minimum test is passed, click on the `Actions` tab, select `โœ… Compatibility Test โŒ`, click `Run workflow`, choose your branch and run. This will trigger the compatibility test, fix the error if any until the test is passed. [^2]: You can enable `Github Actions` for your fork repo **without worry** as we've added repository validation for sensitive operations (like package publishing), so you can rest assured to enable it. @@ -1045,13 +1045,13 @@ Once your PR is created (whether draft or final), `torchmeter` uses automated wo ??? tip "Code Linting, Formatting and Compatibility Testing" - Once a PR is created, a [workflow :material-link-variant:](https://github.com/TorchMeter/torchmeter/tree/master.github/workflows/compatibility_test.yml) named `โœ… Compatibility Test โŒ` will be automatically triggered. It will check ^^whether the code in the PR meets the style and format requirements defined in `ruff.toml`^^. + Once a PR is created, a [workflow :material-link-variant:](https://github.com/TorchMeter/torchmeter/tree/master.github/workflows/minimal_test.yml) named `โœ” Minimal Test โœ˜ ` will be automatically triggered. It will check ^^whether the code in the PR meets the style and format requirements defined in `ruff.toml`^^. - If both pass, compatibility tests will be conducted across platforms (`windows`, `macOs`, `linux`) and across versions (`python 3.8` to `python 3.13`). If any step fails, `torchmeter` will provide an error report on the workflow run page. Please download it, review it, and try to fix the problem. + If both pass, [predefined tests :material-link-variant:](https://github.com/TorchMeter/torchmeter/tree/master/tests) will be conducted across platforms (`windows`, `macOs`, `linux`) and across versions (`python 3.8` to `python 3.13`). If any step fails, `torchmeter` will provide an error report on the workflow run page. Please download it, review it, and try to fix the problem. You can try to solve the problem by creating a new commit for the fix in your local repository and pushing it to the remote repository. The commit history of the PR will be automatically synchronized with the history of the `head` branch. - It should be noted that every time PR is updated like this, an automated test [workflow :material-link-variant:](https://github.com/TorchMeter/torchmeter/tree/master.github/workflows/minimal_test.yml) named `โœ… Minimal Test โŒ` will be triggered, which will execute the test in a randomly selected system and `python 3.8`. Without consuming a lot of time and resources like compatibility testing, this is beneficial for you to find new problems that may be introduced by new submission as soon as possible. + It should be noted that every time PR is updated like this, the [workflow :material-link-variant:](https://github.com/TorchMeter/torchmeter/tree/master.github/workflows/minimal_test.yml) named `โœ” Minimal Test โœ˜` will be triggered again, which will execute the test on a randomly selected system under `python 3.8`. This is beneficial for you to find new problems that may be introduced by new submission as soon as possible. --- @@ -1066,7 +1066,7 @@ Once your PR is created (whether draft or final), `torchmeter` uses automated wo 3. **CI failures with prolonged inactivity**: PRs failing CI checks without updates for `30+` days 4. **Outdated scope**: When the code area involved in the PR has been refactored or cancelled -1. After passing compatibility tests, your PR enters formal [review :material-link-variant:](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request#about-reviewing-pull-requests). Typical first review occurs within **5-7 business days** (may vary with maintainer availability). +1. After passing the minimal test, your PR enters formal [review :material-link-variant:](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request#about-reviewing-pull-requests). Typical first review occurs within **5-7 business days** (may vary with maintainer availability). 2. During the review process, reviewers may leave comments. If any questions arise, please ^^respond patiently and courteously^^ to clarify your implementation rationale: - Kindly respond to review comments as soon as possible @@ -1074,7 +1074,7 @@ Once your PR is created (whether draft or final), `torchmeter` uses automated wo - For unclear requests, ask clarifying questions like: `"Could you please elaborate on [...]?"` 3. Provided everything checks out, maintainers will: - - Manually trigger compatibility tests to verify code standards, correctness, robustness, and cross-environment compatibility again. + - Manually trigger [compatibility tests :material-link-variant:](https://github.com/TorchMeter/torchmeter/blob/master/.github/workflows/compatibility_test.yml) to verify code standards, correctness, robustness, and cross-environment compatibility. - Manually execute the `๐Ÿค– Update README Badge ๐Ÿ”ฐ` workflow (as mentioned in [step D.b.6](#Db-Create-a-Pull-Request-to-torchmeter)) to update the coverage badge in `README.md` 4. If everything goes well๏ผŒyour PR will be merged into the `master` branch in `Squash` or `Merge` way. Your contribution will be officially released and acknowledged in the **next version** announcement. diff --git a/docs/src/en/others/management.md b/docs/src/en/others/management.md index a5ffa63..4e5e81c 100644 --- a/docs/src/en/others/management.md +++ b/docs/src/en/others/management.md @@ -60,11 +60,19 @@ When proposing new features or fixes, please follow our [Contribution Guide :mat Promise the PR has a valid title and pass the compatiability tests. - 2. **Update coverage badge in `README.md` before merging**: + 2. **Manually trigger โœ… Compatibility Test โŒ** {==[Optional, do only when essential files changed]==} + + If the changes brought by the PR are related to the following aspects, manually trigger `compatibility_test.yml` workflow, and {++make sure the compatibility test passes++}: + + - source code (`torchmeter/`) + - test code (`tests/`) + - configuration files(`requirements.txt`, `default_cfg.yml`, `pyproject.toml`, `setup.cfg`, `setup.py`) + + 3. **Update coverage badge in `README.md` before merging**: - Right-click coverage badge in PR's comment โ†’ Copy link - Manually trigger `badge_updater.yml` workflow - 3. **Sync local after merging**: `git checkout master && git pull` + 4. **Sync local after merging**: `git checkout master && git pull` ??? tip "Fixing Issues in Current Version"