Add some more test cases; notes, support reviewing different explanat… #44
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: 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 |