Skip to content

Commit 23ff86e

Browse files
authored
Add strategy matrix for toolchain and different OSs with caching (#54)
Add strategy matrix for `ubuntu-latest`, `windows-latest`, `macos-latest` and toolchain matrix for `stable`, `beta`, `nightly`. Additionally some basic caching for the CI jobs has been added and some other misc reformats of the CI jobs
1 parent d62890c commit 23ff86e

15 files changed

+208
-93
lines changed

.github/issue_template.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### Description
2+
3+
<!-- Delete these comments later -->
4+
<!-- Put the description of the task here -->
5+
6+
### Checklist
7+
8+
* [ ] Connect all related issues, and project boards, add labels, assign people, milestones etc.
9+
* [ ] Make sure that this template is properly filled in and appropriate parts deleted

.github/pull_request_template.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Description
2+
3+
<!-- Delete these comments later -->
4+
<!-- Put the description of the task here -->
5+
6+
### Checklist
7+
8+
<!-- Don't delete these, check them with a mouse if completed -->
9+
* [ ] Add tests, documentation, update the changelog, etc.
10+
* [ ] Connect all issues, and project boards, add labels, assign people to the PR and the issue, etc.
11+
* [ ] Make sure that the PR description and title contain "Draft: " at the beginning if its not yet ready
12+
* [ ] Make sure that this template is properly filled in and appropriate parts deleted

.github/workflows/build.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: 🔨 Build
22

33
on:
44
pull_request:
@@ -10,17 +10,27 @@ env:
1010

1111
jobs:
1212
build:
13-
name: 🔨Build release
14-
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
toolchain: [stable, beta, nightly]
17+
name: 🔨 Build release
18+
runs-on: ${{ matrix.os }}
1519
steps:
1620
- uses: actions/checkout@v2
17-
- name: 🔨Build release
21+
- name: Install latest ${{ matrix.toolchain }}
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: ${{ matrix.toolchain }}
25+
- uses: actions/cache@v3
26+
with:
27+
path: |
28+
~/.cargo/bin/
29+
~/.cargo/registry/index/
30+
~/.cargo/registry/cache/
31+
~/.cargo/git/db/
32+
target/
33+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34+
- name: Build release
1835
run: cargo build --release
1936

20-
package:
21-
name: 📦Check package generation
22-
runs-on: ubuntu-latest
23-
steps:
24-
- uses: actions/checkout@v2
25-
- name: 📦Check package generation
26-
run: cargo package

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docs
1+
name: 📄 Build docs
22

33
on:
44
pull_request:
@@ -10,9 +10,9 @@ env:
1010

1111
jobs:
1212
docs:
13-
name: 📄Build docs
13+
name: 📄 Build docs
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: 📄Build docs
17+
- name: Build docs
1818
run: cargo doc --verbose

.github/workflows/format.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 👔 Check formatting
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["main", "develop", "release"]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
check_format:
13+
name: 👔 Check formatting
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
21+
- uses: davidB/rust-cargo-make@v1
22+
- name: Check Formatting
23+
run: cargo make rust-fmt-check
24+
check_format_markdown:
25+
name: 🖋 Check markdown files
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Check out code
29+
uses: actions/checkout@v2
30+
- name: Markdown Linting Action
31+
uses: avto-dev/markdown-lint@v1.5.0
32+
with:
33+
args: "*.md"
34+
check_format_toml:
35+
name: 🪦 Check toml files
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Check out code
39+
uses: actions/checkout@v2
40+
- uses: actions-rs/toolchain@v1
41+
with:
42+
toolchain: stable
43+
override: true
44+
- uses: davidB/rust-cargo-make@v1
45+
- run: cargo make toml-fmt-check
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Code check
1+
2+
name: 🖋 Check linting
23

34
on:
45
pull_request:
@@ -9,15 +10,19 @@ env:
910
CARGO_TERM_COLOR: always
1011

1112
jobs:
12-
code_check:
13-
name: 👔✒️Formatting and Linting
13+
check_lint:
14+
name: 🖋 Check linting
1415
runs-on: ubuntu-latest
1516
steps:
1617
- uses: actions/checkout@v2
17-
- name: 👔Check Formatting
18-
run: cargo fmt -- --verbose --check --color auto
19-
- name: ✒️Check linting
18+
- uses: actions-rs/toolchain@v1
19+
with:
20+
toolchain: stable
21+
override: true
22+
- uses: davidB/rust-cargo-make@v1
23+
- name: Check linting
2024
run: |
2125
rustup component add clippy
2226
set env RUSTFLAGS="-Dwarnings"
2327
cargo clippy --workspace -- -D warnings
28+

.github/workflows/package.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Package
1+
name: 📦 Package
22

33
on:
44
pull_request:
@@ -9,46 +9,28 @@ env:
99
CARGO_TERM_COLOR: always
1010

1111
jobs:
12-
# license:
13-
# name: 🏫License check
14-
# runs-on: ubuntu-latest
15-
# steps:
16-
# - uses: actions/checkout@v2
17-
# - name: 🏫Check license
18-
# run: |
19-
# cargo install cargo-deny
20-
# cargo deny check
21-
22-
package:
23-
name: 🔨Package
12+
license:
13+
name: 🏫License check
2414
runs-on: ubuntu-latest
2515
steps:
2616
- uses: actions/checkout@v2
27-
- name: 🔨Check package build
28-
run: cargo package --verbose
17+
- name: 🏫Check license
18+
run: |
19+
cargo install cargo-deny
20+
cargo deny check
2921
3022
cargo_check:
31-
name: 📦Check package integrity
23+
name: 📦 Check package integrity
3224
runs-on: ubuntu-latest
3325
steps:
3426
- uses: actions/checkout@v2
35-
- name: 📦Check package integrity
36-
run: cargo check --verbose
27+
- name: Check package integrity
28+
run: cargo package --verbose
3729

3830
publish_dry_run:
39-
name: 📢Publish dry-run
31+
name: 📢 Publish dry-run
4032
runs-on: ubuntu-latest
4133
steps:
4234
- uses: actions/checkout@v2
43-
- name: 📢Publish dry run
35+
- name: Publish dry run
4436
run: cargo publish --dry-run --verbose
45-
46-
# dummy_publish:
47-
# name: 📦⬆️📢Publish dummy
48-
# # needs: [license, package, cargo_check, publish_dry_run]
49-
# needs: [package, cargo_check, publish_dry_run]
50-
# runs-on: ubuntu-latest
51-
# steps:
52-
# - uses: actions/checkout@v2
53-
# - name: 📦⬆️📢Publish dry run
54-
# run: cargo publish --dry-run --verbose

.github/workflows/tests.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: 🧪 Tests
22

33
on:
44
pull_request:
@@ -10,9 +10,19 @@ env:
1010

1111
jobs:
1212
test:
13-
name: 🧪Run tests
14-
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
toolchain: [stable, beta, nightly]
17+
name: 🧪 Run tests
18+
runs-on: ${{ matrix.os }}
1519
steps:
1620
- uses: actions/checkout@v2
17-
- name: 🧪Run tests
21+
- name: Install latest ${{ matrix.toolchain }}
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: ${{ matrix.toolchain }}
25+
- uses: actions/checkout@v2
26+
- name: Run tests
1827
run: cargo test --verbose
28+

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ target/
2424
workspace.code-workspace
2525

2626
# macOS
27-
.DS_Store
27+
.DS_Store
28+
29+
# Vim files
30+
*.vim

.rustfmt.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
max_width = 88
2-
ignore = ["."] # rustfmt does a poor job, and I don't want it ruining well-formatted code

CONTRIBUTING.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,27 @@
55

66
The branching strategy looks like this:
77

8-
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.
8+
The short description of the branching strategy is as follows.
9+
The feature branches are a category of branches that branch out
10+
of the `develop` branch. A person branches out from develop,
11+
works on a given feature on their branch and when the feature
12+
is ready they submit a Pull Request to merge again into the
13+
develop branch. After the review process is finished the commits
14+
from the branch should be squashed and then merged into `develop`
15+
(GitHubs WebUI provides that). Therefore each commit that lands
16+
on the `develop` branch is an addition of a feature, documentation
17+
etc.. When an arbitrary set of new features is completed and could
18+
be deemed as a new release (release cycle should follow the
19+
[semver](https://semver.org/) convention) it should be merged
20+
into `main` (of course it should also follow the process of a
21+
Pull Request and reviews) when it is merged into `main`
22+
additional testing, validation etc. should be done as this is
23+
now a release candidate. If the state of the code is deemed safe
24+
and proper it should be released as a new version of the software.
25+
This should be done by tagging which marks a given commit a
26+
release candidate which should automatically trigger a series of
27+
CI/CD checks and if they succeed the software package will
28+
be finally released.
929

1030
![branching](img/branching.png)
1131

@@ -18,7 +38,8 @@ If you want to work on something create an issue for that.
1838
1. Fill out the name for the issue
1939
2. Provide a description for the task and what are your plans etc.
2040
3. If you know you will be working on that task assign yourself
21-
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.
41+
4. Add applicable labels to the task, e.g. if you are solving a bug
42+
then add `Bug`, if adding a new functionality add `Enhancement` etc.
2243
5. Assign the task to the `rust-pip` project
2344
6. If applicable assign the task to a given milestone
2445
7. Submit the issue/task
@@ -27,7 +48,8 @@ If you want to work on something create an issue for that.
2748

2849
## Creating a branch and using it
2950

30-
Then when you have created an issue for you task click the `Create new branch` in the lower right corner:
51+
Then when you have created an issue for you task click the `Create new branch`
52+
in the lower right corner:
3153

3254
![cr](img/create_a_branch.png)
3355

@@ -44,7 +66,9 @@ Now a branch has been created for you, copy the commands needed for you to use i
4466

4567
![asd](img/checkout.png)
4668

47-
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:
69+
In you cloned repository open a terminal and paste the copied commands.
70+
Now you should be on your newly created branch and you can start working.
71+
To make sure you are on that branch run:
4872

4973
```bash
5074
$ git branch
@@ -53,11 +77,15 @@ $ git branch
5377
```
5478

5579
The branch on which you currently reside will be marked with a `*`.
56-
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.
80+
Next simply keep working on your branch, push commits, and when you think
81+
you are ready create a Pull Request, make sure that you mark your PR as a
82+
draft if its not ready for review otherwise it looks like noise.
5783

5884
## Creating a Pull Request (PR)
5985

60-
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:
86+
After you create changes on your branch create a Pull Request and mark it
87+
as a `Draft` as that it can be seen that you are working on a given issue.
88+
Similarly to creating an issue ensure that:
6189

6290
* Summary of changes in the body of the pull
6391
* Labels

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

Makefile.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ install_crate = "rustfmt"
66
command = "cargo"
77
args = ["fmt", "--", "--emit=files"]
88

9+
[tasks.rust-fmt-check]
10+
install_crate = "rustfmt"
11+
command = "cargo"
12+
args = ["fmt", "--", "--verbose", "--color", "auto"]
13+
14+
[tasks.toml-fmt-check]
15+
install_crate = { crate_name = "taplo-cli", binary = "taplo", test_arg = "--help" }
16+
command = "taplo"
17+
args = ["fmt", "--check", "*.toml"]
18+
919
[tasks.clean]
1020
command = "cargo"
1121
args = ["clean"]
@@ -28,4 +38,4 @@ dependencies = ["clean"]
2838
[tasks.doc]
2939
command = "cargo"
3040
args = ["doc"]
31-
dependencies = ["clean"]
41+
dependencies = ["clean"]

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Pip rewritten in Rust.
1212

1313
## How to contribute
1414

15-
Please read this file and follow its instructions when it comes to contributing ot the project:
15+
Please read this file and follow its instructions when it comes to
16+
contributing ot the project:
1617

1718
* [CONTRIBUTING.md](CONTRIBUTING.md)
1819

0 commit comments

Comments
 (0)