Skip to content

Commit c4facef

Browse files
authored
Split powershell from bash (#89)
1 parent c9b2aac commit c4facef

File tree

6 files changed

+61
-103
lines changed

6 files changed

+61
-103
lines changed

.circleci/config.yml

+18-15
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,35 @@ jobs:
6565
root: .
6666
paths:
6767
- coverage/coverage-final.json
68-
test-codecov-orb:
68+
test-codecov-orb-non-windows:
6969
parameters:
7070
os:
7171
type: executor
72-
using_windows:
73-
type: boolean
7472
executor: << parameters.os >>
7573
steps:
7674
- checkout
7775
- attach_workspace:
7876
at: .
7977
- codecov/upload:
8078
flags: backend
81-
using_windows: << parameters.using_windows >>
8279
- codecov/upload:
8380
file: coverage/coverage-final.json
8481
flags: frontend
85-
using_windows: << parameters.using_windows >>
8682
xtra_args: -v -Z
87-
83+
test-codecov-orb-windows:
84+
executor:
85+
name: win/default
86+
shell: bash.exe
87+
steps:
88+
- checkout
89+
- attach_workspace:
90+
at: .
91+
- codecov/upload:
92+
flags: backend
93+
- codecov/upload:
94+
file: coverage/coverage-final.json
95+
flags: frontend
96+
xtra_args: -v -Z
8897

8998
workflows:
9099
test-pack:
@@ -120,21 +129,15 @@ workflows:
120129
jobs:
121130
- test-backend
122131
- test-frontend
123-
- test-codecov-orb:
132+
- test-codecov-orb-non-windows:
124133
matrix:
125-
alias: test-codecov-orb-non-windows
126134
parameters:
127135
os: [linux, macos]
128-
using_windows: [false]
129136
requires:
130137
- test-backend
131138
- test-frontend
132-
- test-codecov-orb:
133-
matrix:
134-
alias: test-codecov-orb-windows
135-
parameters:
136-
os: [windows]
137-
using_windows: [true]
139+
140+
- test-codecov-orb-windows:
138141
requires:
139142
- test-backend
140143
- test-frontend

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.2.3
2+
**Backwards Incompatibility**
3+
`using_windows` has been deprecated
4+
5+
**Fixes**
6+
- #89 Fixes issue with running bash on Windows machines
7+
18
## 1.2.2
29
**Fixes**
310
- #88 Fixes issue with Windows curling the bash script

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# codecov-circleci-orb
22

3-
## Latest version 1.2.2
3+
## Latest version 1.2.3
44

55
[![codecov.io](https://codecov.io/github/codecov/codecov-circleci-orb/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-circleci-orb)
66
[![Circle CI](https://circleci.com/gh/codecov/codecov-circleci-orb.png?style=badge)](https://circleci.com/gh/codecov/codecov-circleci-orb)

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codecov-circleci-orb",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "Codecov CircleCI Orb",
55
"main": "index.js",
66
"devDependencies": {

src/@orb.yml

+33-85
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ commands:
2929
description: Custom url to submit the codecov result. Default to "https://codecov.io/bash"
3030
type: string
3131
default: "https://codecov.io/bash"
32-
using_windows:
33-
description: Is this being run in a Windows setup?
34-
type: boolean
35-
default: false
3632
validate_url:
3733
description: Validate the url before submitting the codecov result. https://docs.codecov.io/docs/about-the-codecov-bash-uploader#validating-the-bash-script
3834
type: boolean
@@ -46,88 +42,40 @@ commands:
4642
type: string
4743
default: ""
4844
steps:
45+
- run:
46+
name: Download Codecov Bash Uploader
47+
command: curl -fLso codecov << parameters.url >>
48+
when: << parameters.when >>
4949
- when:
50-
condition: << parameters.using_windows >>
50+
condition: << parameters.validate_url >>
5151
steps:
5252
- run:
53-
name: Download Codecov Bash Uploader
54-
command: Invoke-WebRequest -Uri "<< parameters.url >>" -Outfile codecov
55-
when: << parameters.when >>
56-
- when:
57-
condition: << parameters.validate_url >>
58-
steps:
59-
- run:
60-
name: Validate Codecov Bash Uploader
61-
command: |
62-
$VERSION=((Select-String -path codecov 'VERSION=\"[0-9\.]*\"' | ForEach-Object {$_.Matches} | Foreach-Object {$_.Groups[0].Value})-split '"')[1]
63-
foreach ($i in 1, 256, 512) {
64-
echo "Pulling public hashes from https://github.com/codecov/codecov-bash/releases/download/${VERSION}/SHA${i}SUM"
65-
$hash = (((Invoke-WebRequest -Uri "https://github.com/codecov/codecov-bash/releases/download/${VERSION}/SHA${i}SUM")[0])-split( " " ))[0]
66-
$scripthash = (Get-FileHash -Algorithm "SHA${i}" codecov).hash.ToLower()
67-
If ($scripthash -ne $hash) {
68-
echo "Script hash: ${scripthash}"
69-
echo "Published has: ${hash}"
70-
echo "SHASUMs do not match, exiting."
71-
exit 1
72-
} Else {
73-
echo "OK"
74-
}
75-
}
76-
- run:
77-
name: Upload Coverage Results
78-
command: |
79-
$arguments = @( "-Q", "codecov-circleci-orb-1.2.2" )
80-
If ( "<< parameters.token >>" -ne "") {
81-
$arguments += "-t"
82-
$arguments += "<< parameters.token >>"
83-
}
84-
If ( "<< parameters.flags >>" -ne "") {
85-
$arguments += "-F"
86-
$arguments += "<< parameters.flags >>"
87-
}
88-
If ( "<< parameters.file >>" -ne "") {
89-
$arguments += "-f"
90-
$arguments += "<< parameters.file >>"
91-
}
92-
If ( "<< parameters.upload_name >>" -ne "") {
93-
$arguments += "-n"
94-
$arguments += "<< parameters.upload_name >>"
95-
}
96-
If ( "<< parameters.xtra_args >>" -ne "") {
97-
foreach ($arg in "<< parameters.xtra_args >>".split( " " ) ) {
98-
$arguments += $arg
99-
}
100-
}
101-
chmod +x codecov
102-
bash ./codecov @arguments
103-
- unless:
104-
condition: << parameters.using_windows >>
105-
steps:
53+
name: Validate Codecov Bash Uploader
54+
command: |
55+
VERSION=$(grep 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2);
56+
sha1sum -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA1SUM) ||
57+
sha1sum -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA1SUM | grep -w "codecov") ||
58+
shasum -a 1 -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA1SUM) ||
59+
shasum -a 1 -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA1SUM | grep -w "codecov")
60+
61+
sha256sum -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM) ||
62+
sha256sum -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM | grep -w "codecov") ||
63+
shasum -a 256 -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM) ||
64+
shasum -a 256 -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM | grep -w "codecov")
65+
66+
sha512sum -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM) ||
67+
sha512sum -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM | grep -w "codecov") ||
68+
shasum -a 512 -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM) ||
69+
shasum -a 512 -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA512SUM | grep -w "codecov")
10670
- run:
107-
name: Download Codecov Bash Uploader
108-
command: curl -fLso codecov << parameters.url >>
109-
when: << parameters.when >>
110-
- when:
111-
condition: << parameters.validate_url >>
112-
steps:
113-
- run:
114-
name: Validate Codecov Bash Uploader
115-
command: |
116-
VERSION=$(grep 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2);
117-
for i in 1 256 512
118-
do
119-
shasum -a $i -c --ignore-missing <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM) ||
120-
shasum -a $i -c <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM | grep -w "codecov")
121-
done
122-
- run:
123-
name: Upload Coverage Results
124-
command: |
125-
args=()
126-
[[ -n "<< parameters.file >>" ]] && args+=( '-f << parameters.file >>' )
127-
[[ -n "<< parameters.xtra_args >>" ]] && args+=( '<< parameters.xtra_args >>' )
128-
bash codecov \
129-
-Q "codecov-circleci-orb-1.2.2" \
130-
-t "<< parameters.token >>" \
131-
-n "<< parameters.upload_name >>" \
132-
-F "<< parameters.flags >>" \
133-
${args[@]}
71+
name: Upload Coverage Results
72+
command: |
73+
args=()
74+
[[ -n "<< parameters.file >>" ]] && args+=( '-f << parameters.file >>' )
75+
[[ -n "<< parameters.xtra_args >>" ]] && args+=( '<< parameters.xtra_args >>' )
76+
bash codecov \
77+
-Q "codecov-circleci-orb-1.2.3" \
78+
-t "<< parameters.token >>" \
79+
-n "<< parameters.upload_name >>" \
80+
-F "<< parameters.flags >>" \
81+
${args[@]}

0 commit comments

Comments
 (0)