mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
feat #11: release hrp cli binaries automatically with github actions
feat #20: add Makefile for running unittest and building hrp cli binary
This commit is contained in:
31
.github/workflows/release.yml
vendored
Normal file
31
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Release hrp cli binaries
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
releases-matrix:
|
||||
name: Release hrp cli binaries
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# build and publish in parallel: linux/amd64/windows
|
||||
goos: [linux, windows, darwin]
|
||||
goarch: [amd64, arm64]
|
||||
exclude:
|
||||
- goarch: arm64
|
||||
goos: windows
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Release hrp cli binaries
|
||||
uses: wangyoucao577/go-release-action@v1.21
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
project_path: "./hrp" # go build ./hrp/main.go
|
||||
binary_name: "hrp"
|
||||
ldflags: "-s -w"
|
||||
extra_files: LICENSE docs/README.md docs/CHANGELOG.md
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Build and Test
|
||||
name: Run unittest with coverage
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -10,7 +10,7 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
fail-fast: true
|
||||
matrix:
|
||||
go-version:
|
||||
- 1.13.x
|
||||
20
Makefile
Normal file
20
Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
SHELL=/usr/bin/env bash
|
||||
|
||||
.DEFAULT_GOAL=help
|
||||
|
||||
.PHONY: test
|
||||
test: ## run unit tests
|
||||
@echo "[info] run unit tests"
|
||||
@echo "go test -race -v ./..."
|
||||
@go test -race -v ./...
|
||||
|
||||
.PHONY: build
|
||||
build: ## build hrp cli tool
|
||||
@echo "[info] build hrp cli tool"
|
||||
@. hrp/scripts/build.sh
|
||||
|
||||
.PHONY: help
|
||||
help: ## print make commands
|
||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
||||
cut -d ":" -f1- | \
|
||||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@@ -1,8 +1,10 @@
|
||||
# Release History
|
||||
|
||||
## v0.2.0 (2021-11-18)
|
||||
## v0.2.0 (2021-11-19)
|
||||
|
||||
- feat: deploy mkdocs to github pages when PR merged
|
||||
- feat: release hrp cli binaries automatically with github actions
|
||||
- feat: add Makefile for running unittest and building hrp cli binary
|
||||
|
||||
## v0.1.0 (2021-11-18)
|
||||
|
||||
|
||||
@@ -22,4 +22,4 @@ Copyright 2021 debugtalk
|
||||
* [hrp har2case](hrp_har2case.md) - Convert HAR to json/yaml testcase files
|
||||
* [hrp run](hrp_run.md) - run API test
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2021
|
||||
###### Auto generated by spf13/cobra on 19-Nov-2021
|
||||
|
||||
@@ -37,4 +37,4 @@ hrp boom [flags]
|
||||
|
||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2021
|
||||
###### Auto generated by spf13/cobra on 19-Nov-2021
|
||||
|
||||
@@ -23,4 +23,4 @@ hrp har2case harPath... [flags]
|
||||
|
||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2021
|
||||
###### Auto generated by spf13/cobra on 19-Nov-2021
|
||||
|
||||
@@ -30,4 +30,4 @@ hrp run path... [flags]
|
||||
|
||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Nov-2021
|
||||
###### Auto generated by spf13/cobra on 19-Nov-2021
|
||||
|
||||
23
hrp/scripts/build.sh
Normal file
23
hrp/scripts/build.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 build
|
||||
# or
|
||||
# $ bash hrp/scripts/build.sh
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# prepare path
|
||||
mkdir -p "output"
|
||||
bin_path="output/hrp"
|
||||
|
||||
# build
|
||||
go build -ldflags '-s -w' -o "$bin_path" hrp/main.go
|
||||
|
||||
# check output and version
|
||||
ls -lh "$bin_path"
|
||||
chmod +x "$bin_path"
|
||||
./"$bin_path" -v
|
||||
Reference in New Issue
Block a user