diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000..df84854 --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,9 @@ +### Description + + + + +### Checklist + +* [ ] Connect all related issues, and project boards, add labels, assign people, milestones etc. +* [ ] Make sure that this template is properly filled in and appropriate parts deleted diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..6e33670 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +### Description + + + + +### Checklist + + +* [ ] Add tests, documentation, update the changelog, etc. +* [ ] Connect all issues, and project boards, add labels, assign people to the PR and the issue, etc. +* [ ] Make sure that the PR description and title contain "Draft: " at the beginning if its not yet ready +* [ ] Make sure that this template is properly filled in and appropriate parts deleted diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d669b8..2331ff6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: 🔨 Build on: pull_request: @@ -10,17 +10,27 @@ env: jobs: build: - name: 🔨Build release - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + toolchain: [stable, beta, nightly] + name: 🔨 Build release + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - name: 🔨Build release + - name: Install latest ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build release run: cargo build --release - package: - name: 📦Check package generation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: 📦Check package generation - run: cargo package diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e5a7e1e..465b19b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Docs +name: 📄 Build docs on: pull_request: @@ -10,9 +10,9 @@ env: jobs: docs: - name: 📄Build docs + name: 📄 Build docs runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: 📄Build docs + - name: Build docs run: cargo doc --verbose diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..70819a6 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,45 @@ +name: 👔 Check formatting + +on: + pull_request: + push: + branches: ["main", "develop", "release"] + +env: + CARGO_TERM_COLOR: always + +jobs: + check_format: + name: 👔 Check formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: davidB/rust-cargo-make@v1 + - name: Check Formatting + run: cargo make rust-fmt-check + check_format_markdown: + name: 🖋 Check markdown files + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Markdown Linting Action + uses: avto-dev/markdown-lint@v1.5.0 + with: + args: "*.md" + check_format_toml: + name: 🪦 Check toml files + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: davidB/rust-cargo-make@v1 + - run: cargo make toml-fmt-check \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/lint.yml similarity index 56% rename from .github/workflows/rust.yml rename to .github/workflows/lint.yml index fc85b76..4bc41d4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,5 @@ -name: Code check + +name: 🖋 Check linting on: pull_request: @@ -9,15 +10,19 @@ env: CARGO_TERM_COLOR: always jobs: - code_check: - name: 👔✒️Formatting and Linting + check_lint: + name: 🖋 Check linting runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: 👔Check Formatting - run: cargo fmt -- --verbose --check --color auto - - name: ✒️Check linting + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: davidB/rust-cargo-make@v1 + - name: Check linting run: | rustup component add clippy set env RUSTFLAGS="-Dwarnings" cargo clippy --workspace -- -D warnings + diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index b3e87cf..a222387 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,4 +1,4 @@ -name: Package +name: 📦 Package on: pull_request: @@ -9,46 +9,28 @@ env: CARGO_TERM_COLOR: always jobs: - # license: - # name: 🏫License check - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: 🏫Check license - # run: | - # cargo install cargo-deny - # cargo deny check - - package: - name: 🔨Package + license: + name: 🏫License check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: 🔨Check package build - run: cargo package --verbose + - name: 🏫Check license + run: | + cargo install cargo-deny + cargo deny check cargo_check: - name: 📦Check package integrity + name: 📦 Check package integrity runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: 📦Check package integrity - run: cargo check --verbose + - name: Check package integrity + run: cargo package --verbose publish_dry_run: - name: 📢Publish dry-run + name: 📢 Publish dry-run runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: 📢Publish dry run + - name: Publish dry run run: cargo publish --dry-run --verbose - - # dummy_publish: - # name: 📦⬆️📢Publish dummy - # # needs: [license, package, cargo_check, publish_dry_run] - # needs: [package, cargo_check, publish_dry_run] - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: 📦⬆️📢Publish dry run - # run: cargo publish --dry-run --verbose diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2a8b10e..90c4866 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: 🧪 Tests on: pull_request: @@ -10,9 +10,19 @@ env: jobs: test: - name: 🧪Run tests - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + toolchain: [stable, beta, nightly] + name: 🧪 Run tests + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - name: 🧪Run tests + - name: Install latest ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + - uses: actions/checkout@v2 + - name: Run tests run: cargo test --verbose + diff --git a/.gitignore b/.gitignore index 10b880e..545a39a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,7 @@ target/ workspace.code-workspace # macOS -.DS_Store \ No newline at end of file +.DS_Store + +# Vim files +*.vim \ No newline at end of file diff --git a/.rustfmt.toml b/.rustfmt.toml index 88bb35b..1460aaa 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,2 +1 @@ max_width = 88 -ignore = ["."] # rustfmt does a poor job, and I don't want it ruining well-formatted code diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cee498c..61d05fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,27 @@ The branching strategy looks like this: -The short description of the branching strategy is as follows. The feature branches are a category of branches that branch out of the `develop` branch. A person branches out from develop, works on a given feature on their branch and when the feature is ready they submit a Pull Request to merge again into the develop branch. After the review process is finished the commits from the branch should be squashed and then merged into `develop` (GitHubs WebUI provides that). Therefore each commit that lands on the `develop` branch is an addition of a feature, documentation etc.. When an arbitrary set of new features is completed and could be deemed as a new release (release cycle should follow the [semver](https://semver.org/) convention) it should be merged into `main` (of course it should also follow the process of a Pull Request and reviews) when it is merged into `main` additional testing, validation etc. should be done as this is now a release candidate. If the state of the code is deemed safe and proper it should be released as a new version of the software. This should be done by tagging which marks a given commit a release candidate which should automatically trigger a series of CI/CD checks and if they succeed the software package will be finally released. +The short description of the branching strategy is as follows. +The feature branches are a category of branches that branch out +of the `develop` branch. A person branches out from develop, +works on a given feature on their branch and when the feature +is ready they submit a Pull Request to merge again into the +develop branch. After the review process is finished the commits +from the branch should be squashed and then merged into `develop` +(GitHubs WebUI provides that). Therefore each commit that lands +on the `develop` branch is an addition of a feature, documentation +etc.. When an arbitrary set of new features is completed and could +be deemed as a new release (release cycle should follow the +[semver](https://semver.org/) convention) it should be merged +into `main` (of course it should also follow the process of a +Pull Request and reviews) when it is merged into `main` +additional testing, validation etc. should be done as this is +now a release candidate. If the state of the code is deemed safe +and proper it should be released as a new version of the software. +This should be done by tagging which marks a given commit a +release candidate which should automatically trigger a series of +CI/CD checks and if they succeed the software package will +be finally released. ![branching](img/branching.png) @@ -18,7 +38,8 @@ If you want to work on something create an issue for that. 1. Fill out the name for the issue 2. Provide a description for the task and what are your plans etc. 3. If you know you will be working on that task assign yourself -4. Add applicable labels to the task, e.g. if you are solving a bug then add `Bug`, if adding a new functionality add `Enhancement` etc. +4. Add applicable labels to the task, e.g. if you are solving a bug +then add `Bug`, if adding a new functionality add `Enhancement` etc. 5. Assign the task to the `rust-pip` project 6. If applicable assign the task to a given milestone 7. Submit the issue/task @@ -27,7 +48,8 @@ If you want to work on something create an issue for that. ## Creating a branch and using it -Then when you have created an issue for you task click the `Create new branch` in the lower right corner: +Then when you have created an issue for you task click the `Create new branch` +in the lower right corner: ![cr](img/create_a_branch.png) @@ -44,7 +66,9 @@ Now a branch has been created for you, copy the commands needed for you to use i ![asd](img/checkout.png) -In you cloned repository open a terminal and paste the copied commands. Now you should be on your newly created branch and you can start working. To make sure you are on that branch run: +In you cloned repository open a terminal and paste the copied commands. +Now you should be on your newly created branch and you can start working. +To make sure you are on that branch run: ```bash $ git branch @@ -53,11 +77,15 @@ $ git branch ``` The branch on which you currently reside will be marked with a `*`. -Next simply keep working on your branch, push commits, and when you think you are ready create a Pull Request, make sure that you mark your PR as a draft if its not ready for review otherwise it looks like noise. +Next simply keep working on your branch, push commits, and when you think +you are ready create a Pull Request, make sure that you mark your PR as a +draft if its not ready for review otherwise it looks like noise. ## Creating a Pull Request (PR) -After you create changes on your branch create a Pull Request and mark it as a `Draft` as that it can be seen that you are working on a given issue. Similarly to creating an issue ensure that: +After you create changes on your branch create a Pull Request and mark it +as a `Draft` as that it can be seen that you are working on a given issue. +Similarly to creating an issue ensure that: * Summary of changes in the body of the pull * Labels diff --git a/LICENSE b/LICENSE index dda2da5..94db588 100644 --- a/LICENSE +++ b/LICENSE @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/Makefile.toml b/Makefile.toml index dad9e9a..4f861ae 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -6,6 +6,16 @@ install_crate = "rustfmt" command = "cargo" args = ["fmt", "--", "--emit=files"] +[tasks.rust-fmt-check] +install_crate = "rustfmt" +command = "cargo" +args = ["fmt", "--", "--verbose", "--color", "auto"] + +[tasks.toml-fmt-check] +install_crate = { crate_name = "taplo-cli", binary = "taplo", test_arg = "--help" } +command = "taplo" +args = ["fmt", "--check", "*.toml"] + [tasks.clean] command = "cargo" args = ["clean"] @@ -28,4 +38,4 @@ dependencies = ["clean"] [tasks.doc] command = "cargo" args = ["doc"] -dependencies = ["clean"] \ No newline at end of file +dependencies = ["clean"] diff --git a/README.md b/README.md index 78a1a15..fe16ba1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ Pip rewritten in Rust. ## How to contribute -Please read this file and follow its instructions when it comes to contributing ot the project: +Please read this file and follow its instructions when it comes to +contributing ot the project: * [CONTRIBUTING.md](CONTRIBUTING.md) diff --git a/deny.yml b/deny.toml similarity index 84% rename from deny.yml rename to deny.toml index dd4e69c..cb370f4 100644 --- a/deny.yml +++ b/deny.toml @@ -18,13 +18,13 @@ # dependencies not shared by any other crates, would be ignored, as the target # list here is effectively saying which targets you are building for. targets = [ - # The triple can be any string, but only the target triples built in to - # rustc (as of 1.40) can be checked against actual config expressions - #{ triple = "x86_64-unknown-linux-musl" }, - # You can also specify which target_features you promise are enabled for a - # particular target. target_features are currently not validated against - # the actual valid features supported by the target architecture. - #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, + # The triple can be any string, but only the target triples built in to + # rustc (as of 1.40) can be checked against actual config expressions + #{ triple = "x86_64-unknown-linux-musl" }, + # You can also specify which target_features you promise are enabled for a + # particular target. target_features are currently not validated against + # the actual valid features supported by the target architecture. + #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, ] # This section is considered when running `cargo deny check advisories` @@ -48,7 +48,7 @@ notice = "warn" # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ - #"RUSTSEC-0000-0000", + #"RUSTSEC-0000-0000", ] # Threshold for security vulnerabilities, any vulnerability with a CVSS score # lower than the range specified will be ignored. Note that ignored advisories @@ -70,15 +70,17 @@ unlicensed = "warn" # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. allow = [ - "MIT", - "Apache-2.0", - "Apache-2.0 WITH LLVM-exception", + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "Unicode-DFS-2016", + "BSD-3-Clause", ] # List of explicitly disallowed licenses # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. deny = [ - #"Nokia", + #"Nokia", ] # Lint level for licenses considered copyleft copyleft = "warn" @@ -102,9 +104,9 @@ confidence-threshold = 0.8 # Allow 1 or more licenses on a per-crate basis, so that particular licenses # aren't accepted for every possible crate as with the normal allow list exceptions = [ - # Each entry is the crate and version constraint, and its specific allow - # list - #{ allow = ["Zlib"], name = "adler32", version = "*" }, + # Each entry is the crate and version constraint, and its specific allow + # list + #{ allow = ["Zlib"], name = "adler32", version = "*" }, ] # Some crates don't have (easily) machine readable licensing information, @@ -123,8 +125,8 @@ exceptions = [ # and the crate will be checked normally, which may produce warnings or errors # depending on the rest of your configuration #license-files = [ - # Each entry is a crate relative path, and the (opaque) hash of its contents - #{ path = "LICENSE", hash = 0xbd0eed23 } +# Each entry is a crate relative path, and the (opaque) hash of its contents +#{ path = "LICENSE", hash = 0xbd0eed23 } #] [licenses.private] @@ -137,7 +139,7 @@ ignore = false # is only published to private registries, and ignore is true, the crate will # not have its license(s) checked registries = [ - #"https://sekretz.com/registry + #"https://sekretz.com/registry ] # This section is considered when running `cargo deny check bans`. @@ -156,28 +158,28 @@ wildcards = "allow" highlight = "all" # List of crates that are allowed. Use with care! allow = [ - #{ name = "ansi_term", version = "=0.11.0" }, + #{ name = "ansi_term", version = "=0.11.0" }, ] # List of crates to deny deny = [ - # Each entry the name of a crate and a version range. If version is - # not specified, all versions will be matched. - #{ name = "ansi_term", version = "=0.11.0" }, - # - # Wrapper crates can optionally be specified to allow the crate when it - # is a direct dependency of the otherwise banned crate - #{ name = "ansi_term", version = "=0.11.0", wrappers = [] }, + # Each entry the name of a crate and a version range. If version is + # not specified, all versions will be matched. + #{ name = "ansi_term", version = "=0.11.0" }, + # + # Wrapper crates can optionally be specified to allow the crate when it + # is a direct dependency of the otherwise banned crate + #{ name = "ansi_term", version = "=0.11.0", wrappers = [] }, ] # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ - #{ name = "ansi_term", version = "=0.11.0" }, + #{ name = "ansi_term", version = "=0.11.0" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is # by default infinite skip-tree = [ - #{ name = "ansi_term", version = "=0.11.0", depth = 20 }, + #{ name = "ansi_term", version = "=0.11.0", depth = 20 }, ] # This section is considered when running `cargo deny check sources`.