Skip to content

Make redis connection more robust #137

Make redis connection more robust

Make redis connection more robust #137

Workflow file for this run

name: PR CI Pipeline
on:
pull_request:
branches: [main]
paths:
- "packages/**"
- "e2e/**"
- "package.json"
- "package-lock.json"
- "docker/**"
- "playwright.config.ts"
- ".github/workflows/**"
- "ci/**"
jobs:
infra-check:
uses: ./.github/workflows/infra-check.yml
with:
environment: sandbox
pr_number: ${{ github.event.pull_request.number }}
secrets: inherit
lint:
uses: ./.github/workflows/lint.yml
api-tests:
uses: ./.github/workflows/api-tests.yml
with:
environment: sandbox
generate-tag:
name: Generate Tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install root dependencies
run: npm ci
- name: Generate image tag
id: tag
run: |
TAG=$(npm run ci:calver --silent | tail -n 1)
echo "tag=$TAG" >> $GITHUB_OUTPUT
build-and-publish:
name: Build & Publish ${{ matrix.component }}
runs-on: ubuntu-latest
needs: [generate-tag]
environment: shared
permissions:
id-token: write
contents: read
strategy:
matrix:
component: [api, web, e2e]
include:
- component: api
workspace: "@chips/api"
ecr_repo_var: ECR_API_REPO
needs_workspace_build: true
- component: web
workspace: "@chips/web"
ecr_repo_var: ECR_WEB_REPO
needs_workspace_build: true
- component: e2e
ecr_repo_var: ECR_E2E_REPO
needs_workspace_build: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install root dependencies
run: npm ci
- name: Build ${{ matrix.component }}
if: matrix.needs_workspace_build
run: npm run build --workspace=${{ matrix.workspace }}
env:
VITE_API_URL: ${{ vars.VITE_API_URL }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Build ${{ matrix.component }} image
run: npm run ci:manage-image-lifecycle --silent -- build sandbox ${{ matrix.component }} ${{ needs.generate-tag.outputs.tag }}
env:
AWS_ACCOUNT_ID: ${{ vars.AWS_ACCOUNT_ID }}
AWS_REGION: ${{ vars.AWS_REGION }}
ECR_API_REPO: ${{ vars.ECR_API_REPO }}
ECR_WEB_REPO: ${{ vars.ECR_WEB_REPO }}
ECR_E2E_REPO: ${{ vars.ECR_E2E_REPO }}
VITE_API_URL: ${{ vars.VITE_API_URL }}
- name: Publish ${{ matrix.component }} image
run: npm run ci:manage-image-lifecycle --silent -- publish sandbox ${{ matrix.component }} ${{ needs.generate-tag.outputs.tag }}
env:
AWS_ACCOUNT_ID: ${{ vars.AWS_ACCOUNT_ID }}
AWS_REGION: ${{ vars.AWS_REGION }}
ECR_API_REPO: ${{ vars.ECR_API_REPO }}
ECR_WEB_REPO: ${{ vars.ECR_WEB_REPO }}
ECR_E2E_REPO: ${{ vars.ECR_E2E_REPO }}
deploy-refresh-stack:
name: Deploy/Refresh Stack
needs: [build-and-publish, generate-tag]
uses: ./.github/workflows/manage-stack.yml
with:
operation: up
version: ${{ needs.generate-tag.outputs.tag }}
pr_number: ${{ github.event.pull_request.number }}
branch_name: ${{ github.head_ref }}
secrets: inherit
permissions:
contents: read
pull-requests: write