Skip to content

Commit

Permalink
Merge pull request #5 from Moon1706/develop
Browse files Browse the repository at this point in the history
feat: add docker
  • Loading branch information
Moon1706 authored Feb 12, 2024
2 parents 6995e73 + ccb5a77 commit bc68eb8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: actions/setup-go@v1
with:
go-version: 1.21
- name: Test
run: make test
- name: "Fmt, Vet, and Build"
- name: Coverage
run: make coverage
- name: "Build"
run: make bin
20 changes: 16 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Download code
uses: actions/checkout@master
- name: Setup Go
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: 1.21
- name: GoReleaser
- name: Release Golang package
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
push: true
tags: github.com/Moon1706/ginkgo2allure:${GITHUB_REF#refs/*/}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.21 as build
ENV CGO_ENABLED=0
WORKDIR /src
COPY . .
RUN make bin

FROM alpine:3.19
COPY --from=build /src/bin/ginkgo2allure /bin/ginkgo2allure
ENTRYPOINT ["/bin/ginkgo2allure"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export GO111MODULE=on

.PHONY: bin
bin: fmt vet
go build -o bin/ginkgo2allure github.com/Moon1706/ginkgo2allure
bin:
go build -o bin/ginkgo2allure .

.PHONY: fmt
fmt:
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

CLI and library that are used to convert Ginkgo JSON reports into Allure JSON reports. Globally used for E2E and integration testing.

## Usage
>NOTE: Was tested only for Ginkgo version `>=v2.3.0`.
## Presettings

### TestCaseID issue

Expand Down Expand Up @@ -81,6 +83,12 @@ func TestRunner(t *testing.T) {

As you can see, we use the basic Ginkgo `Fail` handler, which indeed doesn't have a lot of really important information for us (for instance, expect and actual values in a Gomega assert function). However, for compatibility, it was decided to stay with this handler and parse explicit trace output. It's a bad approach, but it will close most test cases. For you, it means that if you find any problems with this functionality, please inform me in Issue and disable it with the flag `--analyze_errors`.

### Test description

If you check [the official Ginko documentation](https://onsi.github.io/ginkgo/#adding-specs-to-a-suite), you will see that Ginkgo `Describe + Context (second Describe) + It` form simple English sentences. `Categorizing books with more than 300 pages should be a novel`. That's a basic naming rule in tests. Therefore, I decided to use this approach to write down the default description of the test case in Allure. However, I also offer the opportunity to create your own description; just append an additional label to `It`: `description=<your describe>`.

## Usage

### CLI

Now, after reading [TestCaseID issue](#TestCaseID_issue) you grasp how to prepare your code for conversion. Below is a basic CLI run.
Expand Down Expand Up @@ -128,10 +136,18 @@ var _ = ReportAfterSuite("allure report", func(report types.Report) {

## Build

### Go code

```sh
make bin
```

### Docker image

```sh
docker build -t ginkgo2allure:v0.0.1 .
```

## Test

```sh
Expand Down

0 comments on commit bc68eb8

Please sign in to comment.