Skip to content

Commit eea2da3

Browse files
Feature/pr (#23)
* fix(git-action): modified and added actions * fix(git-action): updated main workflow * fix(action): Update pull_request.yml
1 parent a8cc7ca commit eea2da3

File tree

3 files changed

+129
-10
lines changed

3 files changed

+129
-10
lines changed

.github/workflows/beta.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ on:
44
push:
55
branches:
66
- beta
7-
pull_request:
8-
types:
9-
- opened
10-
- reopened
11-
- edited
12-
- synchronize
13-
branches:
14-
- beta
157

168
concurrency:
179
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/main.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ jobs:
4141
- name: Lint
4242
run: npm run lint
4343

44-
- name: Test
45-
run: npm run test
44+
- name: Vitest - Test & Coverage
45+
run: npm run coverage
46+
47+
- name: Archive vitest code coverage results
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: vitest-code-coverage-report
51+
path: ./coverage/
4652

4753
sonarcloud:
4854
name: SonarCloud
@@ -57,6 +63,13 @@ jobs:
5763
- uses: actions/checkout@v4
5864
with:
5965
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
66+
- name: Download vitest code coverage results
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: vitest-code-coverage-report
70+
path: ./coverage/
71+
- name: check
72+
run: cd coverage && find .
6073
- name: SonarCloud Scan
6174
uses: SonarSource/sonarcloud-github-action@master
6275
env:

.github/workflows/pull_request.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: PullRequest
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
branches:
11+
- beta
12+
- main
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
install:
20+
if: "!contains(github.event.head_commit.message, 'skip ci')"
21+
name: Install
22+
runs-on: ${{ matrix.os }}
23+
24+
strategy:
25+
matrix:
26+
os: [ubuntu-latest]
27+
node: [20]
28+
29+
steps:
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: ${{ matrix.node }}
33+
- name: Checkout Repo
34+
uses: actions/checkout@v4
35+
- name: cache node_modules
36+
uses: actions/cache@v4
37+
id: cache
38+
with:
39+
path: |
40+
node_modules
41+
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}
42+
43+
- name: Install Dependencies
44+
if: steps.cache.outputs.cache-hit != 'true'
45+
run: npm ci
46+
47+
- name: Lint
48+
run: npm run lint
49+
50+
- name: Vitest - Test & Coverage
51+
run: npm run coverage
52+
53+
- name: Archive vitest code coverage results
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: vitest-code-coverage-report
57+
path: ./coverage/
58+
59+
sonarcloud:
60+
name: SonarCloud
61+
needs: install
62+
runs-on: ${{ matrix.os }}
63+
64+
strategy:
65+
matrix:
66+
os: [ubuntu-latest]
67+
node: [20]
68+
69+
steps:
70+
- uses: actions/checkout@v4
71+
with:
72+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
73+
- name: Download vitest code coverage results
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: vitest-code-coverage-report
77+
path: ./coverage/
78+
- name: check
79+
run: cd coverage && find .
80+
- name: SonarCloud Scan
81+
uses: SonarSource/sonarcloud-github-action@master
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
84+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
85+
86+
semantic-version:
87+
name: Semantic Release
88+
needs: sonarcloud
89+
runs-on: ${{ matrix.os }}
90+
91+
strategy:
92+
matrix:
93+
os: [ubuntu-latest]
94+
node: [20]
95+
96+
steps:
97+
- uses: actions/setup-node@v4
98+
with:
99+
node-version: ${{ matrix.node }}
100+
- name: Checkout Repo
101+
uses: actions/checkout@v4
102+
- name: cache node_modules
103+
uses: actions/cache@v4
104+
id: cache
105+
with:
106+
path: node_modules
107+
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}
108+
- name: Versioning
109+
env:
110+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
113+
run: |
114+
npm run release

0 commit comments

Comments
 (0)