generated from Jagoda11/react-template
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (54 loc) Β· 1.91 KB
/
πci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI
on: [push, pull_request]
jobs:
build:
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@v4
with:
node-version: ${{ matrix.node-version }}
- name: π Clear Cache
run: npm run clean
- name: π Ensure package-lock.json is up-to-date
run: npm install --package-lock-only --ignore-scripts --legacy-peer-deps
- name: π¦ Install dependencies
run: npm ci --legacy-peer-deps
- name: πΆ Set up Husky
run: npx husky install
- name: ποΈ Format code
run: npm run format
- name: π§Ή Lint code
run: npm run lint
- name: π Generate test files
run: npm run generate-tests
- name: ποΈ Format generated test files
run: npm run format
- name: π¨ Build
run: npm run build
- name: π§ͺ Test with coverage
run: npm run test
- name: π€ Commit and push generated test files
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if ls src/**/*.test.tsx 1> /dev/null 2>&1; then
git add -A src/**/*.test.tsx # Include untracked files
git commit -m 'π€ Generated unit tests'
git push || echo "No changes to push."
else
echo "No test files to commit. Skipping this step."
fi
shell: /usr/bin/bash -e {0}
# Deploy build to GitHub Pages
- name: π Deploy dist to GitHub Pages
if: ${{ github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_branch: gh-pages