Skip to content

added vscode to a fair few places to fix potential bug #1909

added vscode to a fair few places to fix potential bug

added vscode to a fair few places to fix potential bug #1909

name: Run tests and push Docker image on success
"on":
push:
branches: [main]
pull_request:
release:
types: [published]
jobs:
test-and-push:
runs-on: [self-hosted, management-ecr]
env:
LOGS_BUCKET_NAME: moj-analytics-s3-logs
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Context for Buildx
id: buildx-context
run: docker context use builders || docker context create builders
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
endpoint: builders
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: eu-west-1
role-to-assume: arn:aws:iam::593291632749:role/github-actions-management-ecr
role-duration-seconds: 1200
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registries: 593291632749
- name: Prep Tags
id: prep
run: |
TAG=noop
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
TAG=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$TAG" ]; then
TAG=edge
fi
elif [[ $GITHUB_REF == refs/pull/* ]]; then
TAG=pr-${{ github.event.number }}
elif [ "${{ github.event_name }}" = "push" ]; then
TAG="sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=tag::${TAG}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Build image
run: make build
env:
NETWORK: host
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ steps.prep.outputs.tag }}
- name: Run Python tests (docker-compose)
run: make clean && make test
env:
NETWORK: default
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ steps.prep.outputs.tag }}
- name: Push image
run: make push
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ steps.prep.outputs.tag }}