-
Notifications
You must be signed in to change notification settings - Fork 53
79 lines (66 loc) · 2.07 KB
/
main.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Node.js CI
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout repository
- name: Checkout code
uses: actions/checkout@v4
# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
# Install dependencies
- name: Install dependencies
run: yarn install
# Create required directories
- name: Create directories
run: mkdir -p reports dist docs test-results
# Run Mocha tests
- name: Run tests with Mocha
run: |
export TS_NODE_COMPILER_OPTIONS="{\"module\":\"commonjs\"}"
yarn run test:coverage
# Upload test results to GitHub
- uses: dorny/test-reporter@v1
with:
name: Test Reporter
path: test-results.json
reporter: mocha-json
# Run ESLint
- name: Run ESLint
run: |
./node_modules/.bin/eslint ./src --format junit --output-file ./reports/eslint/eslint.xml
# Generate code coverage report and upload to Code Climate
- name: Upload Code Coverage Report
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: yarn run test:coverage
coverageLocations: |
${{github.workspace}}/coverage/lcov.info:lcov
debug: 'true'
# Format code with Prettier
- name: Format code with Prettier
run: yarn run prettier
# Build the project
- name: Build project
run: yarn run compile
- name: Commit and Push Dist Folder
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: '[skip ci] Add dist folder'
file_pattern: 'dist/*.* src/**/*.* test/**/*.* src/*.* test/*.*'
skip_dirty_check: false