-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (51 loc) · 1.57 KB
/
build.yaml
File metadata and controls
63 lines (51 loc) · 1.57 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Build, test and deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for OIDC login
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
- name: Run pre-commit
run: uv run pre-commit run --all
- name: Run tests
run: uv run pytest
- name: Check docker image builds ok
run: docker build -t explain .
docker:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [test]
permissions:
id-token: write # Needed for OIDC login
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::052730242331:role/github-actions/explain-ci
aws-region: us-east-1
- name: Login to Amazon ECR
if: github.ref == 'refs/heads/main'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build docker image
run: docker build -t explain .
- name: Push docker image to Amazon ECR Public
if: github.ref == 'refs/heads/main'
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: explain
IMAGE_TAG: gh-${{ github.run_number }}
run: |
docker tag explain $REGISTRY/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG