diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 5b01af2..ceb35b0 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14ee263..0e70ec0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file + 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/*/} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bb3e505 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/Makefile b/Makefile index 2e6a8fc..e4225cd 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/README.md b/README.md index 46a9453..b71b8a5 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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=`. + +## Usage + ### CLI Now, after reading [TestCaseID issue](#TestCaseID_issue) you grasp how to prepare your code for conversion. Below is a basic CLI run. @@ -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