Skip to content

Add triagebot benchmark #2145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions collector/compile-benchmarks/REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ SPDX-FileCopyrightText = [
]
SPDX-License-Identifier = "MIT OR Apache-2.0"

[[annotations]]
path = "triagebot/**"
SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)"
SPDX-License-Identifier = "MIT OR Apache-2.0"

[[annotations]]
path = "tt-muncher/**"
SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)"
Expand Down
1 change: 1 addition & 0 deletions collector/compile-benchmarks/triagebot/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
27 changes: 27 additions & 0 deletions collector/compile-benchmarks/triagebot/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# if `GITHUB_TOKEN` is not set here, the token can also be stored in `~/.gitconfig`
GITHUB_TOKEN=MUST_BE_CONFIGURED
DATABASE_URL=MUST_BE_CONFIGURED
GITHUB_WEBHOOK_SECRET=MUST_BE_CONFIGURED
# for logging, refer to this document: https://rust-lang-nursery.github.io/rust-cookbook/development_tools/debugging/config_log.html
# `RUSTC_LOG` is not required to run the application, but it makes local development easier
# RUST_LOG=MUST_BE_CONFIGURED

# If you are running a bot on non-rustbot account,
# this allows to configure that username which the bot will respond to.
# For example write blahblahblah here, if you want for this bot to
# respond to @blahblahblah claim.
# TRIAGEBOT_USERNAME=CAN_BE_CONFIGURED

# Set your own Zulip instance (local testing only)
# ZULIP_URL=https://testinstance.zulichat.com

# Used for authenticating a bot
# [email protected]
# ZULIP_API_TOKEN=yyy

# Authenticates inbound webhooks from Github
# ZULIP_WEBHOOK_SECRET=xxx

# Use another endpoint to retrieve teams of the Rust project (useful for local testing)
# default: https://team-api.infra.rust-lang.org/v1
# TEAMS_API_URL=http://localhost:8080
73 changes: 73 additions & 0 deletions collector/compile-benchmarks/triagebot/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI
on:
pull_request:
merge_group:

env:
AWS_ACCESS_KEY_ID: AKIA46X5W6CZEAQSMRH7

jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
TEST_DB_URL: postgres://postgres:postgres@localhost:5432/postgres
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --workspace --all-targets
- name: Check formatting
run: cargo fmt --all --check

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [ test ]
if: github.event_name == 'merge_group'
steps:
- name: Checkout the source code
uses: actions/checkout@v4

- name: Test and build
run: docker build -t triagebot .

- name: Deploy to production
uses: rust-lang/simpleinfra/github-actions/upload-docker-image@master
with:
image: triagebot
repository: rust-triagebot
region: us-west-1
redeploy_ecs_cluster: rust-ecs-prod
redeploy_ecs_service: triagebot
aws_access_key_id: "${{ env.AWS_ACCESS_KEY_ID }}"
aws_secret_access_key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"

# Summary job for the merge queue.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
ci:
needs: [ test, deploy ]
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'
3 changes: 3 additions & 0 deletions collector/compile-benchmarks/triagebot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
**/*.rs.bk
.env
12 changes: 12 additions & 0 deletions collector/compile-benchmarks/triagebot/0-println.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/main.rs b/src/main.rs
index 1b7dd24f..afc747c7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,6 +20,7 @@ use triagebot::jobs::{
use triagebot::{db, github, handlers::Context, notification_listing, payload, EventName};

async fn handle_agenda_request(req: String) -> anyhow::Result<String> {
+ println!("request");
if req == "/agenda/lang/triage" {
return triagebot::agenda::lang().call().await;
}
Loading
Loading