Commit graph

217 commits

Author SHA1 Message Date
Félix Saparelli
5d4333d5c8
Fix release build again (#1400)
* Fix build again

* Recommend (r)age over minisign password

* Dry-run the entire release process

* Reorg a bit so dry-run works

* Fix secret name

* Add check on age key

* Pass secrets down

* Use a cross-platform "date"

* Delete signing key artifact to be extra safe

* Last little bits
2023-09-26 11:17:17 +00:00
Félix Saparelli
49b37ff1e2
Revert "release: cargo-binstall v1.4.0" and fix (#1398)
* Revert "release: cargo-binstall v1.4.0 (#1397)"

This reverts commit 99e8256018.

* --allow-dirty on publish

* Remove private key file after generation

* Write public key file to bin crate and to package

* Upload public key file to release
2023-09-26 06:47:25 +00:00
Félix Saparelli
ee7fcb3210
Sign our releases (#1347)
* Sign our releases

* Use secrets instead of artifacts

* And the universal

* Apparently we can’t use secrets like that?

* Minor fixes to doc

* Private key requires untrusted comment

* Dogfood one deeper
2023-09-23 08:07:19 +00:00
Jiahao XU
efbd20857b
Fix detect-targets on ubuntu 20.04, glibc 2.31 (#1379)
* Fix `detect-targets` on ubuntu 20.04, glibc 2.31

Fixed #1375 and fixed #1378

glibc 2.31 does not support `--version`, so we need to detect and
fallback to passing an executable linked with that glibc to check if it
is indeed glibc.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix compilation faillure on ubuntu-20.04

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-22 23:55:12 +00:00
dependabot[bot]
b36674a1c4
build(deps): bump actions/checkout from 3 to 4 (#1348)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-07 01:25:18 +00:00
Jiahao XU
76a692224d
Fix detect-targets on Linux and add CI testing (#1344)
* Testing: Add `detect-targets/src/main.rs`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets` linux: `guess_host_triple` could return wrong libc info

so it has to check it manually instead of simply providing alternatives
like other OSes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `get_ld_flavor` for Alpine's gcompat glibc

Its output is different from regular glibc, so we need to hardcode that
particular cases.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix detection of alpine specific musl target

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add ci testing for Alpine

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add CI test for detect-targets on ubuntu

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor `get_ld_flavor`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix shellcheck

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more CI test for ubuntu

and fixed typo in it

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm distro specific target as it breaks `cargo-install` fallback

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Make sure all binaries are built in CI

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `package.metadata.binstall` for `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix justfile

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets-{alpine, ubuntu}-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `debug-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* `set -exuo pipefail` in `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Simplify `detect-targets-*-test`: Use `Swatinem/rust-cache@v2` directly

instead of using `just-setup`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm dup steps in `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `ls` to detect-targets-alpine-test for debugging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx `detect-targets-alpine-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `get_ld_flavor`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `linux::detect_targets` on ubuntu & glibc system

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx `linux::detect_targets` glibc checking

Check dynlib suffix

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-06 14:17:43 +00:00
dependabot[bot]
d657fbe518
build(deps): bump actions/checkout from 3 to 4 (#1346)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 02:10:48 +00:00
Jiahao XU
84004a71a9
ci: Speedup release.yml by removing job test (#1325)
Since the merge_queue requires every PR to be tested, there is no need
to run the test again in `release.yml`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 12:51:28 +00:00
Jiahao XU
0a71b39c90
ci: Fix release.yml being cancelled due to ci.yml (#1316)
Add a unique value to `concurrency.group` in `ci.yml` to prevent it from
being cancelled when releasing crates.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 00:03:15 +00:00
Jiahao XU
dc77a1ab93
Refactor: Extract new crate simple-git (#1304)
`binstalk-downloader` contains stuff about http(s) before the
git code is moved into it and now it becomes http and git.

While git indeed uses http stuff, which is why I decided to put
it into binstalk-downloader, it is more than just downloading
since it is stateful (can be cached locally and updated)
where as http is stateless.

Also `binstalk-downloader`'s codegen time now increases
dramatically and it also creates extra dependencies for
binstalk-fetchers, delaying its execution.

The git code also don't use anything from `binstalk-downloader`
at all, it makes sense to be an independent crate.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-19 01:08:55 +00:00
Jiahao XU
2215682e76
Update CI & dependabot: Add new crates (#1296)
and also add missing `crates/binstalk-bins/LICENSE`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-16 21:16:05 +00:00
Jiahao XU
ba87a4af70
Speedup ci.yml: Set codegen-units to 4 (#1283)
Set `CARGO_PROFILE_RELEASE_CODEGEN_UNITS` to 4
since 1024 units are too many and our CI only have 2-3 cores.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-11 03:46:27 +00:00
Jiahao XU
c4bb0fd77a
Include x86_64 & x86_64h in universal apple pre-built binary (#1279)
To makre sure it can run on pre-haswell Intel CPUs.

Fixed #1277

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-11 02:04:43 +00:00
Marcin Nowak-Liebiediew
42dddd972d
Add GitHub Action declaration for installing cargo-binstall (#1269)
add action.yml and test it
2023-08-09 20:50:16 +00:00
Jiahao XU
8e6dcc57ff
Fix release-pr.yml: Set RUSTFLAGS=--cfg reqwest_unstable (#1270)
for `binsalk-downloader` since its feature `http3` require this.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 20:14:34 +00:00
Jiahao XU
1c886d8897
Fix installation script on MacOS (#1263)
Fixed #1254

and also add CI for installation script and shellcheck.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 09:37:26 +00:00
Jiahao XU
9c521d162a
Enable unstable feature reqwest/http3 in CI (#1261)
For dev and release build, so that pre-built binaries of
`cargo-binstall` can utilize http3 protocol.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 07:44:10 +00:00
Jiahao XU
2fbcf188a7
Revert "Use rust-lld in CI" (#1257)
Revert "Use `rust-lld` in CI (#1253)"

This reverts commit 1e4e0d166d.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-08 10:45:40 +00:00
Jiahao XU
1e4e0d166d
Use rust-lld in CI (#1253)
Which guarantees:
 - faster linking on all targets when `cargo-zigbuild` is not used
 - allow cross-lang-lto to be enabled

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-08 00:53:36 +00:00
Jiahao XU
855ca88477
ci: Build MacOS universal exe from x86_64h-apple-darwin (#1238)
instead of `x86_64-apple-darwin` for better optimization since any
machine that support universal support x86_64h.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-02 03:37:21 +00:00
Jiahao XU
8756e39537
CI: Add release build for x86_64h-apple-darwin (#1234)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-02 02:22:16 +00:00
Jiahao XU
83fdd053bf
Fix release-pr.yml: Do not check-semver for cargo-binstall release (#1214)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-18 12:56:33 +00:00
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
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
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
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