Skip to content

CI

CI #52

Workflow file for this run

name: CI
on:
pull_request:
merge_group:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --check
- name: Build the tool
run: cargo build
- name: Try a dry run of the changes
run: cargo run -- upload --skip-upload
if: github.event_name == 'pull_request'
- name: Upload tool to artifacts
uses: actions/upload-artifact@v4
with:
name: tool
path: target/debug/ci-mirrors
if-no-files-found: error
- name: Upload TOML files to artifacts
uses: actions/upload-artifact@v4
with:
name: files-manifests
path: files/
if-no-files-found: error
apply:
name: Apply to production
runs-on: ubuntu-latest
needs: [ build ]
if: github.event_name == 'merge_group'
permissions:
id-token: write
environment:
name: upload
url: https://ci-mirrors.rust-lang.org
steps:
- name: Download the tool
uses: actions/download-artifact@v4
with:
name: tool
- name: Download TOML files
uses: actions/download-artifact@v4
with:
name: files-manifests
path: files/
- name: Authenticate with AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-1
role-to-assume: arn:aws:iam::890664054962:role/ci--rust-lang--ci-mirrors
- name: Mark the tool as executable
run: chmod +x ./ci-mirrors
- name: Run the tool
run: ./ci-mirrors upload
finished:
name: Build finished
runs-on: ubuntu-latest
needs: [ build, apply ]
if: "${{ !cancelled() }}"
env:
NEEDS: "${{ toJson(needs) }}"
steps:
- name: Check if all jobs were successful or skipped
run: echo "${NEEDS}" | jq --exit-status 'all(.result == "success" or .result == "skipped")'