Skip to content

Commit

Permalink
Improve testing pipeline (#19)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
drazisil authored Mar 20, 2020
1 parent af3b30c commit fd3d137
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 20 deletions.
158 changes: 141 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ jobs:
# run tests!
- run: make build

# upload coverage
# - run: out/codecov-linux -f coverage/cobertura-coverage.xml -F build

# Persist the specified paths (workspace/echo-output) into the workspace for use in downstream job.
- persist_to_workspace:
# Must be an absolute path, or relative path from working_directory. This is a directory on the container which is
Expand All @@ -56,6 +53,25 @@ jobs:
- out
- coverage

build-windows:
executor: win/default
steps:
- checkout
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: .
- run:
name: Build Windows Binary
command: |
npm ci
npm run build-windows
- persist_to_workspace:
root: .
paths:
- out
- coverage

test-linux:
docker:
# specify the version you desire here
Expand All @@ -68,54 +84,145 @@ jobs:
- run:
name: Run Linux binary (dry run)
command: |
out/codecov-linux -F linux -d -Z
out/codecov-linux -F linux -d -Z > output_linux.txt
- run:
name: Run Linux binary (upload)
command: |
out/codecov-linux -F linux -Z
- persist_to_workspace:
root: .
paths:
- output_linux.txt

test-linux-without-git:
docker:
- image: circleci/node:10.16.3
steps:
- attach_workspace:
# TODO: Determine why we use the cwd on Linex and not on other operating systems.
at: .
- run:
name: Run Linux binary (dry run)
command: |
out/codecov-linux -F linux-without-git -d -Z > output_linux_without_git.txt
- run:
name: Run Linux binary (upload)
command: |
out/codecov-linux -F linux-without-git -Z
- persist_to_workspace:
root: .
paths:
- output_linux.txt

test-macos:
macos: # indicate that we are using the macOS executor
xcode: "10.0.0" # indicate our selected version of Xcode
steps: # a series of commands to run
macos:
xcode: "10.0.0"
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run MacOS binary (dry-run)
command: |
out/codecov-macos -F macos -d -Z
out/codecov-macos -F macos -d -Z > output_osx.txt
- run:
# run our tests using xcode's cli tool `xcodebuild`
name: Run MacOS binary (upload)
command: |
out/codecov-macos -F macos -Z
- persist_to_workspace:
root: .
paths:
- output_osx.txt

test-macos-without-git:
macos:
xcode: "10.0.0"
steps:
- attach_workspace:
at: .
- run:
name: Run MacOS binary (dry-run)
command: |
out/codecov-macos -F macos-without-git -d > output_osx_without_git.txt
- run:
name: Run MacOS binary (upload)
command: |
out/codecov-macos -F macos-without-git
- persist_to_workspace:
root: .
paths:
- output_osx.txt

test-windows:
executor: win/default
steps:
- checkout
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: .
- run:
name: Build Windows Binary
name: Run Windows binary (dry-run)
command: |
npm ci
npm run build-windows
.\out\codecov.exe -F windows -d -Z > output_win.txt
shell: cmd.exe
- run:
name: Run Windows binary (upload)
command: |
.\out\codecov.exe -F windows -Z
shell: cmd.exe

- persist_to_workspace:
root: .
paths:
- output_win.txt

test-windows-without-git:
executor: win/default
steps:
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: .
- run:
name: Run Windows binary (dry-run)
command: |
.\out\codecov.exe -F windows -d -Z > output.txt
.\out\codecov.exe -F windows-without-git -d > output_win_without_git.txt
shell: cmd.exe
- run:
name: Run Windows binary (upload)
command: |
.\out\codecov.exe -F windows -Z
.\out\codecov.exe -F windows-without-git
shell: cmd.exe

- persist_to_workspace:
root: .
paths:
- output_win_without_git.txt

review:
docker:
- image: circleci/node:10.16.3
steps:
- attach_workspace:
at: .
- store_artifacts:
path: coverage
- store_artifacts:
path: out
- store_artifacts:
path: output.txt
path: output_linux.txt
- store_artifacts:
path: output_linux_without_git.txt
- store_artifacts:
path: output_osx.txt
- store_artifacts:
path: output_osx_without_git.txt
- store_artifacts:
path: output_win.txt
- store_artifacts:
path: output_win_without_git.txt

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

Expand All @@ -125,12 +232,29 @@ workflows:
"Build and Test":
jobs:
- build
- build-windows:
requires:
- build
- test-linux:
requires:
- build
- test-linux-without-git:
requires:
- test-linux
- test-macos:
requires:
- build
- test-macos-without-git:
requires:
- test-macos
- test-windows:
requires:
- build
- build-windows
- test-windows-without-git:
requires:
- test-windows
- review:
requires:
- test-linux-without-git
- test-macos-without-git
- test-windows-without-git
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ build:
rm -rf dist
npm run build-linux
npm run build-macos
# npm run build-windows

.PHONY: clean install test build, build-win
.PHONY: clean install test build
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@
"!**/node_modules/**",
"!**/vendor/**"
],
"coverageReporters": ["text", "cobertura"],
"coverageReporters": [
"text",
"cobertura"
],
"setupFilesAfterEnv": [
"<rootDir>/test/test_helpers.js"
]
Expand Down

0 comments on commit fd3d137

Please sign in to comment.