diff --git a/.github/workflows/next-ci.yaml b/.github/workflows/next-ci.yaml index 1b5e7da7..b405a988 100644 --- a/.github/workflows/next-ci.yaml +++ b/.github/workflows/next-ci.yaml @@ -6,6 +6,30 @@ on: environment: required: true type: string + YARN_INSTALL: + required: false + type: string + default: ${{ vars.APPLICATION_CI_YARN_INSTALL || 'false' }} + RUN_PLAYWRIGHT_TESTS: + required: false + type: string + default: ${{ vars.APPLICATION_CI_RUN_PLAYWRIGHT_TESTS || 'true' }} + LINT_SCSS: + required: false + type: string + default: ${{ vars.APPLICATION_CI_LINT_SCSS || 'true' }} + LINT_JS: + required: false + type: string + default: ${{ vars.APPLICATION_CI_LINT_JS || 'true' }} + CHECK_SIZE_LIMIT: + required: false + type: string + default: ${{ vars.APPLICATION_CI_CHECK_SIZE_LIMIT || 'true' }} + RUN_JEST_TESTS: + required: false + type: string + default: ${{ vars.APPLICATION_CI_RUN_JEST_TESTS || 'true' }} secrets: AZURE_CREDENTIALS: required: true @@ -25,12 +49,19 @@ jobs: fetch-depth: 0 - name: Use cache-next-install action + if: ${{ inputs.YARN_INSTALL == 'false' }} uses: Andrews-McMeel-Universal/cache-next-install@v1 + - name: Use cache-yarn-install action + if: ${{ inputs.YARN_INSTALL == 'true' }} + uses: Andrews-McMeel-Universal/cache-yarn-install@v1 + - name: Lint javascript + if: ${{ inputs.LINT_JS == 'true' }} run: yarn lint:js - name: Lint scss + if: ${{ inputs.LINT_SCSS == 'true' }} run: yarn lint:styles - name: Push Linting Fixes @@ -49,9 +80,9 @@ jobs: - name: Use cache-next-build action uses: Andrews-McMeel-Universal/cache-next-build@v1 - # Required status check unit-tests: name: Unit Tests + if: ${{ inputs.RUN_JEST_TESTS == 'true' }} needs: [build] runs-on: ubuntu-latest steps: @@ -59,8 +90,13 @@ jobs: uses: actions/checkout@v4 - name: Use cache-next-install action + if: ${{ inputs.YARN_INSTALL == 'false' }} uses: Andrews-McMeel-Universal/cache-next-install@v1 + - name: Use cache-yarn-install action + if: ${{ inputs.YARN_INSTALL == 'true' }} + uses: Andrews-McMeel-Universal/cache-yarn-install@v1 + - name: Use .env cache action uses: Andrews-McMeel-Universal/get-envs@v1 with: @@ -71,10 +107,12 @@ jobs: uses: Andrews-McMeel-Universal/cache-next-build@v1 - name: Run Jest tests + if: ${{ inputs.RUN_JEST_TESTS == 'true' }} run: yarn test:unit:ci integration-tests: name: Integration Tests + if: ${{ inputs.RUN_PLAYWRIGHT_TESTS == 'true' || inputs.CHECK_SIZE_LIMIT == 'true' }} needs: [build] runs-on: ubuntu-latest timeout-minutes: 25 @@ -83,9 +121,15 @@ jobs: uses: actions/checkout@v4 - name: Use cache-next-install action + if: ${{ inputs.YARN_INSTALL == 'false' }} uses: Andrews-McMeel-Universal/cache-next-install@v1 + - name: Use cache-yarn-install action + if: ${{ inputs.YARN_INSTALL == 'true' }} + uses: Andrews-McMeel-Universal/cache-yarn-install@v1 + - name: Install Playwright Browsers + if: ${{ inputs.RUN_PLAYWRIGHT_TESTS == 'true' }} run: yarn playwright install - name: Use .env cache action @@ -98,16 +142,18 @@ jobs: uses: Andrews-McMeel-Universal/cache-next-build@v1 - name: Run Playwright tests + if: ${{ inputs.RUN_PLAYWRIGHT_TESTS == 'true' }} run: yarn test:integration:ci - uses: actions/upload-artifact@v4 - if: always() + if: inputs.RUN_PLAYWRIGHT_TESTS == 'true' && always() with: name: playwright-report path: playwright-report/ retention-days: 30 - uses: andresz1/size-limit-action@v1 + if: ${{ inputs.CHECK_SIZE_LIMIT == 'true' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} # The size-limit-action tries to run a diff --git a/.github/workflows/ui-ci.yaml b/.github/workflows/ui-ci.yaml deleted file mode 100644 index 7dc03b75..00000000 --- a/.github/workflows/ui-ci.yaml +++ /dev/null @@ -1,114 +0,0 @@ -name: Next.js Application CI - -on: - workflow_call: - inputs: - environment: - required: true - type: string - secrets: - AZURE_CREDENTIALS: - required: true - PAT_ACTION_CI: - required: true - -jobs: - build: - name: Build App - if: ${{ github.actor != 'dependabot[bot]' }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - token: ${{ secrets.PAT_ACTION_CI }} - fetch-depth: 0 - - - name: Use cache-yarn-install action - uses: Andrews-McMeel-Universal/cache-yarn-install@v1 - - - name: Lint javascript - run: yarn lint:js - - - name: Lint scss - run: yarn lint:styles - - - name: Push Linting Fixes - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_user_name: amutechtest - commit_user_email: amu_deploy@amuniversal.com - commit_message: "[Formatter] Apply prettier changes" - - - name: Use .env cache action - uses: Andrews-McMeel-Universal/get-envs@v1 - with: - azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} - environment: ${{ inputs.environment }} - - - name: Use cache-next-build action - uses: Andrews-McMeel-Universal/cache-next-build@v1 - - unit-tests: - name: Unit Tests - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Use cache-yarn-install action - uses: Andrews-McMeel-Universal/cache-yarn-install@v1 - - - name: Use .env cache action - uses: Andrews-McMeel-Universal/get-envs@v1 - with: - azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} - environment: ${{ inputs.environment }} - - - name: Use cache-next-build action - uses: Andrews-McMeel-Universal/cache-next-build@v1 - - - name: Run Jest tests - run: yarn test:unit:ci - - integration-tests: - name: Integration Tests - needs: [build] - runs-on: ubuntu-latest - timeout-minutes: 25 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Use cache-yarn-install action - uses: Andrews-McMeel-Universal/cache-yarn-install@v1 - - - name: Use .env cache action - uses: Andrews-McMeel-Universal/get-envs@v1 - with: - azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} - environment: ${{ inputs.environment }} - - - name: Use cache-next-build action - uses: Andrews-McMeel-Universal/cache-next-build@v1 - - - name: Install Playwright Browsers - run: yarn playwright install - - - name: Run Playwright tests - run: yarn test:integration:ci - - - uses: actions/upload-artifact@v4 - if: always() - with: - name: playwright-report - path: playwright-report/ - retention-days: 30 - - - uses: andresz1/size-limit-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - # The size-limit-action tries to run a - # redundant yarn build - skip_step: build