Enterprise-CMCS/macpro-appian-connector

View on GitHub
.github/workflows/workspace-setup.yml

Summary

Maintainability
Test Coverage
name: Workspace Setup

on:
  workflow_dispatch:
  schedule:
    - cron: "0 10 * * SUN"

concurrency:
  group: ${{ github.ref_name }}-test-ws-setup

jobs:
  test:
    runs-on: macos-12
    timeout-minutes: 30 # MacOS runners are more expensive than linux, so we want to be sure to stop any stuck builds.
    environment:
      name: test-ws-setup
    env:
      STAGE_NAME: test-ws-setup
    permissions:
      id-token: write
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }}
          aws-region: us-east-1
          role-duration-seconds: 10800

      - name: Run workspace setup
        run: |
          sh docs/assets/setup.sh

      - name: Run nvm install
        run: |
          source /tmp/.profile
          nvm install

      - name: Test docs
        run: |
          source /tmp/.profile
          nvm use
          colima start
          docker pull busybox
          colima stop

      - name: Test install
        run: |
          source /tmp/.profile
          nvm use
          direnv allow
          direnv exec run install

      - name: Test deploy
        run: |
          source /tmp/.profile
          nvm use
          direnv allow
          direnv exec run deploy --stage $STAGE_NAME

      - name: Test test
        run: |
          source /tmp/.profile
          nvm use
          direnv allow
          direnv exec run test --stage $STAGE_NAME

      - name: Test destroy
        run: |
          source /tmp/.profile
          nvm use
          direnv allow
          direnv exec run destroy --stage $STAGE_NAME --verify false --wait false

      - name: Slack Notification
        uses: rtCamp/action-slack-notify@v2
        if: env.SLACK_WEBHOOK != '' && failure()
        env:
          SLACK_COLOR: ${{job.status}}
          SLACK_ICON: https://github.com/Enterprise-CMCS.png?size=48
          SLACK_TITLE: Failure
          SLACK_USERNAME: ${{ github.repository }} - ${{job.status}}
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}