-
Notifications
You must be signed in to change notification settings - Fork 17
50 lines (41 loc) · 1.53 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: CI
on: [push, pull_request]
jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Run rustfmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -Dwarnings
- name: Run tests
run: cargo test
- name: Build the Docker container
run: docker build -t sync-team .
- name: Configure AWS credentials
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::890664054962:role/ci--rust-lang--sync-team
aws-region: us-west-1
- name: Login to Amazon ECR Private
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push docker image to Amazon ECR
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: sync-team
run: |
docker tag sync-team $REGISTRY/$REPOSITORY:latest
docker push $REGISTRY/$REPOSITORY:latest
- name: Start the synchronization tool
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
aws --region us-west-1 lambda invoke --function-name start-sync-team output.json
cat output.json | python3 -m json.tool