Skip to content

Commit 6db97ca

Browse files
tonyobruno-garcia
authored andcommitted
fix: Ignore Zeus errors when not on release branch (#296)
1 parent 8f76db7 commit 6db97ca

File tree

2 files changed

+56
-13
lines changed

2 files changed

+56
-13
lines changed

.appveyor.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
version: '{build}'
1+
version: "{build}"
22
image: Visual Studio 2017
33
environment:
44
global:
5-
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
6-
DOTNET_CLI_TELEMETRY_OPTOUT: 1
5+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
6+
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
77
test: off
88
branches:
99
only:
1010
- master
1111
- /^release\/.*$/
1212
build_script:
13-
- ps: ./build.ps1
13+
- ps: ./build.ps1
1414
dotnet_csproj:
1515
patch: true
1616
file: 'src\**\*.csproj'
17-
version: '{version}'
18-
package_version: '{version}'
17+
version: "{version}"
18+
package_version: "{version}"
1919
artifacts:
20-
- path: '**\*.nupkg'
20+
- path: '**\*.nupkg'
2121
install:
2222
# Push job information to Zeus
2323
- npm install -g @zeus-ci/cli
24-
- zeus job update --status=pending -B "%APPVEYOR_PULL_REQUEST_TITLE%" -J "%APPVEYOR_JOB_NAME%"
24+
- bash scripts\zeus.sh report_pending
2525
on_success:
2626
- ps: |
2727
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
2828
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
2929
bash codecov.sh -f "**\coverage.xml"
3030
31-
Resolve-Path -Relative .\src\*\bin\Release\*.nupkg |
32-
Foreach-Object { zeus upload -t "application/zip+nupkg" $_};
33-
if ($?) { zeus job update --status=passed }
34-
else { $host.SetShouldExit(1) }
31+
# Upload *.nupkg files to Zeus
32+
bash scripts/zeus.sh upload_artifacts
3533
on_failure:
36-
- zeus job update --status=failed
34+
- bash scripts\zeus.sh report_failed

scripts/zeus.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
# Redirect stderr to stdout to avoid weird Powershell errors
3+
exec 2>&1
4+
set -x
5+
6+
export PATH=./node_modules/.bin:$PATH
7+
8+
upload_artifacts() {
9+
zeus upload -t "application/zip+nupkg" ./src/*/bin/Release/*.nupkg
10+
zeus job update --status=passed
11+
}
12+
13+
14+
report_pending() {
15+
zeus job update --status=pending
16+
}
17+
18+
19+
report_failed() {
20+
zeus job update --status=failed
21+
}
22+
23+
24+
check_branch() {
25+
# Ignore errors if not on release branch
26+
if [[ ! "${APPVEYOR_REPO_BRANCH:-}" =~ ^release/ ]]; then
27+
trap - EXIT
28+
echo "Not on a release branch, ignoring all errors, if any."
29+
exit 0
30+
fi
31+
}
32+
33+
trap check_branch EXIT
34+
35+
command="${1:-}"
36+
if [[ "$command" == "upload_artifacts" ]]; then
37+
upload_artifacts
38+
elif [[ "$command" == "report_pending" ]]; then
39+
report_pending
40+
elif [[ "$command" == "report_failed" ]]; then
41+
report_failed
42+
else
43+
echo "Invalid command"
44+
exit 1
45+
fi

0 commit comments

Comments
 (0)