This repository has been archived by the owner on Oct 22, 2023. It is now read-only.
Update gcloud to v451.0.1 #6275
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: Pipeline | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: "Build, Test and Deploy" | |
runs-on: ubuntu-latest | |
env: | |
TERM: xterm-256color | |
BATECT_CACHE_TYPE: directory | |
BATECT_ENABLE_TELEMETRY: true | |
DOCKER_BUILDKIT: 1 | |
concurrency: | |
# Don't try to run multiple builds for the same branch in parallel. | |
# This prevents race conditions between deployments from the main branch - the first commit will always be built and deployed first. | |
group: build-${{ github.repository }}-${{ github.ref }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Validate Batect wrapper scripts | |
uses: batect/[email protected] | |
- name: Cache Batect | |
uses: actions/[email protected] | |
with: | |
path: ~/.batect/cache | |
key: batect-${{ hashFiles('batect') }} | |
- name: Cache Golang dependencies | |
uses: actions/[email protected] | |
with: | |
path: .batect/caches/go-cache | |
key: golang-${{ hashFiles('go.sum') }} | |
restore-keys: | | |
golang- | |
- name: Download dependencies | |
run: ./batect setup | |
- name: Build application | |
run: ./batect build | |
- name: Run unit tests | |
run: ./batect unitTest | |
- name: Run integration tests | |
run: ./batect integrationTest | |
- name: Lint code | |
run: ./batect lint | |
- name: Check code files have license header | |
run: ./batect checkLicenseHeader | |
- name: Lint Terraform files | |
run: ./batect --config-vars-file=batect.prod.yml lintTerraform | |
- name: Log in to GCP | |
run: ./batect --config-vars-file=batect.prod.yml setupGCPServiceAccount | |
if: github.repository == 'batect/abacus' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
env: | |
GCP_SERVICE_ACCOUNT_EMAIL: [email protected] | |
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: Push image | |
run: ./batect --config-vars-file=batect.prod.yml pushImage | |
if: github.repository == 'batect/abacus' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
- name: Setup Cloudflare key | |
run: ./batect --config-vars-file=batect.prod.yml setupCloudflareKey | |
if: github.repository == 'batect/abacus' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
env: | |
CLOUDFLARE_KEY: ${{ secrets.CLOUDFLARE_KEY }} | |
- name: Setup Terraform | |
run: ./batect --config-vars-file=batect.prod.yml setupTerraform | |
if: github.repository == 'batect/abacus' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
- name: Apply Terraform | |
run: ./batect --config-vars-file=batect.prod.yml applyTerraform | |
if: github.repository == 'batect/abacus' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
- name: Run smoke test | |
run: ./batect --config-vars-file=batect.prod.yml smokeTest | |
if: github.repository == 'batect/abacus' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
- name: Cleanup credentials | |
run: sudo rm -rf .creds .gcloud | |