Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor logs #13

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
666b9c0
Repackage according new repository name
avarabyeu Dec 6, 2021
1849eb2
Repackage according new repository name
avarabyeu Dec 6, 2021
b874b4c
update README
avarabyeu Dec 6, 2021
4f32dc2
update README
avarabyeu Dec 6, 2021
5219740
Add more examples for reporting usage
avarabyeu May 31, 2022
1cbd5f6
Add more examples for reporting usage
avarabyeu May 31, 2022
3effb02
fixes minor lint issues
avarabyeu Jun 10, 2022
e03d9c9
saving logs with attachments
Apr 5, 2023
002f5e1
fix SaveLogMultipart method and add example usage in comment.
Apr 6, 2023
244b451
a bit formatting
Apr 6, 2023
42f395d
Merge pull request #2 from Googlom/master
avarabyeu Apr 6, 2023
3385ad1
update deps, change logger
avarabyeu Apr 6, 2023
8451d30
Merge remote-tracking branch 'origin/master'
avarabyeu Apr 6, 2023
24fbbb1
fixes minor lint issues
avarabyeu Apr 6, 2023
934aa9f
update golang-ci linter
avarabyeu Apr 6, 2023
a746f6e
fixes shields badge
avarabyeu Apr 6, 2023
792b84a
fixes minor linter issues
avarabyeu Apr 6, 2023
fd1c0da
Add launch attributes as command-line arguments
mjte-riot Jun 13, 2023
601145d
Update launch attribute parsing to include tagging of values
mjte-riot Jun 16, 2023
942e3d6
Reporting now uses the timestamp from the JSON go test log
mjte-riot Jun 30, 2023
8f48214
Merge pull request #3 from mjte-riot/master
avarabyeu Jul 19, 2023
0ef5cbd
update dependencies up to the latest versions
avarabyeu Jul 19, 2023
373cd4a
Merge branch 'master' into timestamps
mjte-riot Jul 19, 2023
8b2cd92
Fix error identified by linter
mjte-riot Jul 19, 2023
2851e0c
Merge pull request #4 from mjte-riot/timestamps
avarabyeu Aug 7, 2023
1fa1ce5
support arm64. restructure project according default go project struc…
avarabyeu Aug 24, 2023
b9bb64b
update dependencies
avarabyeu Jan 12, 2024
f6c98be
update dependencies
avarabyeu Mar 11, 2024
91d9953
fixes minor issues with linter
avarabyeu Mar 11, 2024
ea02ddb
updates date flag to be set by goreleaser
avarabyeu Mar 12, 2024
b274a93
add possibility to pass reader to logs multipart
avarabyeu Apr 3, 2024
29be720
add release workflow, update installation steps
avarabyeu Apr 3, 2024
b56ba77
minor documentation fixes
avarabyeu Apr 3, 2024
ddd7bf6
run goreleaser only on tags creation
avarabyeu Apr 3, 2024
bdbc696
update go compiler in github actions
avarabyeu Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 4 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.15.0' # The Go version to download (if necessary) and use.
go-version: '1.21.8' # The Go version to download (if necessary) and use.
# - name: Install dependencies
# run: |
# go version
Expand All @@ -29,7 +29,7 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.31
version: v1.57.2
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true
# Run build of the application
Expand All @@ -39,22 +39,3 @@ jobs:
# Run testing on the code
- name: Run testing
run: make test
#
#
# # The "deploy" workflow
# deploy:
# # The type of runner that the job will run on
# runs-on: ubuntu-latest
# needs: [build] # Only run this workflow when "build" workflow succeeds
# if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} # Only run this workflow if it is master branch on push event
# steps:
# - uses: actions/checkout@v2
#
# # Deploy to Docker registry
# - name: Deploy to Docker registry
# uses: docker/build-push-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: wilsontanwm/gosimple
# tag_with_ref: true
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .github/workflows/release.yml
name: goreleaser

on:
push:
# run only against tags
tags:
- "*"

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
18 changes: 11 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ linters-settings:
lll:
line-length: 140
goimports:
local-prefixes: github.com/avarabyeu/goRP/v5
local-prefixes: github.com/reportportal/goRP/v5
gocritic:
enabled-tags:
- performance
Expand All @@ -41,6 +41,16 @@ linters:
- testpackage
- nlreturn
- stylecheck
- exhaustivestruct
- exhaustruct
- varnamelen
- tagliatelle
- wrapcheck
- gomnd
- gci
- revive
- testableexamples
- depguard

#run:
# skip-dirs:
Expand All @@ -53,9 +63,3 @@ issues:
linters:
- gosec

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.15.x # use the fixed version to not introduce new linters unexpectedly
# prepare:
# - echo "here I can run custom commands, but no preparation needed for this repo"
22 changes: 15 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
builds:
- env:
- id: gorp
main: ./
binary: gorp
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm
- arm64
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- name_template: >-
{{- .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end -}}
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ script:
- make checkstyle build

after_success:
- curl --request POST "https://goreportcard.com/checks" --data "repo=github.com/avarabyeu/goRP"
- curl --request POST "https://goreportcard.com/checks" --data "repo=github.com/reportportal/goRP"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG dockerTag
RUN echo $dockerTag | awk -F"v" '{ print $2 }' > version
RUN cat ./version

