Skip to content

Commit 478f5b9

Browse files
authored
Merge pull request #3794 from project-koku/consolidate-workflows
Consolidate CI workflows
2 parents 1214359 + 6265f35 commit 478f5b9

File tree

2 files changed

+69
-63
lines changed

2 files changed

+69
-63
lines changed

.github/workflows/ci.yml

+69-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code Coverage
1+
name: CI
22

33
on:
44
pull_request:
@@ -8,22 +8,21 @@ on:
88

99
env:
1010
BRANCH: ${{ github.base_ref }}
11+
NODEJS_VERSION: '18'
1112

1213
jobs:
13-
build:
14-
name: koku-ui codecov
14+
units:
15+
name: Units
1516
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
node-version: [18]
17+
1918
steps:
2019
- name: Checkout code
2120
uses: actions/checkout@v4
2221

23-
- name: Setup Node.js ${{ matrix.node-version }}
22+
- name: Setup Node.js
2423
uses: actions/setup-node@v4
2524
with:
26-
node-version: ${{ matrix.node-version }}
25+
node-version: ${{ env.NODEJS_VERSION }}
2726

2827
- name: Cache node modules
2928
id: cache-npm
@@ -43,8 +42,70 @@ jobs:
4342
run: npm install
4443

4544
- name: Test
45+
id: test_run
4646
run: npm test -- --collect-coverage --max-workers=4
4747

48+
- uses: actions/upload-artifact@v4
49+
if: ${{ steps.test_run.outcome == 'success' }}
50+
name: Save coverage report
51+
with:
52+
name: coverage_report
53+
path: coverage/
54+
retention-days: 10
55+
56+
57+
sanity:
58+
if: ${{ github.event_name == 'pull_request' }}
59+
name: Sanity
60+
runs-on: ubuntu-latest
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Setup Node.js
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: ${{ env.NODEJS_VERSION }}
70+
71+
- name: Cache node modules
72+
id: cache-npm
73+
uses: actions/cache@v4
74+
env:
75+
cache-name: cache-node-modules
76+
with:
77+
# npm cache files are stored in `~/.npm` on Linux/macOS
78+
path: ~/.npm
79+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
80+
restore-keys: |
81+
${{ runner.os }}-build-${{ env.cache-name }}-
82+
${{ runner.os }}-build-
83+
${{ runner.os }}-
84+
85+
- name: Install dependencies
86+
run: npm install
87+
88+
- name: Lint
89+
run: npm run lint
90+
91+
- name: Build
92+
run: npm run build
93+
94+
coverage:
95+
name: Coverage
96+
needs: [units]
97+
runs-on: ubuntu-latest
98+
99+
steps:
100+
- name: Checkout code
101+
uses: actions/checkout@v4
102+
103+
- name: Download coverage report
104+
uses: actions/download-artifact@v4
105+
with:
106+
name: coverage_report
107+
path: coverage
108+
48109
- name: Upload coverage report
49110
if: ${{ success() }}
50111
uses: codecov/codecov-action@v4.2.0
@@ -53,4 +114,3 @@ jobs:
53114
with:
54115
directory: coverage
55116
plugin: pycoverage # Only run one plugin so that all do not run. There is no way to disable plugins entirely.
56-

.github/workflows/pull_request.yml

-54
This file was deleted.

0 commit comments

Comments
 (0)