Switch to merge queues #3996
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
merge_group: | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
if: github.repository == 'rust-lang/team' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 | |
- name: Install Rust Stable | |
run: | | |
rustc -vV | |
rustup update stable | |
rustup default stable | |
rustc -vV | |
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 | |
- name: Build the validation tool | |
run: cargo build | |
- name: Validate the repository contents | |
run: cargo run -- check --strict | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
- name: Run rustfmt | |
run: cargo fmt -- --check | |
- name: Run tests | |
run: cargo test --workspace --all-features | |
- name: Check CODEOWNERS | |
run: cargo run ci check-codeowners | |
- name: Build the contents of the static API | |
run: | | |
cargo run -- static-api build | |
echo "team-api.infra.rust-lang.org" > build/CNAME | |
- name: Write PR number into the uploaded archive | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo "${{ github.event.pull_request.number }}" > build/pr.txt | |
- name: Upload the built JSON as a GitHub artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: team-api-output | |
path: build | |
deploy: | |
name: Deploy | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
environment: deploy | |
concurrency: deploy | |
permissions: | |
id-token: write | |
pages: write | |
if: github.event_name == 'merge_group' | |
steps: | |
- name: Download built JSON API and sync-team | |
uses: actions/download-artifact@v4 | |
with: | |
name: team-api-output | |
path: build | |
- name: Disable Jekyll | |
run: touch build/.nojekyll | |
- name: Upload GitHub pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::890664054962:role/ci--rust-lang--team | |
aws-region: us-west-1 | |
- name: Start the synchronization tool | |
run: | | |
# Introduce some artificial delay to help github pages propagate. | |
sleep 60 | |
aws --region us-west-1 lambda invoke --function-name start-sync-team output.json | |
cat output.json | python3 -m json.tool | |
- uses: actions/checkout@v4 | |
- name: Run sync-team dry-run | |
run: | | |
cargo run --manifest-path sync-team/Cargo.toml \ | |
print-plan \ | |
--team-json build | |
# 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) }}' |