[Do Not Merge] Experiment with Docker Caching #760
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- develop | |
- hotfix/** | |
- release/** | |
- test/** | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_BUILDKIT: 1 | |
GIT_COMMIT: ${{ github.sha }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up environment | |
run: ./scripts/bootstrap | |
- run: ./scripts/fetch-data | |
- uses: docker/build-push-action@v5 | |
with: | |
context: src/django | |
push: false | |
tags: iow:${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- run: | | |
docker compose up -d database django && | |
./scripts/manage migrate && | |
./scripts/manage collectstatic --no-input && | |
docker compose stop | |
- run: ./scripts/test | |
- run: ./scripts/cipublish | |
if: | | |
github.ref == 'refs/heads/develop' || | |
startsWith(github.ref, 'refs/heads/hotfix/') || | |
startsWith(github.ref, 'refs/heads/release/') || | |
startsWith(github.ref, 'refs/heads/test/') | |
- run: | | |
docker-compose -f docker-compose.ci.yml run --rm terraform -c " | |
# Unset this to avoid a ProfileNotFound exception from the AWS CLI. | |
unset AWS_PROFILE | |
./scripts/infra plan | |
./scripts/infra apply | |
" | |
env: | |
IOW_BOUNDARY_TOOL_ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }} | |
IOW_BOUNDARY_TOOL_DEPLOYMENT_ENVIRONMENT: staging | |
if: | | |
github.ref == 'refs/heads/develop' || | |
startsWith(github.ref, 'refs/heads/hotfix/') || | |
startsWith(github.ref, 'refs/heads/release/') || | |
startsWith(github.ref, 'refs/heads/test/') |