From 27ae3f0d51d45a8c72582f06f7e5da7971111d95 Mon Sep 17 00:00:00 2001 From: Andrei Pohilko Date: Mon, 13 Jun 2022 19:19:38 +0100 Subject: [PATCH] Improve release process --- .github/workflows/go.yml | 11 +++-- .github/workflows/release.yml | 79 +++++++++++++++++++++++++++++++++-- README.md | 18 ++++---- cmd/encarno/main.go | 1 + go.sum | 24 ----------- 5 files changed, 92 insertions(+), 41 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 51bb2f2..e6acf8d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -30,9 +30,8 @@ jobs: - name: Test run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic - #- name: Upload coverage report - # uses: codecov/codecov-action@v1.0.2 - # with: - # #token: {{your codecov token, can be found at https://codecov.io/gh///settings/badge}} - # file: ./coverage.txt - # flags: unittests + - name: Upload coverage report + uses: codecov/codecov-action@v1.0.2 + with: + file: ./coverage.txt + flags: unittests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c6715e..e3ddc2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ # workflow name -name: Generate release-artifacts +name: Release # on events on: @@ -9,12 +9,20 @@ on: # workflow tasks jobs: - generate: - name: Generate cross-platform builds + binaries: + name: Cross-platform binaries runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v3.0.2 + + - name: Inject version + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: '0.0' + replace: ${{ github.ref_name }} + include: "cmd/encarno/main.go" + - name: Generate build files uses: crazy-max/ghaction-xgo@v2.0.0 with: @@ -47,3 +55,68 @@ jobs: build/${{ github.event.repository.name }}-windows-amd64.exe allowUpdates: 'true' token: ${{ secrets.GITHUB_TOKEN }} + + pypi: + name: PyPi module + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v3.0.2 + + - name: Inject version 1 + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: '"0.0"' + replace: ${{ github.ref_name }} + include: "taurus/encarno/__init__.py" + + - name: Inject version 2 + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: '"0.0"' + replace: ${{ github.ref_name }} + include: "taurus/setup.py" + + - name: Build package + run: cd taurus && python -m build && twine check dist/* + + - name: pypi-publish + uses: pypa/gh-action-pypi-publish@v1.5.0 + with: + packages_dir: taurus/dist + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + + docker: + name: Generate cross-platform builds + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v3.0.2 + + - name: Inject version + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: '0.0' + replace: ${{ github.ref_name }} + include: "Dockerfile" + + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: undera/encarno + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/README.md b/README.md index 0e73222..fef801b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ roughly "[I impersonate](#history)". ## Usage as Taurus Module -The easiest way to get started is to install [the Python package](https://pypi.org/project/encarno/) using `pip`, which will install also Taurus if needed (TODO: auto-release it): +The easiest way to get started is to install [the Python package](https://pypi.org/project/encarno/) using `pip`, which will install also Taurus if needed: ```shell pip install encarno @@ -33,7 +33,7 @@ To run the test, use the usual Taurus command-line with config files. See below bzt my-config-with-encarno.yml ``` -[Docker image](https://hub.docker.com/r/undera/encarno) is also available for containerized environments: (TODO auto-push it) +[Docker image](https://hub.docker.com/r/undera/encarno) is also available for containerized environments: ```shell docker run -it -v `pwd`:/conf undera/encarno /conf/config.yml @@ -271,7 +271,7 @@ protocol: ### Payload Input Format -The format is like that because of possible binary payloads. It starts with JSON line of metadata, ending with `\n`, then `PayloadLen` number of bytes, followed by any number of `\r` and/or `\n`. +The format is like that because of possible binary payloads. It starts with JSON line of metadata, ending with `\n`, then `PayloadLen` number of bytes, followed by any number of `\r`, `\n` or `\r\n`. ```text {"PayloadLen": 57, "Address": "http://localhost:8070", "Label": "/"} @@ -304,8 +304,7 @@ How more flexible it is for Hay and alikes ## History -It is written as a replacement for the old [phantom](https://github.com/yandex-load/phantom) -+[yandex-tank](https://github.com/yandex/yandex-tank) combination.Those were too "phantom" (and too unmaintained), we're +It is written as a replacement for the old [phantom](https://github.com/yandex-load/phantom)+[yandex-tank](https://github.com/yandex/yandex-tank) combination.Those were too "phantom" (and too unmaintained), we're trying to be "in flesh" analogue to it. The idea was to write a tool as precise as phantom, but using modern programming language (Go) and address wider spectrum of use-cases. @@ -315,6 +314,9 @@ we have lost some speed because of that (we believe not drastically). ## Changelog +### 0.2 -- 13 jun 2022 +* improve automated release process: pypi package, docker image + ### 0.1 -- 13 jun 2022 * add binary releases on GitHub * add documentation @@ -335,13 +337,13 @@ we have lost some speed because of that (we believe not drastically). - auto-release process, including pip - binary output writer&reader, including strings externalization, helper tools to translate into human-readable - scripting elements in input, whole scripting flow, asserts -- + - http://[::1]:8070/ - should work fine - respect `iterations` option from Taurus config, test it -- + - when workers decrease (input exhausted or panics), reflect that in counters - unit tests and coverage -- + - separate file for health status, with per-line flush? ### Parking lot diff --git a/cmd/encarno/main.go b/cmd/encarno/main.go index 4f16f29..574f9cd 100644 --- a/cmd/encarno/main.go +++ b/cmd/encarno/main.go @@ -23,6 +23,7 @@ func main() { } else { log.SetLevel(log.DebugLevel) } + log.Infof("Encarno v0.0") handleSignals() diff --git a/go.sum b/go.sum index f80ef4b..18baff2 100644 --- a/go.sum +++ b/go.sum @@ -6,35 +6,11 @@ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20220609121020-a51bd0440498 h1:TF0FvLUGEq/8wOt/9AV1nj6D4ViZGUIGCMQfCv7VRXY= golang.org/x/exp v0.0.0-20220609121020-a51bd0440498/go.mod h1:yh0Ynu2b5ZUe3MQfp2nM0ecK7wsgouWTDN0FNeJuIys= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=