CI #5606
Workflow file for this run
This file contains hidden or 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: | |
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) }}' |