Skip to content

Commit

Permalink
Update build test to produce different checks for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Jan 31, 2025
1 parent b4e04c2 commit 7eb00d2
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 7 deletions.
96 changes: 89 additions & 7 deletions .github/workflows/content-sources-actions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-unit-tests
name: build-tests
on:
pull_request:
branches: [main, prod-beta, prod-stable]
Expand All @@ -11,8 +11,9 @@ concurrency:
cancel-in-progress: true

jobs:
build:
lint:
runs-on: ubuntu-latest
name: lint
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -36,14 +37,95 @@ jobs:
- name: Install Dependencies
run: yarn install

- name: Tests
run: yarn test

- name: Lint
run: yarn lint

- name: Build
run: yarn build --if-present
format:
runs-on: ubuntu-latest
name: format
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Cache - node_modules
if: always()
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-build-test-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-test-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Install Dependencies
run: yarn install

- name: Format code with prettier
run: yarn format:check

build-check:
runs-on: ubuntu-latest
name: build-check
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Cache - node_modules
if: always()
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-build-test-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-test-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Install Dependencies
run: yarn install

- name: Build the application
run: yarn build

unit-test:
name: unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Cache - node_modules
if: always()
uses: actions/cache@v4
with:
path: |
node_modules
dist
key: ${{ runner.os }}-build-test-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-test-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"

- name: Install Dependencies
run: yarn install

- name: Tests
run: yarn test

- name: Convert JUnit report to CTRF format
run: npx junit-to-ctrf test-results/jest-junit.xml -o test-results/ctrf-report.json
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}' --no-error-on-unmatched-pattern",
"lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx}' --no-error-on-unmatched-pattern",
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,css,md}' --config ./.prettierrc",
"format:check": "prettier --check 'src/**/*.{js,jsx,ts,tsx,css,md}' --config ./.prettierrc",
"patch:hosts": "fec patch-etc-hosts",
"start": "fec dev",
"start:stage": "fec dev --clouddotEnv=stage",
Expand Down

0 comments on commit 7eb00d2

Please sign in to comment.