1
1
name : CI
2
- on : [pull_request]
2
+
3
+ on :
4
+ push :
5
+ branches : [master]
6
+ pull_request :
7
+ branches : [master]
8
+
3
9
jobs :
4
10
build :
5
11
name : Lint, Test, Report Coverage on Node ${{ matrix.node }}
6
-
7
12
runs-on : ubuntu-latest
8
13
strategy :
9
14
matrix :
@@ -22,22 +27,26 @@ jobs:
22
27
- name : Install dependencies
23
28
run : yarn install
24
29
30
+ # Read existing version, reuse that, add a Git short hash
31
+ - name : Set build version to Git commit
32
+ run : node scripts/writeGitVersion.mjs $(git rev-parse --short HEAD)
33
+
34
+ - name : Check updated version
35
+ run : jq .version package.json
36
+
25
37
- name : Run linter
26
38
run : yarn lint
27
39
28
40
- name : Run tests
29
41
run : yarn test
30
42
31
- - name : Generate test coverage
32
- run : yarn test:cov
33
-
34
- - name : Compile
35
- run : yarn build
43
+ - name : Pack
44
+ run : yarn pack
36
45
37
- - name : Report to Codecov.io
38
- uses : codecov/codecov-action@v1
46
+ - uses : actions/upload-artifact@v2
39
47
with :
40
- files : ./coverage/lcov.info
48
+ name : package
49
+ path : ./package.tgz
41
50
42
51
test-types :
43
52
name : Test Types with TypeScript ${{ matrix.ts }}
48
57
fail-fast : false
49
58
matrix :
50
59
node : ['16.x']
51
- ts : ['4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9.2-rc ']
60
+ ts : ['4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9', '5.0 ']
52
61
steps :
53
62
- name : Checkout repo
54
63
uses : actions/checkout@v2
78
87
79
88
# Remove config line that points "reselect" to the `src` folder,
80
89
# so that the typetest will use the installed version instead
81
- - run : sed -i -e /@remap-prod-remove-line/d ./typescript_test/tsconfig.json
90
+ - run : sed -i -e /@remap-prod-remove-line/d ./typescript_test/tsconfig.json vitest.config.ts
82
91
83
92
- name : Test types
84
93
run : |
85
94
./node_modules/.bin/tsc --version
86
95
yarn test:typescript
96
+
97
+ test-published-artifact :
98
+ name : Test Published Artifact ${{ matrix.example }}
99
+
100
+ needs : [build]
101
+ runs-on : ubuntu-latest
102
+ strategy :
103
+ fail-fast : false
104
+ matrix :
105
+ node : ['16.x']
106
+ example :
107
+ [
108
+ ' cra4' ,
109
+ ' cra5' ,
110
+ ' next' ,
111
+ ' vite' ,
112
+ ' node-standard' ,
113
+ ' node-esm' ,
114
+ ' are-the-types-wrong'
115
+ ]
116
+ steps :
117
+ - name : Checkout repo
118
+ uses : actions/checkout@v2
119
+
120
+ - name : Use node ${{ matrix.node }}
121
+ uses : actions/setup-node@v2
122
+ with :
123
+ node-version : ${{ matrix.node }}
124
+ cache : ' yarn'
125
+
126
+ - name : Clone RTK repo
127
+ run : git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit
128
+
129
+ - name : Check folder contents
130
+ run : ls -l .
131
+
132
+ - name : Install deps
133
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
134
+ run : yarn install
135
+
136
+ - uses : actions/download-artifact@v2
137
+ with :
138
+ name : package
139
+ path : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
140
+
141
+ - name : Check folder contents
142
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
143
+ run : ls -l .
144
+
145
+ - name : Install build artifact
146
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
147
+ run : yarn add ./package.tgz
148
+
149
+ - name : Show installed package versions
150
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
151
+ run : yarn info reselect && yarn why reselect
152
+
153
+ - name : Build example
154
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
155
+ run : yarn build
156
+
157
+ - name : Run test step
158
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
159
+ run : yarn test
160
+ if : matrix.example != 'are-the-types-wrong'
161
+
162
+ - name : Run test step (attw)
163
+ working-directory : ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
164
+ # Ignore "FalseCJS" errors in the `attw` job
165
+ run : yarn test -n FalseCJS
166
+ if : matrix.example == 'are-the-types-wrong'
0 commit comments