RUN version=$(cat version) && curl -L >gorp.tar.gz https://github.com/avarabyeu/goRP/releases/download/$dockerTag/goRP_${version}_linux_amd64.tar.gz \
RUN version=$(cat version) && curl -L >gorp.tar.gz https://github.com/reportportal/goRP/releases/download/$dockerTag/goRP_${version}_linux_amd64.tar.gz \
&& tar -xzvf gorp.tar.gz -C /usr/bin \
&& rm gorp.tar.gz

Expand Down
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.DEFAULT_GOAL := build

BUILD_DATE = `date +%FT%T%z`

GO = go
BINARY_DIR=bin

Expand All @@ -17,11 +15,7 @@ help:
@echo "checkstyle - gofmt+golint+misspell"

init-deps:
# installs gometalinter
# curl -L https://git.io/vp6lP | sh
# gometalinter --install
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.31.0

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.2

#vendor:
# dep ensure --vendor-only
Expand All @@ -30,19 +24,18 @@ test:
$(GO) test -cover ${GODIRS_NOVENDOR}

lint:
golangci-lint run --enable-all --deadline 10m ./...
bin/golangci-lint run ./...

fmt:
gofumpt -extra -l -w -s ${GOFILES_NOVENDOR}
gofumports -local -l -w ${GOFILES_NOVENDOR}
gci -local github.com/avarabyeu/goRP/v5 -w ${GOFILES_NOVENDOR}
gofumpt -extra -l -w ${GOFILES_NOVENDOR}
gci write --section Standard --section Default --section "Prefix(github.com/reportportal/goRP/v5)" ${GOFILES_NOVENDOR}

#build: checkstyle test
build:
$(GO) build ${BUILD_INFO_LDFLAGS} -o ${BINARY_DIR}/gorp ./

cross-build:
gox ${BUILD_INFO_LDFLAGS} -arch="amd64 386" -os="linux windows darwin" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
gox ${BUILD_INFO_LDFLAGS} -arch="amd64 arm64" -os="linux windows darwin" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}" ./cmd/gorp

clean:
if [ -d ${BINARY_DIR} ] ; then rm -r ${BINARY_DIR} ; fi
Expand Down
86 changes: 74 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,105 @@
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/avarabyeu/goRP/Build)
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/eBay/fabio/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/avarabyeu/goRP)](https://goreportcard.com/report/github.com/avarabyeu/goRP)
![Build Status](https://github.com/reportportal/goRP/workflows/Build/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/reportportal/goRP)](https://goreportcard.com/report/github.com/reportportal/goRP)
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/reportportal/goRP/master/LICENSE)
[![Release](https://img.shields.io/github/release/reportportal/goRP.svg)](https://github.com/reportportal/goRP/releases/latest)
[![GitHub Releases Stats of goRP](https://img.shields.io/github/downloads/reportportal/goRP/total.svg?logo=github)](https://somsubhra.github.io/github-release-stats/?username=reportportal&repository=gorP)

# goRP

Golang Client and CLI Utility for [ReportPortal](https://reportportal.io)

## Installation

- Via Go Install
```sh
go install github.com/reportportal/goRP@latest
```
- Via cURL (passing version and arch)
```sh
curl -sL https://github.com/avarabyeu/goRP/releases/download/v5.0.2/goRP_5.0.2_darwin_amd64.tar.gz | tar zx -C .
```
- Via cURL (latest one)
```sh
curl -s https://api.github.com/repos/reportportal/goRP/releases/latest | \
jq -r '.assets[] | select(.name | contains ("tar.gz")) | .browser_download_url' | \
grep "$(uname)_$(arch)" | \
xargs curl -sL | tar zx -C .
```
## Usage

```
gorp [global options] command [command options] [arguments...]

COMMANDS:
launch Operations over launches
help, h Shows a list of commands or help for one command
launch Operations over launches
report Reports input to report portal
init Initializes configuration cache
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
-u value, --uuid value Access Token [$GORP_UUID]
-p value, --project value ReportPortal Project Name [$GORP_PROJECT]
--uuid value, -u value Access Token [$GORP_UUID]
--project value, -p value ReportPortal Project Name [$GORP_PROJECT]
--host value ReportPortal Server Name
--help, -h show help
--version, -v print the version
--help, -h show help (default: false)
--version, -v print the version (default: false)
```

### Init command

NAME:
gorp init - Initializes configuration cache
USAGE:
gorp init [command options] [arguments...]
OPTIONS:
--help, -h show help (default: false)

### Launch command

```
USAGE:
goRP launch command [command options] [arguments...]

COMMANDS:
list List launches
list List launches
merge Merge Launches
help, h Shows a list of commands or help for one command
```

#### List Launches

```
USAGE:
goRP launch list [command options] [arguments...]

OPTIONS:
--fn value, --filter-name value Filter Name [$FILTER_NAME]
-f value, --filter value Filter [$Filter]
--filter-name value, --fn value Filter Name [$FILTER_NAME]
--filter value, -f value Filter [$Filter]
--help, -h show help (default: false)
```

### Report command

NAME:
goRP report - Reports input to report portal
USAGE:
goRP report command [command options] [arguments...]
COMMANDS:
test2json Input format: test2json
help, h Shows a list of commands or help for one command
OPTIONS:
--help, -h show help (default: false)


## Using as Golang Test Results Agent
Run tests with JSON output
```
go test -json ./... > results.txt
```
Report The results
```
gorp report test2json -f results.txt
```
Report directly from go test output
```
go test -json ./... | gorp report test2json
```
Loading
Loading