Remove strict date requirement for campaign #540
Workflow file for this run
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: Containers | |
on: [push] | |
env: | |
ARTIFACT_REGISTRY: ${{ secrets.GCP_ARTIFACT_REGISTRY }} | |
jobs: | |
build-test-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: google-github-actions/[email protected] | |
with: | |
service_account_key: ${{ secrets.GCP_ARTIFACT_REGISTRY_SA_KEY }} | |
- run: gcloud auth configure-docker "$(echo "$ARTIFACT_REGISTRY" | awk -F/ '{print $1}')" | |
- run: docker buildx install | |
- name: Build images | |
run: | | |
docker build . --target runtime \ | |
-t "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA" \ | |
--cache-from "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":latest \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 | |
docker build . --target testrunner \ | |
-t "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA"-testrunner \ | |
--cache-from "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":latest-testrunner \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 | |
- name: Run pytest | |
run: docker run "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA"-testrunner pytest | |
- name: Run mypy | |
run: docker run "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA"-testrunner mypy . | |
- name: Check formatting | |
run: docker run "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA"-testrunner ./scripts/format_check.sh | |
- name: Push images | |
run: | | |
docker push "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA" | |
docker push "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA"-testrunner | |
- name: Tag latest images | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
gcloud artifacts docker tags add "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA" \ | |
"$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":latest | |
gcloud artifacts docker tags add "$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":"$GITHUB_SHA"-testrunner \ | |
"$ARTIFACT_REGISTRY"/docker/"${GITHUB_REPOSITORY#*/}":latest-testrunner | |
jsonnet-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.17' | |
- name: Install jsonnet | |
run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest | |
- name: Set environment variables | |
run: | | |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "IMAGE_URI=$ARTIFACT_REGISTRY/docker/${GITHUB_REPOSITORY#*/}:latest" >> $GITHUB_ENV | |
- run: ./scripts/jsonnet.sh | |
env: | |
PROJECT_ID: ${{ secrets.GCP_DATA_WAREHOUSE_PROJECT_ID }} | |
BUCKET_NAME: ${{ secrets.DOMESTIC_HEATING_ABM_BUCKET_NAME }} | |
deploy: | |
needs: [jsonnet-check, build-test-push] | |
environment: compute | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.17' | |
- name: Install jsonnet | |
run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest | |
- uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.DOMESTIC_HEATING_ABM_SA_KEY }} | |
- uses: google-github-actions/get-gke-credentials@v2 | |
with: | |
cluster_name: cluster | |
location: europe-west2 | |
- name: Set environment variables | |
run: | | |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "IMAGE_URI=$ARTIFACT_REGISTRY/docker/${GITHUB_REPOSITORY#*/}:latest" >> $GITHUB_ENV | |
- name: Generate and apply configurations | |
run: | | |
./scripts/jsonnet.sh | kubectl apply -f - | |
env: | |
PROJECT_ID: ${{ secrets.GCP_DATA_WAREHOUSE_PROJECT_ID }} | |
BUCKET_NAME: ${{ secrets.DOMESTIC_HEATING_ABM_BUCKET_NAME }} |