文件最后提交记录最后更新时间
9 天前
11 天前
1 年前
3 个月前
3 个月前
1 年前
README

rustc-perf Site

This is the website for Rust compiler performance monitoring. The website contains a backend to process the raw data and expose it to the frontend, which displays graphs to the user.

This also contains a GitHub bot to trigger on-demand benchmarking.

Setup

You can build the website in multiple ways:

  • Download a precompiled nightly build.

  • Use the provided Docker image:

    $ git clone https://github.com/rust-lang/rustc-perf.git
    $ docker build -t rustc-perf .
    
  • Build it yourself:

    $ git clone https://github.com/rust-lang/rustc-perf.git
    
    # Build frontend
    $ cd site/frontend
    $ npm install
    $ npm run build
    
    # Build website binary
    $ cd ../..
    $ cargo clean
    $ cargo build --bin site --release
    

    A clean build with cargo clean is needed only if you compiled the site previously, as static files are embedded into the binary in release mode.

    The --release flag is on purpose, reducing startup time 15x from roughly 15 seconds to 1; this is on the production database and smaller data sets are likely to load considerably faster.

For more information about working with the frontend, see this README.

Launching

If you've collected data locally, you will likely want to point the site at a local database. By default, a database called results.db located at the root of the project will be used. You can optionally pass a path to a database if you don't want to use the default.

The site launches on port 2346 by default, which can be overridden by setting the PORT environment variable.

$ ./target/release/site <database>

Development

We use insta for snapshot testing. If any tests that use the insta macros fail, you should cargo install cargo-insta and then run cargo insta review to review the snapshot changes.

Multi-platform webhook configuration

The site supports repository routing via repos and can accept webhook traffic from multiple git platforms through the same endpoint.

Required secrets

  • GITHUB_WEBHOOK_SECRET: validates GitHub signature header X-Hub-Signature-256
  • GITCODE_WEBHOOK_SECRET: validates GitCode signature header X-GitCode-Signature-256
  • GITHUB_API_TOKEN: API token for GitHub requests
  • GITCODE_API_TOKEN: reserved for GitCode API calls

Repo key format

The internal key format is <platform>/<owner>/<repo>, for example:

  • github/rust-lang/rust
  • gitcode/acme/rust

Example site-config.toml

[keys.github]
token = "${GITHUB_API_TOKEN}"
secret = "${GITHUB_WEBHOOK_SECRET}"

[keys.gitcode]
token = "${GITCODE_API_TOKEN}"
secret = "${GITCODE_WEBHOOK_SECRET}"

[repos."github/rust-lang/rust"]
platform = "github"
default_branch = "master"
api_base = "https://api.github.com/repos/rust-lang/rust"
web_base = "https://github.com/rust-lang/rust"

[repos."gitcode/acme/rust"]
platform = "gitcode"
default_branch = "master"
api_base = "https://gitcode.com/api/v5/repos/acme/rust"
web_base = "https://gitcode.com/acme/rust"

GitCode webhook events Note Hook and Push Hook are translated into the internal request shape used by existing command handling.