Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEVOPS-519] Add repository variables for toggling CI checks in Next.js CI workflow #145

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions .github/workflows/next-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -49,18 +80,23 @@ 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:
- name: Checkout
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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
114 changes: 0 additions & 114 deletions .github/workflows/ui-ci.yaml

This file was deleted.

Loading