Merge pull request #3779 from cardstack/smart-compress #2146
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 [main] | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
id-token: write | |
jobs: | |
update-cache: | |
name: Update node_modules cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
lint: | |
name: Lint All | |
needs: update-cache | |
runs-on: ubuntu-latest | |
env: | |
# we are running into heap out of memory issues with the linting--so | |
# increasing the heap size to 8GB | |
NODE_OPTIONS: --max-old-space-size=8192 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
- run: yarn lint | |
test_node_packages: | |
needs: lint | |
runs-on: ubuntu-latest | |
env: | |
CARDBOT_TOKEN: ${{ secrets.CARDBOT_TOKEN }} | |
CORDE_BOT_TOKEN: ${{ secrets.CORDE_BOT_TOKEN }} | |
services: | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
-v /var/run/postgresql/:/var/run/postgresql | |
steps: | |
- name: Create database | |
run: sudo -u postgres createdb hub_test | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
- run: yarn db:test-init | |
working-directory: packages/hub | |
- run: yarn run npm-run-all --aggregate-output --continue-on-error --parallel test:did-resolver test:hub | |
test_ember_apps: | |
name: Ember apps Build/Lint/Test | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
- name: Run boxel tests | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_BOXEL }} | |
run: yarn test:boxel:percy | |
- name: Run ember-helper tests | |
run: yarn test:ember-shared | |
# using yarn to install @percy/cli suddenly started causing V8 out of | |
# memory errors. According to https://stackoverflow.com/a/56568741 likely | |
# there is a dependency cycle that yarn can't see through. However, npm | |
# has the ability to collapse these cycles. So we are using npm to install | |
# percy | |
- run: npm install -g @percy/cli | |
- name: Run web client tests | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_WEB_CLIENT }} | |
run: yarn test:web-client:percy | |
- name: Run ssr-web tests | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_SSR_WEB }} | |
run: yarn test:ssr-web:percy | |
- name: Run safe-tools-client tests | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_SAFE_TOOLS_CLIENT }} | |
run: yarn test:safe-tools-client:percy | |
- name: Publish web-client test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: "web-client test results" | |
files: ci-xml-test-results/web-client.xml | |
- name: Publish ssr-web test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: "ssr-web test results" | |
files: ci-xml-test-results/ssr-web.xml | |
change_check: | |
name: Check which packages changed | |
needs: [test_node_packages, test_ember_apps] | |
runs-on: ubuntu-latest | |
outputs: | |
hub: ${{ steps.filter.outputs.hub }} | |
web_client: ${{ steps.filter.outputs.web_client }} | |
boxel: ${{ steps.filter.outputs.boxel }} | |
ember-shared: ${{ steps.filter.outputs.ember-shared }} | |
ssr_web: ${{ steps.filter.outputs.ssr_web }} | |
safe-tools-client: ${{ steps.filter.outputs.safe-tools-client }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
hub: | |
- 'packages/hub/**' | |
- 'packages/did-resolver/**' | |
- 'packages/discord-bot/**' | |
- 'packages/cardpay-sdk/**' | |
- 'packages/did-resolver/**' | |
- '.github/workflows/push-main.yml' | |
- '.github/actions/deploy-hub/**' | |
- 'yarn.lock' | |
web_client: | |
- 'packages/web-client/**' | |
- 'packages/boxel/**' | |
- 'packages/ember-shared/**' | |
- 'packages/cardpay-sdk/**' | |
- 'packages/did-resolver/**' | |
- '.github/workflows/push-main.yml' | |
- '.github/actions/deploy-web-client/**' | |
- 'yarn.lock' | |
boxel: | |
- 'packages/boxel/**' | |
- '.github/workflows/push-main.yml' | |
- 'yarn.lock' | |
ssr_web: | |
- 'packages/ssr-web/**' | |
- 'packages/boxel/**' | |
- 'packages/cardpay-sdk/**' | |
- 'packages/did-resolver/**' | |
- '.github/workflows/push-main.yml' | |
- '.github/workflows/manual-ssr-web.yml' | |
- 'yarn.lock' | |
safe-tools-client: | |
- 'packages/safe-tools-client/**' | |
- 'packages/boxel/**' | |
- 'packages/ember-shared/**' | |
- '.github/workflows/push-main.yml' | |
- '.github/actions/deploy-safe-tools-client/**' | |
- 'yarn.lock' | |
deploy-hub: | |
name: Deploy hub to staging | |
needs: change_check | |
if: ${{ needs.change_check.outputs.hub == 'true' }} | |
uses: ./.github/workflows/manual-hub.yml | |
secrets: inherit | |
with: | |
environment: "staging" | |
deploy-web-client-staging: | |
name: Deploy web-client to S3 staging bucket | |
needs: change_check | |
if: ${{ needs.change_check.outputs.web_client == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2.0.0 | |
with: | |
role-to-assume: arn:aws:iam::680542703984:role/web-client | |
aws-region: us-east-1 | |
- name: Deploy web-client | |
uses: ./.github/actions/deploy-web-client | |
env: | |
HUB_URL: https://hub-staging.stack.cards | |
SENTRY_AUTH_TOKEN: ${{ secrets.WEB_CLIENT_SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.WEB_CLIENT_SENTRY_DSN }} | |
with: | |
environment: staging | |
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
deploy-ssr-web: | |
name: Deploy ssr-web | |
needs: change_check | |
if: ${{ needs.change_check.outputs.ssr_web == 'true' }} | |
uses: ./.github/workflows/manual-ssr-web.yml | |
secrets: inherit | |
with: | |
environment: "staging" | |
deploy-boxel: | |
name: Deploy boxel to S3 bucket | |
needs: change_check | |
if: ${{ needs.change_check.outputs.boxel == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2.0.0 | |
with: | |
role-to-assume: arn:aws:iam::680542703984:role/boxel | |
aws-region: us-east-1 | |
- name: Deploy preview | |
run: yarn deploy:boxel | |
env: | |
S3_PREVIEW_INDEX_BUCKET_NAME: boxel-preview.cardstack.com | |
S3_PREVIEW_ASSET_BUCKET_NAME: boxel-preview-assets.cardstack.com | |
S3_PREVIEW_ASSET_BUCKET_ENDPOINT: https://s3.us-east-1.amazonaws.com/boxel-preview-assets.cardstack.com | |
S3_PREVIEW_REGION: us-east-1 | |
- name: Send notification to Discord | |
if: ${{ always() }} | |
uses: ./.github/actions/discord-notification-deploy | |
with: | |
app: boxel | |
status: ${{ job.status }} | |
environment: staging | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
deploy-safe-tools-client: | |
needs: change_check | |
if: ${{ needs.change_check.outputs.safe-tools-client == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/init | |
- name: Deploy safe-tools-client | |
uses: ./.github/actions/deploy-safe-tools-client | |
with: | |
environment: staging | |
discord_webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
env: | |
SENTRY_DSN: ${{ secrets.SAFE_TOOLS_CLIENT_SENTRY_DSN }} | |
HUB_URL: https://hub-staging.stack.cards |