Skip to content

Commit a5cb681

Browse files
authored
ci: updated github actions ci workflow (#6314)
1 parent 511d9df commit a5cb681

File tree

2 files changed

+62
-66
lines changed

2 files changed

+62
-66
lines changed

.github/workflows/ci.yml

+32-34
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
paths-ignore:
1515
- '*.md'
1616

17+
permissions:
18+
contents: read
19+
1720
# Cancel in progress workflows
1821
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
1922
concurrency:
@@ -26,13 +29,13 @@ jobs:
2629
runs-on: ubuntu-latest
2730
steps:
2831
- uses: actions/checkout@v4
29-
- name: Setup Node.js {{ matrix.node-version }}
32+
- name: Setup Node.js
3033
uses: actions/setup-node@v4
3134
with:
3235
node-version: 'lts/*'
3336

3437
- name: Install dependencies
35-
run: npm install --ignore-scripts --only=dev
38+
run: npm install --ignore-scripts --inlcude=dev
3639

3740
- name: Run lint
3841
run: npm run lint
@@ -73,44 +76,39 @@ jobs:
7376
7477
- name: Run tests
7578
shell: bash
76-
run: |
77-
npm run test-ci
78-
cp coverage/lcov.info "coverage/${{ matrix.node-version }}.lcov"
79-
80-
- name: Collect code coverage
81-
run: |
82-
mv ./coverage "./${{ matrix.node-version }}"
83-
mkdir ./coverage
84-
mv "./${{ matrix.node-version }}" "./coverage/${{ matrix.node-version }}"
79+
run: npm run test-ci
8580

8681
- name: Upload code coverage
87-
uses: actions/upload-artifact@v3
82+
uses: actions/upload-artifact@v4
8883
with:
89-
name: coverage
90-
path: ./coverage
84+
name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
85+
path: ./coverage/lcov.info
9186
retention-days: 1
9287

9388
coverage:
9489
needs: test
9590
runs-on: ubuntu-latest
91+
permissions:
92+
contents: read
93+
checks: write
9694
steps:
97-
- uses: actions/checkout@v4
98-
99-
- name: Install lcov
100-
shell: bash
101-
run: sudo apt-get -y install lcov
102-
103-
- name: Collect coverage reports
104-
uses: actions/download-artifact@v3
105-
with:
106-
name: coverage
107-
path: ./coverage
108-
109-
- name: Merge coverage reports
110-
shell: bash
111-
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
112-
113-
- name: Upload coverage report
114-
uses: coverallsapp/github-action@master
115-
with:
116-
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
- uses: actions/checkout@v4
96+
97+
- name: Install lcov
98+
shell: bash
99+
run: sudo apt-get -y install lcov
100+
101+
- name: Collect coverage reports
102+
uses: actions/download-artifact@v4
103+
with:
104+
path: ./coverage
105+
pattern: coverage-node-*
106+
107+
- name: Merge coverage reports
108+
shell: bash
109+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
110+
111+
- name: Upload coverage report
112+
uses: coverallsapp/github-action@v2
113+
with:
114+
file: ./lcov.info

.github/workflows/legacy.yml

+30-32
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
paths-ignore:
1515
- '*.md'
1616

17+
permissions:
18+
contents: read
19+
1720
# Cancel in progress workflows
1821
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
1922
concurrency:
@@ -57,44 +60,39 @@ jobs:
5760
5861
- name: Run tests
5962
shell: bash
60-
run: |
61-
npm run test-ci
62-
cp coverage/lcov.info "coverage/${{ matrix.node-version }}.lcov"
63-
64-
- name: Collect code coverage
65-
run: |
66-
mv ./coverage "./${{ matrix.node-version }}"
67-
mkdir ./coverage
68-
mv "./${{ matrix.node-version }}" "./coverage/${{ matrix.node-version }}"
63+
run: npm run test-ci
6964

7065
- name: Upload code coverage
71-
uses: actions/upload-artifact@v3
66+
uses: actions/upload-artifact@v4
7267
with:
73-
name: coverage
74-
path: ./coverage
68+
name: coverage-node-${{ matrix.node-version }}-${{ matrix.os }}
69+
path: ./coverage/lcov.info
7570
retention-days: 1
7671

7772
coverage:
7873
needs: test
7974
runs-on: ubuntu-latest
75+
permissions:
76+
contents: read
77+
checks: write
8078
steps:
81-
- uses: actions/checkout@v4
82-
83-
- name: Install lcov
84-
shell: bash
85-
run: sudo apt-get -y install lcov
86-
87-
- name: Collect coverage reports
88-
uses: actions/download-artifact@v3
89-
with:
90-
name: coverage
91-
path: ./coverage
92-
93-
- name: Merge coverage reports
94-
shell: bash
95-
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
96-
97-
- name: Upload coverage report
98-
uses: coverallsapp/github-action@master
99-
with:
100-
github-token: ${{ secrets.GITHUB_TOKEN }}
79+
- uses: actions/checkout@v4
80+
81+
- name: Install lcov
82+
shell: bash
83+
run: sudo apt-get -y install lcov
84+
85+
- name: Collect coverage reports
86+
uses: actions/download-artifact@v4
87+
with:
88+
path: ./coverage
89+
pattern: coverage-node-*
90+
91+
- name: Merge coverage reports
92+
shell: bash
93+
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./lcov.info
94+
95+
- name: Upload coverage report
96+
uses: coverallsapp/github-action@v2
97+
with:
98+
file: ./lcov.info

0 commit comments

Comments
 (0)