Skip to content

Commit fd3d137

Browse files
authored
Improve testing pipeline (#19)
* formatting * make win binary in build job * save artifacts * build on windows Also improve pipeline * Corrected job name * corrected yaml indenting * removed rogue space * make does not exist on the windows box * add job to test windows without git * only test windows without git * Do not return exit 0 for this test * test linux without git * rename job * Add step for macos testing without git * Correct indenting * Correct identing * Have the withoit git job not fail
1 parent af3b30c commit fd3d137

File tree

3 files changed

+146
-20
lines changed

3 files changed

+146
-20
lines changed

.circleci/config.yml

+141-17
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ jobs:
4343
# run tests!
4444
- run: make build
4545

46-
# upload coverage
47-
# - run: out/codecov-linux -f coverage/cobertura-coverage.xml -F build
48-
4946
# Persist the specified paths (workspace/echo-output) into the workspace for use in downstream job.
5047
- persist_to_workspace:
5148
# Must be an absolute path, or relative path from working_directory. This is a directory on the container which is
@@ -56,6 +53,25 @@ jobs:
5653
- out
5754
- coverage
5855

56+
build-windows:
57+
executor: win/default
58+
steps:
59+
- checkout
60+
- attach_workspace:
61+
# Must be absolute path or relative path from working_directory
62+
at: .
63+
- run:
64+
name: Build Windows Binary
65+
command: |
66+
npm ci
67+
npm run build-windows
68+
69+
- persist_to_workspace:
70+
root: .
71+
paths:
72+
- out
73+
- coverage
74+
5975
test-linux:
6076
docker:
6177
# specify the version you desire here
@@ -68,54 +84,145 @@ jobs:
6884
- run:
6985
name: Run Linux binary (dry run)
7086
command: |
71-
out/codecov-linux -F linux -d -Z
87+
out/codecov-linux -F linux -d -Z > output_linux.txt
7288
- run:
7389
name: Run Linux binary (upload)
7490
command: |
7591
out/codecov-linux -F linux -Z
7692
93+
- persist_to_workspace:
94+
root: .
95+
paths:
96+
- output_linux.txt
97+
98+
test-linux-without-git:
99+
docker:
100+
- image: circleci/node:10.16.3
101+
steps:
102+
- attach_workspace:
103+
# TODO: Determine why we use the cwd on Linex and not on other operating systems.
104+
at: .
105+
- run:
106+
name: Run Linux binary (dry run)
107+
command: |
108+
out/codecov-linux -F linux-without-git -d -Z > output_linux_without_git.txt
109+
- run:
110+
name: Run Linux binary (upload)
111+
command: |
112+
out/codecov-linux -F linux-without-git -Z
113+
114+
- persist_to_workspace:
115+
root: .
116+
paths:
117+
- output_linux.txt
118+
77119
test-macos:
78-
macos: # indicate that we are using the macOS executor
79-
xcode: "10.0.0" # indicate our selected version of Xcode
80-
steps: # a series of commands to run
120+
macos:
121+
xcode: "10.0.0"
122+
steps:
81123
- checkout
82124
- attach_workspace:
83125
at: .
84126
- run:
85127
name: Run MacOS binary (dry-run)
86128
command: |
87-
out/codecov-macos -F macos -d -Z
129+
out/codecov-macos -F macos -d -Z > output_osx.txt
88130
- run:
89-
# run our tests using xcode's cli tool `xcodebuild`
90131
name: Run MacOS binary (upload)
91132
command: |
92133
out/codecov-macos -F macos -Z
93134
135+
- persist_to_workspace:
136+
root: .
137+
paths:
138+
- output_osx.txt
139+
140+
test-macos-without-git:
141+
macos:
142+
xcode: "10.0.0"
143+
steps:
144+
- attach_workspace:
145+
at: .
146+
- run:
147+
name: Run MacOS binary (dry-run)
148+
command: |
149+
out/codecov-macos -F macos-without-git -d > output_osx_without_git.txt
150+
- run:
151+
name: Run MacOS binary (upload)
152+
command: |
153+
out/codecov-macos -F macos-without-git
154+
155+
- persist_to_workspace:
156+
root: .
157+
paths:
158+
- output_osx.txt
159+
94160
test-windows:
95161
executor: win/default
96162
steps:
97163
- checkout
98164
- attach_workspace:
99-
# Must be absolute path or relative path from working_directory
100165
at: .
101166
- run:
102-
name: Build Windows Binary
167+
name: Run Windows binary (dry-run)
103168
command: |
104-
npm ci
105-
npm run build-windows
169+
.\out\codecov.exe -F windows -d -Z > output_win.txt
170+
shell: cmd.exe
171+
- run:
172+
name: Run Windows binary (upload)
173+
command: |
174+
.\out\codecov.exe -F windows -Z
175+
shell: cmd.exe
176+
177+
- persist_to_workspace:
178+
root: .
179+
paths:
180+
- output_win.txt
181+
182+
test-windows-without-git:
183+
executor: win/default
184+
steps:
185+
- attach_workspace:
186+
# Must be absolute path or relative path from working_directory
187+
at: .
106188
- run:
107189
name: Run Windows binary (dry-run)
108190
command: |
109-
.\out\codecov.exe -F windows -d -Z > output.txt
191+
.\out\codecov.exe -F windows-without-git -d > output_win_without_git.txt
110192
shell: cmd.exe
111193
- run:
112194
name: Run Windows binary (upload)
113195
command: |
114-
.\out\codecov.exe -F windows -Z
196+
.\out\codecov.exe -F windows-without-git
115197
shell: cmd.exe
116198

199+
- persist_to_workspace:
200+
root: .
201+
paths:
202+
- output_win_without_git.txt
203+
204+
review:
205+
docker:
206+
- image: circleci/node:10.16.3
207+
steps:
208+
- attach_workspace:
209+
at: .
210+
- store_artifacts:
211+
path: coverage
212+
- store_artifacts:
213+
path: out
117214
- store_artifacts:
118-
path: output.txt
215+
path: output_linux.txt
216+
- store_artifacts:
217+
path: output_linux_without_git.txt
218+
- store_artifacts:
219+
path: output_osx.txt
220+
- store_artifacts:
221+
path: output_osx_without_git.txt
222+
- store_artifacts:
223+
path: output_win.txt
224+
- store_artifacts:
225+
path: output_win_without_git.txt
119226

120227
# TODO: add test runs for each binary outside of a git project
121228

@@ -125,12 +232,29 @@ workflows:
125232
"Build and Test":
126233
jobs:
127234
- build
235+
- build-windows:
236+
requires:
237+
- build
128238
- test-linux:
129239
requires:
130240
- build
241+
- test-linux-without-git:
242+
requires:
243+
- test-linux
131244
- test-macos:
132245
requires:
133246
- build
247+
- test-macos-without-git:
248+
requires:
249+
- test-macos
134250
- test-windows:
135251
requires:
136-
- build
252+
- build-windows
253+
- test-windows-without-git:
254+
requires:
255+
- test-windows
256+
- review:
257+
requires:
258+
- test-linux-without-git
259+
- test-macos-without-git
260+
- test-windows-without-git

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ build:
1717
rm -rf dist
1818
npm run build-linux
1919
npm run build-macos
20-
# npm run build-windows
2120

22-
.PHONY: clean install test build, build-win
21+
.PHONY: clean install test build

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@
8383
"!**/node_modules/**",
8484
"!**/vendor/**"
8585
],
86-
"coverageReporters": ["text", "cobertura"],
86+
"coverageReporters": [
87+
"text",
88+
"cobertura"
89+
],
8790
"setupFilesAfterEnv": [
8891
"<rootDir>/test/test_helpers.js"
8992
]

0 commit comments

Comments
 (0)