Skip to content

Commit ccd33d6

Browse files
authored
Merge pull request #16 from avixiii-dev/feat/real-user-monitoring
Feat/real user monitoring
2 parents de11187 + 579570e commit ccd33d6

File tree

13 files changed

+798
-355
lines changed

13 files changed

+798
-355
lines changed

.github/workflows/ci.yml

+73-53
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
name: CI/CD
1+
name: CI/CD Pipeline
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ master, develop ]
6+
tags: ['v*']
67
pull_request:
7-
branches: [ master ]
8+
branches: [ master, develop ]
89
release:
910
types: [created]
1011

12+
permissions:
13+
contents: write
14+
packages: write
15+
1116
jobs:
1217
test:
1318
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
packages: write
1422
strategy:
1523
matrix:
1624
node-version: [16.x, 18.x, 20.x]
@@ -23,78 +31,90 @@ jobs:
2331
with:
2432
node-version: ${{ matrix.node-version }}
2533
cache: 'npm'
26-
27-
- name: Clean install dependencies
28-
run: |
29-
rm -f package-lock.json
30-
npm install
31-
32-
- name: Run linter
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Run linting
3339
run: npm run lint
34-
35-
- name: Run tests
36-
run: npm test
37-
38-
- name: Build
39-
run: npm run build
40+
41+
- name: Run tests with coverage
42+
run: npm run test:coverage
43+
44+
- name: Upload coverage to Codecov
45+
uses: codecov/codecov-action@v3
46+
with:
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
files: ./coverage/lcov.info
49+
flags: unittests
50+
name: codecov-umbrella
51+
fail_ci_if_error: false
52+
verbose: true
4053

41-
test-integration:
54+
build:
4255
needs: test
4356
runs-on: ubuntu-latest
44-
strategy:
45-
matrix:
46-
test-project: [webpack-test, rollup-test, vite-test]
47-
57+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v'))
58+
4859
steps:
4960
- uses: actions/checkout@v3
5061

51-
- name: Use Node.js 18
62+
- name: Use Node.js
5263
uses: actions/setup-node@v3
5364
with:
54-
node-version: '18'
65+
node-version: '18.x'
5566
cache: 'npm'
56-
57-
- name: Install package dependencies
58-
run: |
59-
rm -f package-lock.json
60-
npm install
61-
67+
68+
- name: Install dependencies
69+
run: npm ci
70+
6271
- name: Build package
6372
run: npm run build
64-
65-
- name: Install test project dependencies
66-
working-directory: test-projects/${{ matrix.test-project }}
67-
run: |
68-
rm -f package-lock.json
69-
npm install
70-
71-
- name: Build test project
72-
working-directory: test-projects/${{ matrix.test-project }}
73-
run: npm run build
73+
74+
- name: Upload build artifacts
75+
uses: actions/upload-artifact@v3
76+
with:
77+
name: dist
78+
path: dist/
79+
retention-days: 5
7480

7581
publish:
76-
needs: [test, test-integration]
82+
needs: [test, build]
7783
runs-on: ubuntu-latest
78-
if: github.event_name == 'release' && github.event.action == 'created'
79-
84+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
85+
permissions:
86+
contents: write
87+
packages: write
88+
8089
steps:
8190
- uses: actions/checkout@v3
8291

83-
- name: Use Node.js 18
92+
- name: Use Node.js
8493
uses: actions/setup-node@v3
8594
with:
86-
node-version: '18'
95+
node-version: '18.x'
8796
registry-url: 'https://registry.npmjs.org'
88-
97+
98+
- name: Download build artifacts
99+
uses: actions/download-artifact@v3
100+
with:
101+
name: dist
102+
path: dist/
103+
89104
- name: Install dependencies
90-
run: |
91-
rm -f package-lock.json
92-
npm install
93-
94-
- name: Build
95-
run: npm run build
96-
97-
- name: Publish to npm
105+
run: npm ci
106+
107+
- name: Publish to NPM
98108
run: npm publish --access public
99109
env:
100110
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
111+
112+
- name: Create GitHub Release
113+
uses: softprops/action-gh-release@v1
114+
with:
115+
files: |
116+
dist/*
117+
README.md
118+
LICENSE
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)