Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #22 from httprunner/build_publish
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
debugtalk authored Nov 19, 2021
2 parents f21e85f + b21232e commit e57936f
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml → .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test
name: Run unittest with coverage

on:
push:
Expand All @@ -10,7 +10,7 @@ on:
jobs:
test:
strategy:
fail-fast: false
fail-fast: true
matrix:
go-version:
- 1.13.x
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}'
4 changes: 3 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion docs/cmd/hrp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/cmd/hrp_boom.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/cmd/hrp_har2case.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/cmd/hrp_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 23 additions & 0 deletions hrp/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package hrp

const VERSION = "v0.1.0"
const VERSION = "v0.2.0"

0 comments on commit e57936f

Please sign in to comment.