Remove `mozilla-actions/sccache-action@v0.0.2` and instead use `taiki-ie/install-action` to install `sccache`, since we already use `taiki-e/install-action` for installing crates.
This PR also refactor just-setup.yml and use pass `GITHUB_TOKEN` to `taiki-e/install-action` which uses `cargo-binstall` for installing `cargo-auditable` and `sccache`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Fixed#851
* Add new dep leon to crate binstalk
* Add new variant `BinstallError::Template{Parse, Render}Error`
* Use `leon::Template` in mod `bins`
* Use `leon::Template` in mod `fetchers::gh_crate_meta`
* Refactor mod `bins`: Rm unused associated fn & fields from `Context`
* Simplify unit testing in mod `fetchers::gh_crate_meta`
* Rm soft-deprecated field `fetchers::gh_crate_meta::Context::format`
and change the `match` to resolve `archive` => `self.archive_format`.
* Make macro_rules `leon::template!` far easier to use
* Construct `leon::Template<'_>` as constant in `gh_crate_meta::hosting`
* Simplify `leon::Values` trait
Change its method `get_value` signature to
```rust
fn get_value(&self, key: &str) -> Option<Cow<'_, str>>;
```
Now, `ValuesFn` also accepts non-`'static` function, but now
`leon::Values` is only implemented for `&ValuesFn<F>` now.
This makes it a little bit more cumbersome to use but I think it's a
reasonable drawback.
* Rm `Send` bound req from `ValuesFn`
* Impl new fn `leon::Template::cast`
for casting `Template<'s>` to `Template<'t>` where `'s: 't`
* Rename `leon::Template::has_keys` => `has_any_of_keys`
* Make checking whether format related keys are present more robust
* Optimize `GhCrateMeta::launch_baseline_find_tasks`: Skip checking all fmt ext
if none of the format related keys ("format", "archive-format",
"archive-suffix") are present.
* Only ret `.exe` in `PkgFmt::extensions` on windows
by adding a new param `is_windows: bool`
* Improve debug msg in `GhCrateMeta::fetch_and_extract`
* Add warnings to `GhCrateMeta::find`
* Rm dep tinytemplate
* `impl<'s, 'rhs: 's> ops::AddAssign<&Template<'rhs>> for Template<'s>`
* `impl<'s, 'rhs: 's> ops::AddAssign<Template<'rhs>> for Template<'s>`
* `impl<'s, 'item: 's> ops::AddAssign<Item<'item>> for Template<'s>`
* `impl<'s, 'item: 's> ops::AddAssign<&Item<'item>> for Template<'s>`
* `impl<'s, 'rhs: 's> ops::Add<Template<'rhs>> for Template<'s>` (improved existing `Add` impl)
* `impl<'s, 'rhs: 's> ops::Add<&Template<'rhs>> for Template<'s>`
* `impl<'s, 'item: 's> ops::Add<Item<'item>> for Template<'s>`
* `impl<'s, 'item: 's> ops::Add<&Item<'item>> for Template<'s>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
since cache-cleanup will issue a lot of gh api requests, running the
workflow right after the PRs would cause the GH API to rate limit all
workflows (including our CI for testing and release) that they can no
longer upload artifacts and `cargo-binstall` would have to fallback to
sending GET requests instead of using GH API, which makes it a lot
slower and more likely to fail.
This PR changes it to be run at 3am and 4:30am AEST which nobody would submit
any PR at that time and then remove all caches of the top 20 closed prs.
The workflow can also now be triggered manually.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Previously it only removes 30 caches for the PR because gh actions-cache list defaults to only listing 30 cache entries.
In this PR, I changed the limit to the maximum allowed 100 cache entries and I also added a loop to keep getting the next 100 cache entries until there is none.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Partially resolve#731
Using symlinks not only add unnecessary bloat to users' `$CARGO_HOME/bin` directory, but it actually breaks `sccache`, which inspects its binary name and decides how to act on.
For `sccache` to function, it must be invoked directly or use a hard link.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Replace the algorithm with explicit state and complex matching with a loop that encodes state in the current structure of the loop.
The new code is much more readable and might be more performant since it uses `str::find`/`str::split_once` to look for next token instead of manually iterating over `str::chars`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
* leon: first implementation
* Update crates/leon/src/values.rs
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
* Workaround orphan rules to make API more intuitive
* Fmt
* Clippy
* Use CoW
* Use cow for items too
* Test that const construction works
* leon: Initial attempt at O(n) parser
* leon: finish parser (except escapes)
* leon: Improve ergonomics of compile-time templates
* Document helpers
* leon: Docs tweaks
* leon: Use macro to minimise parser tests
* leon: add escapes to parser
* leon: test escapes preceding keys
* leon: add multibyte tests
* leon: test escapes following keys
* Format
* Debug
* leon: Don't actually need to keep track of the key
* leon: Parse to vec first
* leon: there's actually no need for string cows
* leon: reorganise and redo macro now that there's no coww
* Well that was silly
* leon: Adjust text end when pushing
* leon: catch unbalanced keys
* Add error tests
* leon: Catch unfinished escape
* Comment out debugging
* leon: fuzz
* Clippy
* leon: Box parse error
* leon: &dyn instead of impl
* Can't impl FromStr, so rename to parse
* Add Vec<> to values
* leon: Add benches for ways to supply values
* leon: Add bench comparing to std and tt
* Fix fuzz
* Fmt
* Split ParseError and RenderError
* Make miette optional
* Remove RenderError lifetime
* Simplify ParseError type schema
* Write concrete Values types instead of generics
* Add license files
* Reduce criterion deps
* Make default a cow
* Add a CLI leon tool
* Fix tests
* Clippy
* Disable cli by default
* Avoid failing the build when cli is off
* Add to ci
* Update crates/leon/src/main.rs
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
* Update crates/leon/Cargo.toml
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
* Bump version
* Error not transparent
* Diagnostic can do forwarding
* Simplify error type
* Expand doc examples
* Generic Values for Hash and BTree maps
* One more borrowed
* Forward implementations
* More generics
* Add has_keys
* Lock stdout in leon tool
* No more debug comments in parser
* Even more generics
* Macros to reduce bench duplication
* Further simplify error
* Fix leon main
* Stable support
* Clippy
---------
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
Fixed https://github.com/cargo-bins/cargo-quickinstall/issues/195
- Fix `fetchers::QuickInstall`: Stop sending stats for `universal-apple-darwin`
since quickinstall only supports targets officially supports by rust.
- Only send stats report to quickinstall if the `Fetcher::find` is `.await`ed on
This prevents stats report to be sent for cases where the `QuickInstall` fetcher
is actually unused, e.g. resolved to `GhCrateMeta` or other `QuickInstall` fetcher
with different target.
This also reduces amount of http requests created in background.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Fixed#859
* Impl `cargo_config`
* Use `install.root` in `$CARGO_HOME/.cargo/config.toml`
before fallback to `cargo_home`.
* Improve logging in `get_cargo_roots_path`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>