mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 15:31:23 +08:00
Merge branch 'httprunner:main' into main
This commit is contained in:
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@@ -29,3 +29,15 @@ jobs:
|
|||||||
binary_name: "hrp"
|
binary_name: "hrp"
|
||||||
ldflags: "-s -w"
|
ldflags: "-s -w"
|
||||||
extra_files: LICENSE README.md docs/CHANGELOG.md
|
extra_files: LICENSE README.md docs/CHANGELOG.md
|
||||||
|
- name: Setup aliyun OSS
|
||||||
|
uses: manyuanrong/setup-ossutil@v2.0
|
||||||
|
with:
|
||||||
|
endpoint: "oss-cn-beijing.aliyuncs.com"
|
||||||
|
access-key-id: ${{ secrets.ALIYUN_ACCESSKEY_ID }}
|
||||||
|
access-key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }}
|
||||||
|
# - name: Upload to aliyun OSS
|
||||||
|
# run: |
|
||||||
|
# ossutil cp -rf cli/scripts/install.sh oss://httprunner/
|
||||||
|
# ossutil cp -rf hrp-*.tar.gz hrp-*.zip oss://httprunner/ || true
|
||||||
|
# - name: Test install.sh
|
||||||
|
# run: bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,6 +19,7 @@ __debug_bin
|
|||||||
.idea/
|
.idea/
|
||||||
__pycache__
|
__pycache__
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*.bak
|
||||||
|
|
||||||
site/
|
site/
|
||||||
output/
|
output/
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -8,6 +8,11 @@ test: ## run unit tests
|
|||||||
@echo "go test -race -v ./..."
|
@echo "go test -race -v ./..."
|
||||||
@go test -race -v ./...
|
@go test -race -v ./...
|
||||||
|
|
||||||
|
.PHONY: bump
|
||||||
|
bump: ## bump hrp version
|
||||||
|
@echo "[info] bump hrp version"
|
||||||
|
@. cli/scripts/bump_version.sh $(version)
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: ## build hrp cli tool
|
build: ## build hrp cli tool
|
||||||
@echo "[info] build hrp cli tool"
|
@echo "[info] build hrp cli tool"
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ See [CHANGELOG].
|
|||||||
You can install `hrp` with one shell command, which will download the latest version's released binary and install to the current system.
|
You can install `hrp` with one shell command, which will download the latest version's released binary and install to the current system.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl -sL https://raw.githubusercontent.com/httprunner/hrp/main/cli/scripts/install.sh | bash
|
# install via curl
|
||||||
|
$ bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
|
||||||
|
# install via wget
|
||||||
|
$ bash -c "$(wget https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh -O -)"
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are a golang developer, you can also install `hrp` with `go get`.
|
If you are a golang developer, you can also install `hrp` with `go get`.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
@@ -31,8 +32,12 @@ Website: https://httprunner.com
|
|||||||
Github: https://github.com/httprunner/hrp
|
Github: https://github.com/httprunner/hrp
|
||||||
Copyright 2021 debugtalk`,
|
Copyright 2021 debugtalk`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
var noColor = false
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
noColor = true
|
||||||
|
}
|
||||||
if !logJSON {
|
if !logJSON {
|
||||||
log.Logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger()
|
log.Logger = zerolog.New(zerolog.ConsoleWriter{NoColor: noColor, Out: os.Stderr}).With().Timestamp().Logger()
|
||||||
log.Info().Msg("Set log to color console other than JSON format.")
|
log.Info().Msg("Set log to color console other than JSON format.")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
23
cli/scripts/bump_version.sh
Normal file
23
cli/scripts/bump_version.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# build hrp cli binary for testing
|
||||||
|
# release will be triggered on github actions, see .github/workflows/release.yml
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# $ make bump version=v0.5.2
|
||||||
|
# or
|
||||||
|
# $ bash cli/scripts/bump_version.sh v0.5.2
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
version=$1
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "version is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "bump hrp version to $version"
|
||||||
|
sed -i'.bak' "s/\"v.*\"/\"$version\"/g" internal/version/init.go
|
||||||
|
|
||||||
|
echo "bump install.sh version to $version"
|
||||||
|
sed -i'.bak' "s/LATEST_VERSION=\"v.*\"/LATEST_VERSION=\"$version\"/g" cli/scripts/install.sh
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# install hrp with one shell command
|
# install hrp with one shell command
|
||||||
# curl -sL https://raw.githubusercontent.com/httprunner/hrp/main/cli/scripts/install.sh | bash
|
# bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
|
||||||
|
|
||||||
|
LATEST_VERSION="v0.5.2"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -24,6 +26,11 @@ function get_latest_version() {
|
|||||||
curl -sL https://github.com/httprunner/hrp/releases/latest | grep '<title>Release' | cut -d" " -f4
|
curl -sL https://github.com/httprunner/hrp/releases/latest | grep '<title>Release' | cut -d" " -f4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_os() {
|
||||||
|
os=$(uname -s)
|
||||||
|
echo "$os" | tr '[:upper:]' '[:lower:]'
|
||||||
|
}
|
||||||
|
|
||||||
function get_arch() {
|
function get_arch() {
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
if [ "$arch" == "x86_64" ]; then
|
if [ "$arch" == "x86_64" ]; then
|
||||||
@@ -32,31 +39,64 @@ function get_arch() {
|
|||||||
echo "$arch"
|
echo "$arch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_pkg_suffix() {
|
||||||
|
os=$1
|
||||||
|
if [ "$os" == "windows" ]; then
|
||||||
|
echo ".zip"
|
||||||
|
else
|
||||||
|
echo ".tar.gz"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract_pkg() {
|
||||||
|
pkg=$1
|
||||||
|
if [[ $pkg == *.zip ]]; then # windows
|
||||||
|
echo "$ unzip -o $pkg -d ."
|
||||||
|
unzip -o $pkg -d .
|
||||||
|
else
|
||||||
|
echo "$ tar -xzf $pkg"
|
||||||
|
tar -xzf "$pkg"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
echoInfo "Detect target hrp package..."
|
echoInfo "Detect target hrp package..."
|
||||||
version=$(get_latest_version)
|
version=$LATEST_VERSION
|
||||||
echo "Latest version: $version"
|
os=$(get_os)
|
||||||
os=$(uname -s)
|
|
||||||
echo "Current OS: $os"
|
echo "Current OS: $os"
|
||||||
arch=$(get_arch)
|
arch=$(get_arch)
|
||||||
echo "Current ARCH: $arch"
|
echo "Current ARCH: $arch"
|
||||||
pkg="hrp-$version-$os-$arch.tar.gz"
|
pkg_suffix=$(get_pkg_suffix $os)
|
||||||
url="https://github.com/httprunner/hrp/releases/download/$version/$pkg"
|
pkg="hrp-$version-$os-$arch$pkg_suffix"
|
||||||
echo "Selected package: $url"
|
|
||||||
|
# download from aliyun OSS
|
||||||
|
url="https://httprunner.oss-cn-beijing.aliyuncs.com/$pkg"
|
||||||
|
if ! curl --output /dev/null --silent --head --fail "$url"; then
|
||||||
|
# aliyun OSS url is invalid, try to download from github
|
||||||
|
version=$(get_latest_version)
|
||||||
|
pkg="hrp-$version-$os-$arch$pkg_suffix"
|
||||||
|
url="https://github.com/httprunner/hrp/releases/download/$version/$pkg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Latest version: $version"
|
||||||
|
echo "Download url: $url"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echoInfo "Created temp dir..."
|
echoInfo "Created temp dir..."
|
||||||
tmp_dir=$(mktemp -d -t hrp)
|
echo "$ mktemp -d -t hrp.XXXX"
|
||||||
|
tmp_dir=$(mktemp -d -t hrp.XXXX)
|
||||||
echo "$tmp_dir"
|
echo "$tmp_dir"
|
||||||
cd "$tmp_dir"
|
cd "$tmp_dir"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echoInfo "Downloading..."
|
echoInfo "Downloading..."
|
||||||
curl -L $url -o "$pkg"
|
echo "$ curl -kL $url -o $pkg"
|
||||||
|
curl -kL $url -o "$pkg"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echoInfo "Extracting..."
|
echoInfo "Extracting..."
|
||||||
tar -zxf "$pkg"
|
extract_pkg "$pkg"
|
||||||
|
echo "$ ls -lh"
|
||||||
ls -lh
|
ls -lh
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@@ -67,7 +107,7 @@ function main() {
|
|||||||
rm -rf "$(which hrp)"
|
rm -rf "$(which hrp)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "chmod +x hrp && mv hrp /usr/local/bin/"
|
echo "$ chmod +x hrp && mv hrp /usr/local/bin/"
|
||||||
chmod +x hrp
|
chmod +x hrp
|
||||||
mv hrp /usr/local/bin/
|
mv hrp /usr/local/bin/
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
|
## v0.5.3 (2022-01-20)
|
||||||
|
|
||||||
|
- change: download package assets from aliyun OSS
|
||||||
|
- fix: disable color logging on Windows
|
||||||
|
|
||||||
## v0.5.2 (2022-01-19)
|
## v0.5.2 (2022-01-19)
|
||||||
|
|
||||||
- feat: support creating and calling custom functions with [hashicorp/go-plugin](https://github.com/hashicorp/go-plugin)
|
- feat: support creating and calling custom functions with [hashicorp/go-plugin](https://github.com/hashicorp/go-plugin)
|
||||||
|
|||||||
Reference in New Issue
Block a user