Update team dependency #6316
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: { } | |
| # We only run this on push to the default branch to prime CI cache | |
| push: | |
| branches: | |
| - master | |
| 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@v6 | |
| - 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 | |
| concurrency: | |
| # Ensure that we do not deploy things in the merge group concurrently | |
| group: ${{ github.event_name == 'merge_group' && 'deploy' || github.sha }} | |
| cancel-in-progress: false | |
| needs: [ test ] | |
| # We want to build the Docker image on the default branch to prime CI cache | |
| if: ${{ github.event_name == 'merge_group' || github.event_name == 'push' }} | |
| steps: | |
| - name: Checkout the source code | |
| uses: actions/checkout@v6 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Build the Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| tags: triagebot | |
| load: true | |
| - name: Deploy to production | |
| if: github.event_name == 'merge_group' | |
| 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) }}' |