From ae9e206e1914c0bcfeb034472f06a5eb5934c953 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Mon, 2 Nov 2020 22:17:33 -0600 Subject: [PATCH 01/10] Adds aliases between CI, config.toml, and Makefile.toml --- .cargo/config.toml | 4 ++ .github/workflows/build-test.yml | 63 ++++++++++++++--------- CONTRIBUTING.md | 8 ++- Makefile.toml | 57 ++++++++++++++++++++ components/plurals/benches/pluralrules.rs | 2 +- 5 files changed, 107 insertions(+), 27 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 Makefile.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000000..e125e845b5c --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[alias] +exam = "make exam" +lint = "make lint" +ci = "make ci" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 183059bf350..9a0916974bf 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -11,20 +11,12 @@ on: jobs: - # Build job - + # Build job - builds against all subsets of features, including null set (no features) build: - strategy: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - feature-set: [ "", "--all-features" ] # no feature options ("") uses default. - # --no-default-features is not allowed - # at root of virtual workspace for - # both build and test. - - runs-on: ${{ matrix.os }} steps: @@ -32,36 +24,57 @@ jobs: # TODO(#234) re-include cache steps, also using Rust version in cache key - # Build job > Build and run steps - + - name: Install cargo-all-features + run: cargo install cargo-all-features - name: Build + run: cargo build-all-features --verbose + + + # Test job - runs all testing commands in "cargo exam" + test: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + # TODO(#234) re-include cache steps, also using Rust version in cache key + + - name: Install cargo-make uses: actions-rs/cargo@v1.0.1 with: - command: build - args: ${{ matrix.feature-set }} --verbose - + command: install + args: --debug cargo-make - name: Test uses: actions-rs/cargo@v1.0.1 with: - command: test - args: ${{ matrix.feature-set }} --verbose + command: exam - # Formatting job - format: + # Lint job - runs all linting commands in "cargo lint" + lint: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - - name: Rust formatter - ## make this command fail if cargo fmt had to make changes - run: cargo fmt && git diff-index --exit-code HEAD + # TODO(#234) re-include cache steps, also using Rust version in cache key + - name: Install cargo-make + uses: actions-rs/cargo@v1.0.1 + with: + command: install + args: --debug cargo-make + - name: Lint + uses: actions-rs/cargo@v1.0.1 + with: + command: lint - # Linting job (cargo-clippy) - completes and puts warnings inline in PR - lint: + # Clippy job (cargo-clippy) - completes and puts warnings inline in PR + clippy: runs-on: ubuntu-latest needs: [build] @@ -69,7 +82,7 @@ jobs: steps: - uses: actions/checkout@v2 - # Linting job > Install and run clippy steps + # Clippy job > Install and run clippy steps - name: Install clippy run: rustup component add clippy diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 247e6c971e7..763cd6eadd9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,13 @@ That branch may end up containing one of more commits that are constituting the ### Checklist -Each commit and pull request should follow the [style guide](./docs/style-guide.md) and pass all checks such as tests and `cargo fmt`. If the PR is adding any public API changes, we'd also like to ensure that full coverage of `cargo doc` is preserved and code coverage is above `90%`. +Each commit and pull request should follow the [style guide](./docs/style-guide.md) and be properly formatted with `cargo fmt`. If the PR is adding any public API changes, we'd also like to ensure that full coverage of `cargo doc` is preserved and code coverage is above `90%`. + +Handy commands (run from the root directory): + +- `cargo lint` runs Clippy and other linting tools. It also tells you if your code is not properly formatted with `cargo fmt`. +- `cargo exam` runs all test configurations. +- `cargo ci` runs `cargo exam` and `cargo lint` in one go. ### Structure of commits in a Pull Request diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 00000000000..cbeba91bf36 --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,57 @@ +[config] +default_to_workspace = false + +### TESTS ### + +[tasks.test-all] +description = "Build and run all code paths except docs" +category = "ICU4X Development" +command = "cargo" +args = ["test", "--all-features", "--all-targets"] + +[tasks.test-docs] +description = "Build and run all tests and docs" +category = "ICU4X Development" +command = "cargo" +args = ["test", "--all-features", "--doc"] + +[tasks.exam] +description = "Run all test procedures" +category = "ICU4X Development" +command = "cargo" +dependencies = [ + "test-all", + "test-docs", +] + +### LINTS ### + +[tasks.fmt-check] +description = "Check for formatting on all code" +category = "ICU4X Development" +command = "cargo" +args = ["fmt", "--", "--check"] + +[tasks.clippy-all] +description = "Run Clippy on all code paths" +category = "ICU4X Development" +command = "cargo" +args = ["clippy", "--all-features", "--all-targets"] + +[tasks.lint] +description = "Run all lint procedures" +category = "ICU4X Development" +dependencies = [ + "fmt-check", + "clippy-all", +] + +### ALL-IN-ONE ### + +[tasks.ci] +description = "Run all lints and tests" +category = "ICU4X Development" +dependencies = [ + "exam", + "lint", +] diff --git a/components/plurals/benches/pluralrules.rs b/components/plurals/benches/pluralrules.rs index 6d6f6e827ed..c3f2f795a63 100644 --- a/components/plurals/benches/pluralrules.rs +++ b/components/plurals/benches/pluralrules.rs @@ -41,7 +41,7 @@ fn pluralrules(c: &mut Criterion) { }); }); - let lid = langid!("pl"); + let lid = langid!("be"); let pr = PluralRules::try_new(lid, &provider, PluralRuleType::Cardinal).unwrap(); c.bench_function("plurals/pluralrules/select/fs", |b| { b.iter(|| { From bc5c6bc7cbe7f7a3b2b4bb324962880c734e9adb Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Mon, 2 Nov 2020 22:32:29 -0600 Subject: [PATCH 02/10] Fix build-test.yml --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 9a0916974bf..5928bc47d38 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -203,7 +203,7 @@ jobs: runs-on: ubuntu-latest - needs: [build, format, benchmark] + needs: [build, lint, benchmark] ## Only create docs for merges/pushes to master (skip PRs). ## Multiple unfinished PRs should not clobber docs from approved code. From 68d88e2a8894c4ef6bcf61c668d8c0added64b35 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Mon, 2 Nov 2020 23:52:12 -0600 Subject: [PATCH 03/10] Tweaks to build-test.yml --- .github/workflows/build-test.yml | 12 ++++++++---- components/provider_cldr/Cargo.toml | 7 +++++++ components/provider_fs/Cargo.toml | 12 ++++++++++++ resources/testdata/Cargo.toml | 9 ++++++++- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 5928bc47d38..10d3a8235d9 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -25,8 +25,9 @@ jobs: # TODO(#234) re-include cache steps, also using Rust version in cache key - name: Install cargo-all-features - run: cargo install cargo-all-features - - name: Build + # TODO: Revert to upstream cargo-all-features pending features from "omit" branch + run: cargo install --git https://github.com/sffc/cargo-all-features.git --branch omit + - name: Build All Feature Permutations run: cargo build-all-features --verbose @@ -48,6 +49,11 @@ jobs: with: command: install args: --debug cargo-make + - name: Build + uses: actions-rs/cargo@v1.0.1 + with: + command: build + args: --all-features - name: Test uses: actions-rs/cargo@v1.0.1 with: @@ -77,8 +83,6 @@ jobs: clippy: runs-on: ubuntu-latest - needs: [build] - steps: - uses: actions/checkout@v2 diff --git a/components/provider_cldr/Cargo.toml b/components/provider_cldr/Cargo.toml index 6618a1e74f2..b049b91dbaf 100644 --- a/components/provider_cldr/Cargo.toml +++ b/components/provider_cldr/Cargo.toml @@ -19,6 +19,13 @@ include = [ "README.md" ] +[package.metadata.cargo-all-features] +# Omit most optional dependency features from permutation testing +skip_optional_dependencies = true +extra_features = [ + "log", +] + [dependencies] icu_provider = { version = "0.1", path = "../provider" } icu_locid = { version = "0.1", path = "../locid" } diff --git a/components/provider_fs/Cargo.toml b/components/provider_fs/Cargo.toml index 79953cdc499..2e73d2f5894 100644 --- a/components/provider_fs/Cargo.toml +++ b/components/provider_fs/Cargo.toml @@ -19,6 +19,18 @@ include = [ "README.md" ] +[package.metadata.cargo-all-features] +# Skip combinations of export with bincode, since they are designed to fail +skip_feature_sets = [ + ["export", "bincode"], + ["export-bin", "bincode"], +] +# Omit most optional dependency features from permutation testing +skip_optional_dependencies = true +extra_features = [ + "log", +] + [dependencies] icu_provider = { version = "0.1", path = "../provider" } icu_locid = { version = "0.1", path = "../locid", features = ["serde"] } diff --git a/resources/testdata/Cargo.toml b/resources/testdata/Cargo.toml index 167d038fb63..34002c01ef2 100644 --- a/resources/testdata/Cargo.toml +++ b/resources/testdata/Cargo.toml @@ -89,6 +89,13 @@ locales = [ # Git tag or sha1 for the CLDR data used to generate the testdata gitref = "36.0.0" +[package.metadata.cargo-all-features] +# Omit most optional dependency features from permutation testing +skip_optional_dependencies = true +extra_features = [ + "log", +] + [dependencies] icu_provider = { version = "0.1", path = "../../components/provider" } icu_provider_fs = { version = "0.1", path = "../../components/provider_fs" } @@ -109,7 +116,7 @@ simple_logger = { version = "1.11", optional = true } icu_locid_macros = { version = "0.1", path = "../../components/locid/macros" } [features] -metadata = ["serde", "serde_json", "icu_locid/serde"] +metadata = ["cargo_metadata", "serde", "serde_json", "icu_locid/serde"] icu4x-gen-testdata = [ "cargo_metadata", "clap", From 54d02f9fa9bcdbb0f63a31759715d4a23e25ed53 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 3 Nov 2020 00:13:04 -0600 Subject: [PATCH 04/10] More tweaks to build-test.yml --- .cargo/config.toml | 1 + .github/workflows/build-test.yml | 42 ++++++++++++++++++++++---------- CONTRIBUTING.md | 3 ++- Makefile.toml | 20 +++++++++++++-- 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index e125e845b5c..a000ac4ec24 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,5 @@ [alias] exam = "make exam" lint = "make lint" +quick = "make quick" ci = "make ci" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 10d3a8235d9..6b45445ca6b 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -11,8 +11,9 @@ on: jobs: - # Build job - builds against all subsets of features, including null set (no features) - build: + + # Test job - runs all testing commands in "cargo exam" + test: strategy: fail-fast: false matrix: @@ -24,15 +25,24 @@ jobs: # TODO(#234) re-include cache steps, also using Rust version in cache key - - name: Install cargo-all-features - # TODO: Revert to upstream cargo-all-features pending features from "omit" branch - run: cargo install --git https://github.com/sffc/cargo-all-features.git --branch omit - - name: Build All Feature Permutations - run: cargo build-all-features --verbose + - name: Install cargo-make + uses: actions-rs/cargo@v1.0.1 + with: + command: install + args: --debug cargo-make + - name: Build + uses: actions-rs/cargo@v1.0.1 + with: + command: build + args: --all-features + - name: Test + uses: actions-rs/cargo@v1.0.1 + with: + command: exam - # Test job - runs all testing commands in "cargo exam" - test: + # Build job - builds all permutations of features + build: strategy: fail-fast: false matrix: @@ -44,20 +54,21 @@ jobs: # TODO(#234) re-include cache steps, also using Rust version in cache key - - name: Install cargo-make + - name: Install cargo-all-features uses: actions-rs/cargo@v1.0.1 with: command: install - args: --debug cargo-make + # TODO: Revert to upstream cargo-all-features pending features from "omit" branch + args: --git https://github.com/sffc/cargo-all-features.git --branch omit - name: Build uses: actions-rs/cargo@v1.0.1 with: command: build args: --all-features - - name: Test + - name: Build All Feature Permutations uses: actions-rs/cargo@v1.0.1 with: - command: exam + command: make build-all-features # Lint job - runs all linting commands in "cargo lint" @@ -73,6 +84,11 @@ jobs: with: command: install args: --debug cargo-make + - name: Build + uses: actions-rs/cargo@v1.0.1 + with: + command: build + args: --all-features - name: Lint uses: actions-rs/cargo@v1.0.1 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 763cd6eadd9..dfc06519c36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,8 @@ Handy commands (run from the root directory): - `cargo lint` runs Clippy and other linting tools. It also tells you if your code is not properly formatted with `cargo fmt`. - `cargo exam` runs all test configurations. -- `cargo ci` runs `cargo exam` and `cargo lint` in one go. +- `cargo quick` runs the fastest tests and lints. +- `cargo ci` runs all tests and lints. ### Structure of commits in a Pull Request diff --git a/Makefile.toml b/Makefile.toml index cbeba91bf36..0d7edd00ef6 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,7 +1,7 @@ [config] default_to_workspace = false -### TESTS ### +### MAIN TESTS ### [tasks.test-all] description = "Build and run all code paths except docs" @@ -18,12 +18,19 @@ args = ["test", "--all-features", "--doc"] [tasks.exam] description = "Run all test procedures" category = "ICU4X Development" -command = "cargo" dependencies = [ "test-all", "test-docs", ] +### ADDITIONAL TESTS ### + +[tasks.build-all-features] +description = "Build all permutations of all features" +category = "ICU4X Development" +command = "cargo" +args = ["build-all-features"] + ### LINTS ### [tasks.fmt-check] @@ -48,10 +55,19 @@ dependencies = [ ### ALL-IN-ONE ### +[tasks.quick] +description = "Run quick version of all lints and tests" +category = "ICU4X Development" +dependencies = [ + "test-all", + "lint", +] + [tasks.ci] description = "Run all lints and tests" category = "ICU4X Development" dependencies = [ "exam", + "build-all-features", "lint", ] From bcecf6c8767ee55cd1ed3331cf7af60cc6e7ce2c Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 3 Nov 2020 00:22:05 -0600 Subject: [PATCH 05/10] Remove cargo make dependency from build-all-features CI --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 6b45445ca6b..95e4a7ace77 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -68,7 +68,7 @@ jobs: - name: Build All Feature Permutations uses: actions-rs/cargo@v1.0.1 with: - command: make build-all-features + command: build-all-features # Lint job - runs all linting commands in "cargo lint" From 5e97e61c739c67d6a7b03d1936067dda7e47298a Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 3 Nov 2020 00:33:28 -0600 Subject: [PATCH 06/10] Remove redundant clippy from CI --- .github/workflows/build-test.yml | 9 ++------- Makefile.toml | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 95e4a7ace77..af0b7947f51 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -71,7 +71,7 @@ jobs: command: build-all-features - # Lint job - runs all linting commands in "cargo lint" + # Lint job - runs all linting commands in "cargo make lint-no-clippy" lint: runs-on: ubuntu-latest steps: @@ -84,15 +84,10 @@ jobs: with: command: install args: --debug cargo-make - - name: Build - uses: actions-rs/cargo@v1.0.1 - with: - command: build - args: --all-features - name: Lint uses: actions-rs/cargo@v1.0.1 with: - command: lint + command: make lint-no-clippy # Clippy job (cargo-clippy) - completes and puts warnings inline in PR diff --git a/Makefile.toml b/Makefile.toml index 0d7edd00ef6..38c3ab0bf21 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -10,7 +10,7 @@ command = "cargo" args = ["test", "--all-features", "--all-targets"] [tasks.test-docs] -description = "Build and run all tests and docs" +description = "Build and run all docs tests" category = "ICU4X Development" command = "cargo" args = ["test", "--all-features", "--doc"] @@ -45,11 +45,19 @@ category = "ICU4X Development" command = "cargo" args = ["clippy", "--all-features", "--all-targets"] +# Lint target without Clippy. Used in CI since Clippy has a separate CI task. +[tasks.lint-no-clippy] +description = "Run all lint procedures except for Clippy" +category = "ICU4X Development" +dependencies = [ + "fmt-check", +] + [tasks.lint] description = "Run all lint procedures" category = "ICU4X Development" dependencies = [ - "fmt-check", + "lint-no-clippy", "clippy-all", ] @@ -60,7 +68,8 @@ description = "Run quick version of all lints and tests" category = "ICU4X Development" dependencies = [ "test-all", - "lint", + "fmt-check", + "clippy-all", ] [tasks.ci] From 194835936a412a9aa724601f281f7bb4d6ec8a32 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 3 Nov 2020 00:43:25 -0600 Subject: [PATCH 07/10] Refactor tasks again --- .cargo/config.toml | 2 -- .github/workflows/build-test.yml | 16 ++++++++------ CONTRIBUTING.md | 2 -- Makefile.toml | 36 ++++---------------------------- 4 files changed, 14 insertions(+), 42 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index a000ac4ec24..651a3122b1e 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,3 @@ [alias] -exam = "make exam" -lint = "make lint" quick = "make quick" ci = "make ci" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index af0b7947f51..48efed98ce4 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -12,7 +12,7 @@ on: jobs: - # Test job - runs all testing commands in "cargo exam" + # Test job - runs all "cargo make" testing commands test: strategy: fail-fast: false @@ -35,10 +35,14 @@ jobs: with: command: build args: --all-features - - name: Test + - name: Test All Targets uses: actions-rs/cargo@v1.0.1 with: - command: exam + command: make test-all + - name: Test Docs + uses: actions-rs/cargo@v1.0.1 + with: + command: make test-docs # Build job - builds all permutations of features @@ -71,7 +75,7 @@ jobs: command: build-all-features - # Lint job - runs all linting commands in "cargo make lint-no-clippy" + # Lint job - runs all "cargo make" linting commands lint: runs-on: ubuntu-latest steps: @@ -84,10 +88,10 @@ jobs: with: command: install args: --debug cargo-make - - name: Lint + - name: Check Format uses: actions-rs/cargo@v1.0.1 with: - command: make lint-no-clippy + command: make fmt-check # Clippy job (cargo-clippy) - completes and puts warnings inline in PR diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfc06519c36..0d840be2257 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,8 +22,6 @@ Each commit and pull request should follow the [style guide](./docs/style-guide. Handy commands (run from the root directory): -- `cargo lint` runs Clippy and other linting tools. It also tells you if your code is not properly formatted with `cargo fmt`. -- `cargo exam` runs all test configurations. - `cargo quick` runs the fastest tests and lints. - `cargo ci` runs all tests and lints. diff --git a/Makefile.toml b/Makefile.toml index 38c3ab0bf21..6c4d62eb73a 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,7 +1,7 @@ [config] default_to_workspace = false -### MAIN TESTS ### +### INDIVIDUAL TEST AND LINT TASKS ### [tasks.test-all] description = "Build and run all code paths except docs" @@ -15,24 +15,12 @@ category = "ICU4X Development" command = "cargo" args = ["test", "--all-features", "--doc"] -[tasks.exam] -description = "Run all test procedures" -category = "ICU4X Development" -dependencies = [ - "test-all", - "test-docs", -] - -### ADDITIONAL TESTS ### - [tasks.build-all-features] description = "Build all permutations of all features" category = "ICU4X Development" command = "cargo" args = ["build-all-features"] -### LINTS ### - [tasks.fmt-check] description = "Check for formatting on all code" category = "ICU4X Development" @@ -45,23 +33,7 @@ category = "ICU4X Development" command = "cargo" args = ["clippy", "--all-features", "--all-targets"] -# Lint target without Clippy. Used in CI since Clippy has a separate CI task. -[tasks.lint-no-clippy] -description = "Run all lint procedures except for Clippy" -category = "ICU4X Development" -dependencies = [ - "fmt-check", -] - -[tasks.lint] -description = "Run all lint procedures" -category = "ICU4X Development" -dependencies = [ - "lint-no-clippy", - "clippy-all", -] - -### ALL-IN-ONE ### +### META TASKS ### [tasks.quick] description = "Run quick version of all lints and tests" @@ -76,7 +48,7 @@ dependencies = [ description = "Run all lints and tests" category = "ICU4X Development" dependencies = [ - "exam", + "quick", + "test-docs", "build-all-features", - "lint", ] From 31089bd7ccade59622ff6df735f8a8f213ccc4f4 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 3 Nov 2020 00:44:56 -0600 Subject: [PATCH 08/10] Fix build-test.yml syntax --- .github/workflows/build-test.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 48efed98ce4..f59a43e9f48 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -38,11 +38,13 @@ jobs: - name: Test All Targets uses: actions-rs/cargo@v1.0.1 with: - command: make test-all + command: make + args: test-all - name: Test Docs uses: actions-rs/cargo@v1.0.1 with: - command: make test-docs + command: make + args: test-docs # Build job - builds all permutations of features @@ -91,7 +93,8 @@ jobs: - name: Check Format uses: actions-rs/cargo@v1.0.1 with: - command: make fmt-check + command: make + args: fmt-check # Clippy job (cargo-clippy) - completes and puts warnings inline in PR From 5fcab3d2a7697853adee218c5a4f2a42573bb99b Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 10 Nov 2020 01:45:41 -0600 Subject: [PATCH 09/10] Move more logic into .cargo/config.toml with latest cargo-make release --- .cargo/config.toml | 20 ++++++++++++++++++++ .github/workflows/build-test.yml | 22 ++++------------------ Makefile.toml | 28 ++++------------------------ 3 files changed, 28 insertions(+), 42 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 651a3122b1e..7bda7e7d5f9 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,23 @@ [alias] + +### INDIVIDUAL TEST AND LINT TASKS ### + +# Build and run all code paths except docs +test-all = "test --all-features --all-targets" + +# Build and run all docs tests +test-docs = "test --all-features --doc" + +# Check for formatting on all code +fmt-check = "fmt -- --check" + +# Run Clippy on all code paths +clippy-all = "clippy --all-features --all-targets" + +### META TASKS ### + +# Run quick version of all lints and tests quick = "make quick" + +# Run all lints and tests ci = "make ci" diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f59a43e9f48..cfd8ecfebe8 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -25,11 +25,6 @@ jobs: # TODO(#234) re-include cache steps, also using Rust version in cache key - - name: Install cargo-make - uses: actions-rs/cargo@v1.0.1 - with: - command: install - args: --debug cargo-make - name: Build uses: actions-rs/cargo@v1.0.1 with: @@ -38,13 +33,11 @@ jobs: - name: Test All Targets uses: actions-rs/cargo@v1.0.1 with: - command: make - args: test-all + command: test-all - name: Test Docs uses: actions-rs/cargo@v1.0.1 with: - command: make - args: test-docs + command: test-docs # Build job - builds all permutations of features @@ -64,8 +57,7 @@ jobs: uses: actions-rs/cargo@v1.0.1 with: command: install - # TODO: Revert to upstream cargo-all-features pending features from "omit" branch - args: --git https://github.com/sffc/cargo-all-features.git --branch omit + args: cargo-all-features --version "^1.4" - name: Build uses: actions-rs/cargo@v1.0.1 with: @@ -85,16 +77,10 @@ jobs: # TODO(#234) re-include cache steps, also using Rust version in cache key - - name: Install cargo-make - uses: actions-rs/cargo@v1.0.1 - with: - command: install - args: --debug cargo-make - name: Check Format uses: actions-rs/cargo@v1.0.1 with: - command: make - args: fmt-check + command: fmt-check # Clippy job (cargo-clippy) - completes and puts warnings inline in PR diff --git a/Makefile.toml b/Makefile.toml index 6c4d62eb73a..368d0bc22bd 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,38 +1,18 @@ [config] default_to_workspace = false +load_cargo_aliases = true ### INDIVIDUAL TEST AND LINT TASKS ### - -[tasks.test-all] -description = "Build and run all code paths except docs" -category = "ICU4X Development" -command = "cargo" -args = ["test", "--all-features", "--all-targets"] - -[tasks.test-docs] -description = "Build and run all docs tests" -category = "ICU4X Development" -command = "cargo" -args = ["test", "--all-features", "--doc"] +# Note: If a task is purely a cargo alias, define it in .cargo/config.toml [tasks.build-all-features] description = "Build all permutations of all features" category = "ICU4X Development" +install_crate = { crate_name = "cargo-all-features", binary = "cargo-build-all-features", test_arg = ["--help"] } +install_crate_args = ["--version", "^1.4"] command = "cargo" args = ["build-all-features"] -[tasks.fmt-check] -description = "Check for formatting on all code" -category = "ICU4X Development" -command = "cargo" -args = ["fmt", "--", "--check"] - -[tasks.clippy-all] -description = "Run Clippy on all code paths" -category = "ICU4X Development" -command = "cargo" -args = ["clippy", "--all-features", "--all-targets"] - ### META TASKS ### [tasks.quick] From 6a0a6fd3314bb22270d1c2742fd3289e13da8b5e Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Tue, 10 Nov 2020 01:52:39 -0600 Subject: [PATCH 10/10] Pre-build test targets in test job --- .github/workflows/build-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index cfd8ecfebe8..278aa192528 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -29,7 +29,7 @@ jobs: uses: actions-rs/cargo@v1.0.1 with: command: build - args: --all-features + args: --all-targets --all-features - name: Test All Targets uses: actions-rs/cargo@v1.0.1 with: @@ -62,7 +62,7 @@ jobs: uses: actions-rs/cargo@v1.0.1 with: command: build - args: --all-features + args: --all-targets --all-features - name: Build All Feature Permutations uses: actions-rs/cargo@v1.0.1 with: