mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-12 07:08:12 -05:00
- Add prettier job to GitHub Actions workflow to enforce code formatting - Add format:check script to package.json for checking formatting - Include failure message when prettier check fails in CI
72 lines
1.7 KiB
YAML
72 lines
1.7 KiB
YAML
name: Testing
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
|
|
jobs:
|
|
unit-test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [20.x]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
- name: Install dependencies
|
|
run: npm install
|
|
- name: Run Unit Tests
|
|
run: npm run test:unit
|
|
e2e-test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [20.x]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
- name: Install git
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y git
|
|
git --version
|
|
- name: Setup git
|
|
run: |
|
|
git config --global user.email "test@example.com"
|
|
git config --global user.name "Test User"
|
|
- name: Install dependencies
|
|
run: npm install
|
|
- name: Build
|
|
run: npm run build
|
|
- name: Run E2E Tests
|
|
run: npm run test:e2e
|
|
prettier:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.x'
|
|
cache: 'npm'
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Run Prettier
|
|
run: npm run format:check
|
|
- name: Prettier Output
|
|
if: failure()
|
|
run: |
|
|
echo "Prettier check failed. Please run 'npm run format' to fix formatting issues."
|
|
exit 1
|