@@ -2,15 +2,63 @@ name: Integration Test
22
33on :
44 pull_request :
5+ push :
6+ branches :
7+ - main
8+ workflow_dispatch :
9+
10+ env :
11+ AWS_DEFAULT_REGION : us-east-1
512
613jobs :
714 build :
815 runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ id-token : write
19+
920 steps :
10- - uses : actions/checkout@v3
21+ - uses : actions/checkout@v4
1122 with :
1223 fetch-depth : 0
1324
25+ - name : Configure AWS credentials
26+ uses : aws-actions/configure-aws-credentials@v4
27+ with :
28+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
29+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30+ aws-region : ${{ env.AWS_DEFAULT_REGION }}
31+
32+ - name : Login to Amazon ECR
33+ if : github.event_name != 'pull_request'
34+ id : login-ecr
35+ uses : aws-actions/amazon-ecr-login@v2
36+
37+ - name : Set up Docker Buildx
38+ uses : docker/setup-buildx-action@v3
39+
40+ - name : Determine ECR image tags
41+ if : github.event_name != 'pull_request'
42+ id : meta
43+ uses : docker/metadata-action@v5
44+ with :
45+ images : ${{ steps.login-ecr.outputs.registry }}/cov-diff-action
46+ tags : |
47+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
48+ type=sha
49+ type=semver,pattern=v{{version}},event=tag
50+
51+ - name : Build and Push Docker image to ECR
52+ id : build_and_push
53+ uses : docker/build-push-action@v6
54+ with :
55+ context : .
56+ file : ./Dockerfile
57+ push : ${{ github.event_name != 'pull_request' }}
58+ tags : ${{ steps.meta.outputs.tags }}
59+ cache-from : type=gha,scope=${{ github.workflow }}
60+ cache-to : type=gha,mode=max,scope=${{ github.workflow }}
61+
1462 - name : run tests
1563 run : |
1664 go test ./... -coverprofile=coverage.out
0 commit comments