-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 43a42fb
Showing
4 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.nupkg | ||
publish.ps1 | ||
LatestChocoVersion.txt | ||
LatestVersion.txt | ||
bombardier.nuspec | ||
bombardier-windows-386.exe | ||
bombardier-windows-amd64.exe | ||
tools/chocolateyinstall.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2020 Will Huang | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
## bombardier: Fast cross-platform HTTP benchmarking tool written in Go (Chocolatey package) | ||
|
||
[![Build Status](https://willh.visualstudio.com/bombardier-chocolatey/_apis/build/status/bombardier-chocolatey-CI?branchName=master)](https://willh.visualstudio.com/bombardier-chocolatey/_build/latest?definitionId=58&branchName=master) | ||
|
||
Project Repo: <https://github.com/codesenberg/bombardier> | ||
|
||
### How to build package | ||
|
||
```sh | ||
choco pack | ||
``` | ||
|
||
### How to test install locally | ||
|
||
```sh | ||
choco install bombardier -d -s . | ||
``` | ||
|
||
### How to test uninstall locally | ||
|
||
```sh | ||
choco uninstall bombardier -d -s . | ||
``` | ||
|
||
### How to publish new version | ||
|
||
```sh | ||
choco push bombardier.X.Y.Z.nupkg --source https://push.chocolatey.org/ | ||
``` | ||
|
||
### How to update this package | ||
|
||
1. Edit `tools/chocolateyinstall.ps1` | ||
|
||
* `$url` | ||
* `$url64` | ||
* `checksum` | ||
* `checksum64` | ||
|
||
2. Edit `bombardier.nuspec` | ||
|
||
* Update `<version>` | ||
* Update `<releaseNotes>` (reference from [here](https://raw.githubusercontent.com/go-gitea/gitea/master/CHANGELOG.md)) | ||
|
||
3. Test install | ||
|
||
Open Command Prompt with Administrative right | ||
|
||
```sh | ||
choco pack | ||
choco install bombardier -d -s . -y | ||
choco uninstall bombardier -d -s . | ||
``` | ||
|
||
4. Publish to Chocolatey Gallery | ||
|
||
```sh | ||
choco push bombardier.X.Y.Z.nupkg --source https://push.chocolatey.org/ | ||
``` | ||
|
||
### How to build latest version of bombardier chocolatey package | ||
|
||
```sh | ||
.\build.ps1 | ||
``` | ||
|
||
This will generate a `publish.ps1` file to help publish to the Chocolatey Gallery. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
$LatestJSON = ((Invoke-WebRequest "https://api.github.com/repos/codesenberg/bombardier/releases/latest").Content | ConvertFrom-Json) | ||
|
||
$ReleaseNotes = $LatestJSON.body.Replace("`r`n`r`n", "`r`n").Replace("&", "&").Replace("<", "<").Replace(">", ">") | ||
|
||
$LatestVersion = $LatestJSON.tag_name -replace "v" -replace "" | ||
$LatestVersion | Out-File -FilePath LatestVersion.txt -Encoding UTF8 | ||
|
||
$LatestChocoVersion = "0.0.0" | ||
$LatestChocoVersion = ((choco list bombardier -r --all | C:\Windows\System32\sort.exe /r)[0] -split '\|')[1] | ||
$LatestChocoVersion | Out-File -FilePath LatestChocoVersion.txt -Encoding UTF8 | ||
|
||
$x86_link = $LatestJSON.assets | ForEach-Object -Process { if ($_.name -eq 'bombardier-windows-386.exe'){ $_.browser_download_url } } | ||
$x64_link = $LatestJSON.assets | ForEach-Object -Process { if ($_.name -eq 'bombardier-windows-amd64.exe'){ $_.browser_download_url } } | ||
|
||
$ProgressPreference = 'SilentlyContinue' | ||
Invoke-WebRequest -OutFile bombardier-windows-386.exe -Uri $x86_link | ||
Invoke-WebRequest -OutFile bombardier-windows-amd64.exe -Uri $x64_link | ||
$ProgressPreference = 'Continue' | ||
|
||
$x86_sha256 = (Get-FileHash .\bombardier-windows-386.exe).Hash | ||
$x64_sha256 = (Get-FileHash .\bombardier-windows-amd64.exe).Hash | ||
|
||
Remove-Item .\bombardier-windows-386.exe | ||
Remove-Item .\bombardier-windows-amd64.exe | ||
|
||
@" | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>bombardier</id> | ||
<version>$LatestVersion</version> | ||
<packageSourceUrl>https://github.com/doggy8088/bombardier-chocolatey</packageSourceUrl> | ||
<owners>Will 保哥</owners> | ||
<title>Bombardier</title> | ||
<authors>Bombardier</authors> | ||
<projectUrl>https://github.com/codesenberg/bombardier</projectUrl> | ||
<iconUrl>https://avatars1.githubusercontent.com/u/6357982?s=40&v=4</iconUrl> | ||
<copyright>The Bombardier Authors</copyright> | ||
<licenseUrl>https://github.com/codesenberg/bombardier/blob/master/LICENSE</licenseUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<projectSourceUrl>https://github.com/codesenberg/bombardier</projectSourceUrl> | ||
<docsUrl>https://github.com/codesenberg/bombardier/wiki</docsUrl> | ||
<bugTrackerUrl>https://github.com/codesenberg/bombardier/issues</bugTrackerUrl> | ||
<tags>bombardier http go</tags> | ||
<summary>Fast cross-platform HTTP benchmarking tool written in Go</summary> | ||
<description>Fast cross-platform HTTP benchmarking tool written in Go and published under the MIT license.</description> | ||
<releaseNotes>$ReleaseNotes</releaseNotes> | ||
</metadata> | ||
<files> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</package> | ||
"@ | Out-File -FilePath bombardier.nuspec -Encoding UTF8 | ||
|
||
@" | ||
`$ErrorActionPreference = 'Stop'; | ||
`$packageName= 'bombardier' | ||
`$toolsDir = "`$(Split-Path -parent `$MyInvocation.MyCommand.Definition)" | ||
`$url = '$x86_link' | ||
`$url64 = '$x64_link' | ||
`$toolsDir = "`$(Split-Path -parent `$MyInvocation.MyCommand.Definition)" | ||
`$packageArgs = @{ | ||
packageName = `$packageName | ||
url = `$url | ||
url64bit = `$url64 | ||
softwareName = 'bombardier' | ||
checksum = '$x86_sha256' | ||
checksumType = 'sha256' | ||
checksum64 = '$x64_sha256' | ||
checksumType64= 'sha256' | ||
fileFullPath = "`$toolsDir\bombardier.exe" | ||
validExitCodes= @(0) | ||
} | ||
Get-ChocolateyWebFile @packageArgs | ||
"@ | Out-File -FilePath tools\chocolateyinstall.ps1 -Encoding UTF8 | ||
|
||
choco pack | ||
|
||
# choco install bombardier -d -s . -y | ||
# choco uninstall bombardier -d -s . | ||
|
||
@" | ||
Set-ExecutionPolicy Unrestricted -Force | ||
Install-Module -Name PoshSemanticVersion -Force | ||
`$LatestChocoVersion = Get-Content LatestChocoVersion.txt | ||
`$LatestVersion = Get-Content LatestVersion.txt | ||
# Write-Output LatestChocoVersion = `$LatestChocoVersion | ||
# Write-Output LatestVersion = `$LatestVersion | ||
`$Precedence = (Compare-SemanticVersion -ReferenceVersion `$LatestChocoVersion -DifferenceVersion `$LatestVersion).Precedence; | ||
if (`$Precedence -eq '>' -or `$Precedence -eq '=') | ||
{ | ||
Write-Output "因為 Chocolatey 的 bombardier 套件版本(`$LatestChocoVersion) 大於等於 bombardier `$LatestVersion 版本,因此不需要發行套件!" | ||
Exit 0 | ||
} | ||
else | ||
{ | ||
Write-Output "準備發行 bombardier `$LatestVersion 版本到 Chocolatey Gallery" | ||
choco push bombardier.`$LatestVersion.nupkg --source https://push.chocolatey.org/ --key=#{CHOCO_APIKEY}# | ||
} | ||
"@ | Out-File -FilePath publish.ps1 -Encoding UTF8 |