Skip to content

Commit 02bb5e7

Browse files
committed
Import sync-team into team
2 parents 994fa88 + 7235276 commit 02bb5e7

26 files changed

+8250
-0
lines changed

sync-team/.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
merge_group:
5+
6+
jobs:
7+
test:
8+
name: Test
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: Swatinem/rust-cache@v2
14+
15+
- name: Build
16+
run: cargo build
17+
18+
- name: Run tests
19+
run: cargo test
20+
21+
- name: Run rustfmt
22+
run: cargo fmt -- --check
23+
24+
- name: Run clippy
25+
run: cargo clippy -- -Dwarnings
26+
deploy:
27+
name: Deploy
28+
needs: [ test ]
29+
environment: deploy
30+
permissions:
31+
id-token: write
32+
runs-on: ubuntu-latest
33+
if: github.event_name == 'merge_group'
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Build the Docker container
38+
run: docker build -t sync-team .
39+
40+
- name: Configure AWS credentials
41+
uses: aws-actions/configure-aws-credentials@v4
42+
with:
43+
role-to-assume: arn:aws:iam::890664054962:role/ci--rust-lang--sync-team
44+
aws-region: us-west-1
45+
46+
- name: Login to Amazon ECR Private
47+
id: login-ecr
48+
uses: aws-actions/amazon-ecr-login@v1
49+
50+
- name: Build, tag, and push docker image to Amazon ECR
51+
env:
52+
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
53+
REPOSITORY: sync-team
54+
run: |
55+
docker tag sync-team $REGISTRY/$REPOSITORY:latest
56+
docker push $REGISTRY/$REPOSITORY:latest
57+
58+
- name: Start the synchronization tool
59+
run: |
60+
aws --region us-west-1 lambda invoke --function-name start-sync-team output.json
61+
cat output.json | python3 -m json.tool
62+
63+
# Summary job for the merge queue.
64+
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
65+
conclusion:
66+
name: CI
67+
needs: [ test, deploy ]
68+
# We need to ensure this job does *not* get skipped if its dependencies fail,
69+
# because a skipped job is considered a success by GitHub. So we have to
70+
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
71+
# when the workflow is canceled manually.
72+
if: ${{ !cancelled() }}
73+
runs-on: ubuntu-latest
74+
steps:
75+
# Manually check the status of all dependencies. `if: failure()` does not work.
76+
- name: Conclusion
77+
run: |
78+
# Print the dependent jobs to see them in the CI log
79+
jq -C <<< '${{ toJson(needs) }}'
80+
# Check if all jobs that we depend on (in the needs array) were successful.
81+
jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Dry Run
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
schedule:
7+
# Run the dry run every 4 hours
8+
- cron: "0 */4 * * *"
9+
10+
jobs:
11+
dry-run:
12+
name: Run sync-team dry-run
13+
runs-on: ubuntu-24.04
14+
if: ${{ github.repository_owner == 'rust-lang' }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
# We don't need to do authenticated `git` operations, since we use the GitHub API.
19+
persist-credentials: false
20+
21+
- uses: Swatinem/rust-cache@v2
22+
23+
# GitHub tokens generated from GitHub Apps can access resources from one organization,
24+
# so we need to generate a token for each organization.
25+
- name: Generate GitHub token (rust-lang)
26+
uses: actions/create-github-app-token@v1
27+
id: rust-lang-token
28+
with:
29+
# GitHub App ID secret name
30+
app-id: ${{ secrets.GH_APP_ID }}
31+
# GitHub App private key secret name
32+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
33+
# Set the owner, so the token can be used in all repositories
34+
owner: rust-lang
35+
36+
- name: Generate GitHub token (rust-lang-ci)
37+
uses: actions/create-github-app-token@v1
38+
id: rust-lang-ci-token
39+
with:
40+
app-id: ${{ secrets.GH_APP_ID }}
41+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
42+
owner: rust-lang-ci
43+
44+
- name: Generate GitHub token (rust-lang-deprecated)
45+
uses: actions/create-github-app-token@v1
46+
id: rust-lang-deprecated-token
47+
with:
48+
app-id: ${{ secrets.GH_APP_ID }}
49+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
50+
owner: rust-lang-deprecated
51+
52+
- name: Generate GitHub token (rust-lang-nursery)
53+
uses: actions/create-github-app-token@v1
54+
id: rust-lang-nursery-token
55+
with:
56+
app-id: ${{ secrets.GH_APP_ID }}
57+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
58+
owner: rust-lang-nursery
59+
60+
- name: Generate GitHub token (bors-rs)
61+
uses: actions/create-github-app-token@v1
62+
id: bors-rs-token
63+
with:
64+
app-id: ${{ secrets.GH_APP_ID }}
65+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
66+
owner: bors-rs
67+
68+
- name: Generate GitHub token (rust-analyzer)
69+
uses: actions/create-github-app-token@v1
70+
id: rust-analyzer-token
71+
with:
72+
app-id: ${{ secrets.GH_APP_ID }}
73+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
74+
owner: rust-analyzer
75+
76+
- name: Generate GitHub token (rust-embedded)
77+
uses: actions/create-github-app-token@v1
78+
id: rust-embedded-token
79+
with:
80+
app-id: ${{ secrets.GH_APP_ID }}
81+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
82+
owner: rust-embedded
83+
84+
- name: Generate GitHub token (rust-dev-tools)
85+
uses: actions/create-github-app-token@v1
86+
id: rust-dev-tools-token
87+
with:
88+
app-id: ${{ secrets.GH_APP_ID }}
89+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
90+
owner: rust-dev-tools
91+
92+
- name: Dry run
93+
env:
94+
GITHUB_TOKEN_RUST_LANG: ${{ steps.rust-lang-token.outputs.token }}
95+
GITHUB_TOKEN_RUST_LANG_CI: ${{ steps.rust-lang-ci-token.outputs.token }}
96+
GITHUB_TOKEN_RUST_LANG_DEPRECATED: ${{ steps.rust-lang-deprecated-token.outputs.token }}
97+
GITHUB_TOKEN_RUST_LANG_NURSERY: ${{ steps.rust-lang-nursery-token.outputs.token }}
98+
GITHUB_TOKEN_BORS_RS: ${{ steps.bors-rs-token.outputs.token }}
99+
GITHUB_TOKEN_RUST_ANALYZER: ${{ steps.rust-analyzer-token.outputs.token }}
100+
GITHUB_TOKEN_RUST_EMBEDDED: ${{ steps.rust-embedded-token.outputs.token }}
101+
GITHUB_TOKEN_RUST_DEV_TOOLS: ${{ steps.rust-dev-tools-token.outputs.token }}
102+
run: cargo run -- print-plan --services github

sync-team/.github/workflows/run.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run
2+
on:
3+
workflow_dispatch: { }
4+
5+
jobs:
6+
run:
7+
name: Run the sync-team tool
8+
runs-on: ubuntu-latest
9+
permissions:
10+
id-token: write
11+
steps:
12+
- name: Configure AWS credentials
13+
uses: aws-actions/configure-aws-credentials@v4
14+
with:
15+
role-to-assume: arn:aws:iam::890664054962:role/ci--rust-lang--sync-team
16+
aws-region: us-west-1
17+
18+
- name: Start the synchronization tool
19+
run: |
20+
aws --region us-west-1 lambda invoke --function-name start-sync-team output.json
21+
cat output.json | python3 -m json.tool

sync-team/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)