Skip to content

Commit 9a887ea

Browse files
Build + Push cov-diff curing CI runs
CI currently spends 30s building this every run
1 parent 02f4237 commit 9a887ea

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

.github/workflows/integration.yaml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,63 @@ name: Integration Test
22

33
on:
44
pull_request:
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
env:
11+
AWS_DEFAULT_REGION: us-east-1
512

613
jobs:
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+
if: github.event_name != 'pull_request'
27+
uses: aws-actions/configure-aws-credentials@v4
28+
with:
29+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
30+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
32+
33+
- name: Login to Amazon ECR
34+
if: github.event_name != 'pull_request'
35+
id: login-ecr
36+
uses: aws-actions/amazon-ecr-login@v2
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Determine ECR image tags
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

Comments
 (0)