Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(app): add workflows for js-app
teo648bd707b160
diff --git a/.github/actions/setup-reqs-web/action.yml b/.github/actions/setup-reqs-web/action.ymlnew file mode 100644index 0000000000..542621b97b--- /dev/null+++ b/.github/actions/setup-reqs-web/action.yml@@ -0,0 +1,44 @@+name: Setup Prereqs Web+description: Checkout and Setup Prerequisite Dependencies for web app+inputs:+ playwright:+ description: Install Playwright and cache+ required: false+ default: ''++runs:+ using: composite+ steps:+ - name: Setup Bun+ uses: oven-sh/setup-bun@v2++ - name: Install Dependencies+ shell: bash+ working-directory: js/app+ run: |+ bun install --frozen-lockfile+ bun add -g npm++ - name: Get week number (for caching Playwright)+ if: inputs.playwright == 'true'+ shell: bash+ run: echo "CACHE_WEEK=$(date +%Y-%V)" >> $GITHUB_ENV+ - name: Restore Playwright browsers+ if: inputs.playwright == 'true'+ id: pw-browsers+ uses: runs-on/cache/restore@v4+ with:+ path: js/app/node_modules/playwright-core/.local-browsers+ key: pw-browsers-${{ env.CACHE_WEEK }}+ restore-keys: pw-browsers-+ - name: Install Playwright Browsers+ if: inputs.playwright == 'force' || (inputs.playwright == 'true' && steps.pw-browsers.outputs.cache-hit != 'true')+ shell: bash+ working-directory: js/app+ run: PLAYWRIGHT_BROWSERS_PATH=0 bunx playwright install chromium+ - name: Save Playwright browsers to cache+ if: inputs.playwright == 'force' || (inputs.playwright == 'true' && steps.pw-browsers.outputs.cache-hit != 'true')+ uses: runs-on/cache/save@v4+ with:+ path: js/app/node_modules/playwright-core/.local-browsers+ key: pw-browsers-${{ hashFiles('js/app/bun.lock')}}diff --git a/.github/workflows/deploy-web-app-dev-push.yml b/.github/workflows/deploy-web-app-dev-push.ymlnew file mode 100644index 0000000000..52b3501c47--- /dev/null+++ b/.github/workflows/deploy-web-app-dev-push.yml@@ -0,0 +1,46 @@+name: "Deploy web app dev on push to main"+on:+ push:+ branches: [main]++concurrency:+ group: ${{ github.workflow }}+ # We do not want to cancel a deployment if it's in progress. That could lead to a broken deployment.+ cancel-in-progress: false++jobs:+ check-to-deploy:+ runs-on: ubuntu-latest+ outputs:+ web-app: ${{ steps.changes.outputs.web-app }}+ web-services: ${{ steps.changes.outputs.web-services }}+ steps:+ - uses: actions/checkout@v4+ - uses: whutchinson98/[email protected]+ id: changes+ with:+ token: ${{ GITHUB.TOKEN }}+ diff: |+ web-app: ./infra/stacks/web-app/* ./js/app/packages/* ./js/app/package.json+ web-services: ./infra/stacks/web-services/*+ deploy_web_app:+ needs: [check-to-deploy]+ if: ${{ needs.check-to-deploy.outputs.web-app == 'true' }}+ uses: ./.github/workflows/deploy-web-app.yml+ with:+ notify: false+ environment: dev+ secrets: inherit++ deploy_web_services:+ needs: [check-to-deploy]+ if: ${{ needs.check-to-deploy.outputs.web-services == 'true' }}+ uses: ./.github/workflows/deploy-web-services.yml+ with:+ notify: false+ environment: dev+ secrets:+ AWS_DEPLOYMENT_ACCESS_KEY: ${{ secrets.AWS_DEPLOYMENT_ACCESS_KEY }}+ AWS_DEPLOYMENT_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEPLOYMENT_SECRET_ACCESS_KEY }}+ NOTIFICATION_WEBHOOK: ${{ secrets.NOTIFICATION_WEBHOOK }}+ PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}diff --git a/.github/workflows/deploy-web-app.yml b/.github/workflows/deploy-web-app.ymlnew file mode 100644index 0000000000..eab799754b--- /dev/null+++ b/.github/workflows/deploy-web-app.yml@@ -0,0 +1,92 @@+name: Deploy Web App+on:+ workflow_dispatch:+ inputs:+ environment:+ required: true+ type: choice+ options:+ - dev+ - prod+ description: The environment to build for+ notify:+ required: false+ type: boolean+ description: Whether to notify the Slack channel of the deployment completion+ workflow_call:+ inputs:+ environment:+ required: true+ type: string+ description: The environment to build for. e.g. (dev, prod)+ notify:+ required: false+ type: boolean+ secrets:+ AWS_DEPLOYMENT_ACCESS_KEY:+ required: true+ AWS_DEPLOYMENT_SECRET_ACCESS_KEY:+ required: true+ NOTIFICATION_WEBHOOK:+ required: true+ PULUMI_ACCESS_TOKEN:+ required: true++concurrency:+ group: ${{ github.workflow }}-web-app-${{ inputs.environment }}+ # We do not want to cancel a deployment if it's in progress. That could lead to a broken deployment.+ cancel-in-progress: false++env:+ WEB_APP_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}++jobs:+ build-deploy:+ runs-on: linux-latest-beefy+ env:+ CI: "true"+ steps:+ - uses: actions/checkout@v5+ with:+ ref: ${{ github.ref_name }}+ - name: Setup+ uses: ./.github/actions/setup-reqs-web+ - name: Build+ working-directory: js/app+ run: bun run build:${{ inputs.environment }}+ env:+ VITE_DD_WEB_APP_ID: ${{ secrets.DD_WEB_APP_ID }}+ VITE_DD_WEB_APP_TOKEN: ${{ secrets.DD_WEB_APP_TOKEN }}+ VITE_DD_HASH: ${{ github.sha }}+ - name: Configure AWS Credentials+ uses: aws-actions/configure-aws-credentials@v5+ with:+ aws-access-key-id: ${{ secrets.AWS_DEPLOYMENT_ACCESS_KEY }}+ aws-secret-access-key: ${{ secrets.AWS_DEPLOYMENT_SECRET_ACCESS_KEY }}+ aws-region: us-east-1+ - uses: pulumi/actions@v6+ with:+ command: up+ stack-name: macro-inc/${{ inputs.environment }}+ work-dir: ./infra/stacks/web-app+ env:+ PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ DD_APP_KEY: ${{ secrets.DD_APP_KEY }}+ DD_API_KEY: ${{ secrets.DD_API_KEY }}+ DD_HOST: https://api.us5.datadoghq.com/++ - name: Upload sourcemaps to Datadog+ env:+ DATADOG_API_KEY: ${{ secrets.DD_API_KEY }}+ DATADOG_SITE: us5.datadoghq.com+ DATADOG_API_HOST: api.us5.datadoghq.com+ working-directory: js/app/packages/app+ run: bun run ddupload:${{ inputs.environment }}++ - name: Upload production build+ if: ${{ inputs.environment == 'prod' }}+ uses: actions/upload-artifact@v4+ with:+ name: web-app-build+ path: js/app/packages/app/dist+ overwrite: truediff --git a/.github/workflows/deploy-web-services.yml b/.github/workflows/deploy-web-services.ymlnew file mode 100644index 0000000000..f252db9978--- /dev/null+++ b/.github/workflows/deploy-web-services.yml@@ -0,0 +1,75 @@+name: Deploy Web Services+on:+ workflow_dispatch:+ inputs:+ environment:+ required: true+ type: choice+ options:+ - dev+ - prod+ description: The environment to build for+ notify:+ required: false+ type: boolean+ description: Whether to notify the Slack channel of the deployment completion+ workflow_call:+ inputs:+ environment:+ required: true+ type: string+ description: The environment to build for. (dev, prod)+ notify:+ required: false+ type: boolean+ secrets:+ AWS_DEPLOYMENT_ACCESS_KEY:+ required: true+ AWS_DEPLOYMENT_SECRET_ACCESS_KEY:+ required: true+ NOTIFICATION_WEBHOOK:+ required: true+ PULUMI_ACCESS_TOKEN:+ required: true++concurrency:+ group: ${{ github.workflow }}-web-services-${{ inputs.environment }}+ # We do not want to cancel a deployment if it's in progress. That could lead to a broken deployment.+ cancel-in-progress: false++jobs:+ deploy:+ runs-on: [runs-on,runner=8cpu-linux-x64,hdd=40,spot=lowest-price,ssh=false,"run-id=${{github.run_id}}"]+ env:+ CI: "true"+ steps:+ - uses: actions/checkout@v4+ - uses: docker/setup-qemu-action@v3+ - uses: docker/setup-buildx-action@v3+ - uses: aws-actions/configure-aws-credentials@v4+ with:+ aws-access-key-id: ${{ secrets.AWS_DEPLOYMENT_ACCESS_KEY }}+ aws-secret-access-key: ${{ secrets.AWS_DEPLOYMENT_SECRET_ACCESS_KEY }}+ aws-region: us-east-1+ - name: Setup+ uses: ./.github/actions/setup-reqs-web+ - uses: pulumi/actions@v3+ with:+ command: up+ stack-name: macro-inc/${{ inputs.environment }}+ work-dir: ./infra/stacks/web-services+ env:+ PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}++ notify:+ name: Slack Notification+ if: ${{ inputs.notify }}+ needs: deploy+ runs-on: ubuntu-latest+ steps:+ - name: Slack Notification Web+ uses: rtCamp/[email protected]+ env:+ SLACK_WEBHOOK: ${{ secrets.NOTIFICATION_WEBHOOK }}+ SLACK_MESSAGE:+ 'Web services ${{ inputs.environment }} deployed :rocket:'diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.ymlnew file mode 100644index 0000000000..8946661078--- /dev/null+++ b/.github/workflows/web-app-check-main.yml@@ -0,0 +1,100 @@+name: 'Web App Pr Check on Main'+on:+ pull_request:+ branches:+ - main+ paths:+ - './js/app/package.json'+ - './js/app/bun.lock'+ - './js/app/bunfig.toml'+ - './js/app/packages/**'+ - '.github/actions/setup-prereqs/**'+ - '.github/workflows/check.yml'++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}-check+ cancel-in-progress: true++jobs:+ typescript:+ name: Typecheck+ runs-on: linux-latest-beefy+ steps:+ - name: Checkout Repo+ uses: actions/checkout@v4+ - name: Setup Prereqs+ uses: ./.github/actions/setup-reqs-web+ - name: Generate API Types+ working-directory: js/app+ run: bun run gen-api+ - name: Check Types+ working-directory: js/app+ run: |+ bun run --bun --silent tsc --project ./packages/app/tsconfig.json++ biome-check:+ name: Biome Check+ runs-on: linux-latest-middy+ steps:+ - name: Checkout Repo+ uses: actions/checkout@v4+ - name: Setup Biome+ uses: biomejs/setup-biome@v2+ with:+ version: 2.2.6+ - name: Run Biome+ working-directory: js/app+ run: biome ci .++ tailwind:+ name: Theme Hygiene Inspector+ runs-on: linux-latest-middy+ steps:+ - name: Checkout Repo+ uses: actions/checkout@v4+ with:+ fetch-depth: 0+ - name: Setup Prereqs+ uses: ./.github/actions/setup-reqs-web+ - name: Check Tailwind Classes+ working-directory: js/app+ run: bun run check-tailwind++ test:+ name: Test+ runs-on: linux-latest-middy+ steps:+ - name: Checkout Repo+ uses: actions/checkout@v4+ - name: Setup+ uses: ./.github/actions/setup-reqs-web+ - name: Test+ working-directory: js/app+ run: bun run test++ cycles:+ name: Cycles Import Check+ runs-on: linux-latest-middy+ steps:+ - name: Checkout+ uses: actions/checkout@v4+ - name: Setup Biome+ uses: biomejs/setup-biome@v2+ with:+ version: latest+ - name: Cycles Import Check+ working-directory: js/app+ run: biome lint --changed --no-errors-on-unmatched --only=nursery/noImportCycles++ build:+ name: Build+ runs-on: linux-latest-middy+ steps:+ - name: Checkout Repo+ uses: actions/checkout@v4+ - name: Setup+ uses: ./.github/actions/setup-reqs-web+ - name: Build+ working-directory: js/app+ run: bun run build+