build(deps): Bump cloud.google.com/go/storage from 1.40.0 to 1.42.0 #160
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 Cd Staging Environment | |
on: | |
pull_request: | |
branches: main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
environment: | |
name: staging | |
# because we cannot use env directly when using docker run | |
env: | |
GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT: ${{secrets.GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT}} | |
GOOGLE_CLOUD_STORAGE_BUCKET: ${{secrets.GOOGLE_CLOUD_STORAGE_BUCKET}} | |
SERVER_URL: ${{secrets.SERVER_URL}} | |
GOOGLE_CLOUD_STORAGE_EMULATOR_ENDPOINT: ${{secrets.GOOGLE_CLOUD_STORAGE_EMULATOR_ENDPOINT}} | |
GOOGLE_OAUTH2_REFRESH_TOKEN_TEST: ${{secrets.GOOGLE_OAUTH2_REFRESH_TOKEN_TEST}} | |
GOOGLE_OAUTH2_CLIENT_ID_TEST: ${{secrets.GOOGLE_OAUTH2_CLIENT_ID_TEST}} | |
GOOGLE_OAUTH2_CLIENT_SECRET_TEST: ${{secrets.GOOGLE_OAUTH2_CLIENT_SECRET_TEST}} | |
PORT: ${{secrets.PORT}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jbergstroem/hadolint-gh-action@v1 | |
with: | |
dockerfile: build/package/**Containerfile | |
# Setup new docker builder for cache | |
- uses: docker/setup-buildx-action@v3 | |
- name: Run Firebase Emulator | |
run: docker compose -f deployments/compose.yaml up -d | |
- name: Build Image Test | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
file: build/package/test.Containerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{github.event.repository.name}} | |
- name: Unit testing | |
run: | | |
docker run --rm \ | |
--name ${{github.event.repository.owner.login}} \ | |
--network tempsy_net \ | |
-e GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT -e GOOGLE_CLOUD_STORAGE_BUCKET \ | |
-e SERVER_URL -e GOOGLE_CLOUD_STORAGE_EMULATOR_ENDPOINT \ | |
-e GOOGLE_OAUTH2_REFRESH_TOKEN_TEST -e PORT \ | |
-e GOOGLE_OAUTH2_CLIENT_ID_TEST -e GOOGLE_OAUTH2_CLIENT_SECRET_TEST \ | |
${{github.event.repository.name}} \ | |
go test --cover -v \ | |
-ldflags "-w -s" ./... | |
- name: Clean up Services | |
if: always() | |
continue-on-error: true | |
run: docker compose -f deployments/compose.yaml down -v --rmi all | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
environment: | |
name: staging | |
url: ${{vars.STAGING_URL}} | |
permissions: | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ghcr.io/${{github.repository}} | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup new docker builder and qemu for multi arch build | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{github.repository_owner}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: build/package/Containerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{env.IMAGE_NAME}}:beta-${{github.sha}} | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- uses: azure/container-apps-deploy-action@v2 | |
with: | |
registryUrl: ${{env.REGISTRY}} | |
containerAppName: ${{github.event.repository.name}}-staging | |
resourceGroup: ${{secrets.AZURE_RESOURCE_GROUP}} | |
imageToDeploy: ${{env.IMAGE_NAME}}:beta-${{github.sha}} | |
targetPort: ${{secrets.PORT}} | |
- name: Job Successful Feedback | |
if: ${{ success() }} | |
run: | | |
cat >> $GITHUB_STEP_SUMMARY <<MD | |
# Successful CI & CD staging environment | |
**This test include:** | |
- [x] Tidy | |
- [x] Formatting | |
- [x] Unit Test | |
**App Published to:** ${{vars.STAGING_URL}} | |
MD |