Commit graph

222 commits

Author SHA1 Message Date
Jiahao XU
f0c3d1e724
fix release-build.yml: Fix cache key for Swatinem/rust-cache@v2 (#1180)
Set `CARGO_*` env before caching is done.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-27 06:25:57 +00:00
Jiahao XU
3d81c147be
fix release-build.yml: Explicitly set release_name to the same as tag (#1181)
Fixed #699

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-27 06:25:38 +00:00
Jiahao XU
2f890cc344
ci: Check package publish in release-pr.yml (#1170)
before creating the release PR.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-26 01:42:35 +00:00
Jiahao XU
4ddd860c01
ci: Verify before publishing (#1167)
Run `cargo-publish` without `--no-verify` to verify the publish is valid
and does not depend on unpublished crates in job tag of workflow
`release.yml`, which could be caused by incorrect merge order.

Also enabled `check-semver` to `cargo-bins/release-pr@v2` and install
`cargo-semver-checks` using `taiki-e/install-action@v2` in
job make-release-pr of workflow `release-pr.yml`, since
`release-pr` would try to use `cargo-binstall` for installing
`cargo-semver-checks` used in `check-semver`, but we did not explicitly
require `taiki-e/install-actions@v2` to install `cargo-binstall`, so
`release-pr` could fallback to `cargo-install` which is just too slow.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-24 15:23:15 +00:00
Jiahao XU
abecd9ae14
ci: Publish to crates.io in release.yml after tagging (#1152)
Fixed #1046

so that we don't have to manually run `cargo-publish` after the CI is
merged.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-21 10:04:09 +00:00
Jiahao XU
40efe02e34
fix leon & binstalk-downloader bug relating to features (#1153)
- ci: Check feat powerset of leon & binstalk-downloader in `ci.yml`
 - fix leon feature `cli`: Enable dep `miette` in feature `cli`
 - fix binstalk-downloader when default feature is disabled and no other
   tls related feature is enabled (breaking change due to replace of
   `tls::Version` with newtype `TLSVersion`).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-19 02:22:09 +00:00
Félix Saparelli
bea66d04b5
Fix PR CI triggers (#1150)
- Remove trigger on "auto merge" enablement, which is just annoying now with the merge queue and was only ever an additional workaround for the release PRs.
- Always run the PR CIs, don't ignore markdown files. That made it impossible to merge PRs that only touched those files (without bypassing requirements).
2023-06-17 10:17:24 +00:00
Jiahao XU
1369eea802
fix dependabot path to crates (#1148)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-17 09:22:09 +00:00
Jiahao XU
d390d320e9
Set upgrade-transitive-deps.yml to run on every Fri (#1145)
To avoid unnecessary PRs.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-12 01:23:12 +00:00
Jiahao XU
16be14a07d
dependabot: Only create PR for incompatible updates (#1138)
for direct dependencies since compatible updates is already
covered by `update-transitive-deps.yml`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-06 11:46:47 +00:00
Jiahao XU
e62049d59d
ci: Fix cache-cleanup.yml non-zero exit status (#1136)
ci: Fix `cache-cleanup.yml` `cut` non-zero exit status

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-06 04:09:05 +00:00
Jiahao XU
76cd4d62c2
dep: Add new workflow upgrade-transitive-deps.yml (#1130)
for upgrading transitive dependencies.

While dependabot is great, it opens one PR for each of these transitive
dependencies, which makes merging harder:
 - have to approve every PR
 - have to click merge when ci is done

it also creates merge queue runs and commits to main, thus creates a lot
of unused caches and unnecessary CI runs.

This PR creates `upgrade-transitive-deps.yml` that creates one PR for
all transitive change per-day.

It also configures dependabot to only `increase-if-necessary`, same as
library crates.

Since we have several library crates in our workspace, this would mean
that we would have less unnecessary deps bump on these library crates.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-05 14:09:42 +00:00
Jiahao XU
cc87fe062d
ci: Rm merge queue cache in cache-cleanup.yml (#1129)
since they cannot be reused

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-05 12:54:01 +00:00
Jiahao XU
b69c082160
ci: Switch to Swatinem/rust-cache@v2 (#1113)
Fixed #1038

sccache is not very effective at caching dependencies, the external
C/C++ is recompiled in every ci and it takes a lot of time.

Compilation of other Rust dependencies also takes quite some time and
sccache is not helping at all, so I decided to switch to
`Swatinem/rust-cache@v2`.

The downside of the new caching method is that a new cache conntaining
part of the `.cargo/` and `target/` will be created whenver
`Cargo.lock`/`Cargo.toml` changes, but it can still reuse the old cache
to create new caching.

This is acceptable given that `sccache` often fails to reuse
cache due to rate limiting from GHA, since it is not designed for use
like a s3 object pool, and `sccache` will create a lot of new cache
artifacts for a given branch that cannot be reused in main and would
have to cleanup via a cronjob.

Edit:

rust 1.70 uses llvm 16.0, however ubuntu-latest still uses llvm 15.0
As such, during release-build, cross-lang-lto failed due to llvm is too
old.

Temporarily disable linker-plugin-lto to fix this.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-02 04:03:29 +00:00
Jiahao XU
9ecfce4104
Fallback to pull_request num or commit sha if github.ref is not available (#1115)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-02 09:25:24 +12:00
Jiahao XU
db6f3d2bfd
ci: Disable lto for ci.yml job release-builds (#1114)
LTO takes way too long and it is mature enough that it usually does not
have any miscompilation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-01 09:48:00 +00:00
Jiahao XU
e79bb2ab10
Include cargo-timings report in release build (#1110)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-01 03:58:11 +00:00
Jiahao XU
256fb36e74
Require job release-builds to pass for merging (#1088)
Fixed #1072

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-25 12:49:06 +00:00
Félix Saparelli
9a26c18763
Enable merge queue (#1047) 2023-05-12 03:52:34 +00:00
Jiahao XU
492f8ee59d
dependabot: Update deps of direct deps & simplify config (#1025)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-03 20:05:27 +10:00
Jiahao XU
6516805f10
Speedup release-build.yml: Do not run unit-tests (#1015)
`cargo-test` cannot share its artifacts with `cargo-build` and vice
versa, plus running `e2e-tests` in release build is enough to find out
potential miscompilation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-26 19:57:48 +10:00
Jiahao XU
5683ca2476
Add new crate leon-macros that provide template! with identical syntax as runtime parsing (#946)
`leon_macros::template!` can parse template at compile-time.
It accepts a utf-8 string literal and uses `leon` internally to parse it, then generate code that evaluates to `Template<'static>`.

 - Exclude fuzz from crate leon when publishing
 - Impl fn-like proc-macro `leon_macros::template!`
 - Add dep `leon-macros` to binstalk
 - Use `leon_macros::template!` in `binstalk::fetchers::gh_crate_meta::hosting`
 - Add doc for `leon-macros` in `leon`
 - Improve `std::fmt::Display` impl for `leon::ParseError`
 - Fixed broken infra link in leon

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-17 14:50:58 +10:00
Jiahao XU
35b32c43e0
Run release-build.yml unconditionally for consistency & inc cache hits (#982)
Since it is run on PR anyway, we should also run it on main just in case
it fails, i.e. merging of PRs without rebasing against main to test out
latest changes.

It will now also be run on draft PR so that they can test out the
changes and find out bugs before making it ready to review.

This change will also increase cache hits on PR, thus speeding up the CI.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-06 18:08:14 +10:00
Jiahao XU
f134df548d
Optimize release-build.yml: Avoid building benchmark dependencies (#981)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-06 16:19:15 +10:00
Jiahao XU
f384088fd1
Avoid checking dev-deps for jobs *-check and lint in workflow ci.yml (#978)
Avoid checking dev-deps for jobs `*-check` and lint in workflow `ci.yml`

We just want to make sure cargo-binstall can compile for the target, we
don't want to pull in the extra dependencies.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:51:13 +10:00
Jiahao XU
8dd7aa5688
Speedup ci.yml: Do not run tests on x86_64-unknown-linux-musl (#976)
Speedup ci.yml: Do not run tests on x86_64-unknown-linux-musl

Since we already run test on x86_64-unknown-linux-musl in
release-build.yml and x86_64-unknown-linux-musl is almost identical to
x86_64-unknown-linux-gnu except for the libc, there's no need to run the
tests in ci.yml

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:40:26 +10:00
Jiahao XU
24634b2de1
Speedup workflow lipo in release-build.yml (#975)
Speedup workflow lipo in release-build

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:40:13 +10:00
Jiahao XU
6a224da9ee
Run unit tests in release-build.yml (#977)
Since release build enables a lot of optimization, disable debug assert
and possibly change the code to be run, it's better to run the tests
again.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:40:01 +10:00
Jiahao XU
a403c99d3f
Upgrade CI to use sccache v0.4.0 for caching (#934)
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>
2023-03-26 17:28:35 +11:00
Jiahao XU
47d4aeaa96
Run cache-cleanup at 3am & 4:30am AEST instead of after every PR (#944)
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>
2023-03-23 18:10:30 +11:00
Jiahao XU
9a59119163
Fully remove all caches for PR in cache-cleanup.yml (#942)
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>
2023-03-23 02:50:13 +13:00
Félix Saparelli
2227d363f7
Leon template library (#766)
* 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>
2023-03-21 01:36:02 +00:00
Félix Saparelli
48b85cc38f
Cleanup caches for closed PRs (#915)
As suggested here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches
2023-03-15 15:44:06 +11:00
Jiahao XU
42bffef98c
Use sccache for build cache and disable incremental mode in CI (#914)
Fixed #911

sccache cannot cache build artifacts if incremental mode is enabled.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-15 15:42:42 +11:00
Jiahao XU
235d324d3d
Add job windows-aarch64-check to workflow ci (#882)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-11 23:46:26 +11:00
Jiahao XU
18bc81f46f
Use cargo-auditable for release build (#878)
to make the pre-built artifacts auditable by `cargo-audit` and other
tools.

* Add new env `JUST_USE_AUDITABLE` to enable use of `cargo-auditable`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-11 15:57:14 +13:00
Félix Saparelli
ac414df5be
Use stable sparse registry option (#879) 2023-03-11 01:58:58 +00:00
Jiahao XU
44eaff97dc
Fix use of hashFiles in key of bulid-cache (#845)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 15:40:39 +11:00
Jiahao XU
c8b92b1985
Speedup CI (#842)
- Remove `tools: cross` input to `actions/just-setup`
    since we use `cargo-zigbuild` for cross compiling instead of `cross-rs`
    now.
 - Only install `cargo-zigbuild` in `just ci-install-deps` if `JUST_USE_CARGO_ZIGBUILD` is enabled
 - Include hash of `rustc -vV` in `build-cache`
    Switching between different versions of `rustc` will cause all crates to be
    rebuilt using new `rustc`.
 - Replace input `cache` with `index-cache` and `build-cache` in `actions/just-setup`
    for better control of caching behavior
 -  Reuse workflow `test`'s `build-cache` in workflow `lint`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 13:09:25 +11:00
Jiahao XU
599bcaf333
Impl GhApiClient and use it in cargo-binstall to speedup resolution process (#832)
Fixed #776

 - Add new feature gh-api-client to binstalk-downloader
 - Impl new type `binstalk_downloader::remote::{RequestBuilder, Response}`
 - Impl `binstalk_downloader::gh_api_client::GhApiClient`, exposed if `cfg(feature = "gh-api-client")` and add e2e and unit tests for it
 - Use `binstalk_downloader::gh_api_client::GhApiClient` to speedup `cargo-binstall`
 - Add new option `--github-token` to supply the token for GitHub restful API, or read from env variable `GITHUB_TOKEN` if not present.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 12:04:22 +11:00
Jiahao XU
2bf70b6a01
Run e2e test for release build and fix it by switching back to stable (#818)
* Run e2e-tests for release build
* Print `RUSTFLAGS` for justfile target build & check
* Fix CI: Disable miropt level 4
* Fix CI: Disable -Zbuild-std
* Disable `-Zgcc-ld=lld` and `-Zshare-generics` so that we can switch back to stable

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-28 11:53:57 +00:00
Jiahao XU
e76a4dff62
Improve CI: All in cargo-zigbuild for linux targets (#816) 2023-02-18 13:41:17 +11:00
Jiahao XU
9923788f07
Fix CI: Only turn on feature pkg-config on linux and fix cross compilation (#815)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-18 00:07:24 +13:00
Jiahao XU
61c992612c
Switch to cargo-zigbuild for aarch64-unknown-linux-gnu and x86_64-unknown-linux-musl (#814)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-17 09:36:45 +13:00
Jiahao XU
93f15ea1c4
Ignore README.md and SUPPORT.md in workflow "ci" (#812)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-16 11:58:16 +13:00
Jiahao XU
647f02bb59
Use cargo-zigbuild for cross compilation (#767)
* Disable link arg `-lgcc` for musl builds when `cargo-zigbuild` is used

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 11:19:59 +13:00
Jiahao XU
87686cb2f7
Feature: Better retry policy in binstalk-downloader (#794)
Fixed #779 #791 

 - Retry request on timeout
 - Retry for `StatusCode::{REQUEST_TIMEOUT, GATEWAY_TIMEOUT}`
 - Add `DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT` for 503/429
   if 503/429 does not give us a header or give us an invalid header on
   when to retry, we would default to
   `DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT`.
 - Fix `Client::get_redirected_final_url`: Retry using `GET` on status code 400..405 + 410
 - Rename remote_exists => remote_gettable & support fallback to GET
   if HEAD fails due to status code 400..405 + 410.
 - Improve `Client::get_stream`: Include url & method in the err of the stream returned

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-13 13:43:48 +11:00
Jiahao XU
f46de3714a
Add step to relase-build to make sure it's runnable (#792)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-12 14:48:28 +11:00
Félix Saparelli
939f17dcd0
Fix "Tests pass" step (#726) 2023-01-18 03:13:49 +13:00
Félix Saparelli
ba91777faf
Fix name of release (#723) 2023-01-18 00:22:49 +13:00