Skip to content

Commit

Permalink
Automate release assets (#1)
Browse files Browse the repository at this point in the history
* Add release assets automation

* Use single module with local replace for examples

* Update CHANGELOG.md

* Allow expected failure for custom formatter example test

* Set version value with ldflags

* Update CHANGELOG.md
  • Loading branch information
vearutop authored Oct 21, 2021
1 parent 86a5635 commit 80f7137
Show file tree
Hide file tree
Showing 19 changed files with 121 additions and 1,388 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This script uploads application binaries as GitHub release assets.
name: release-assets
on:
release:
types:
- created
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
name: Upload Release Assets
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Checkout code
uses: actions/checkout@v2
- name: Build artifacts
run: |
make artifacts
- name: Upload linux amd64 binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./_artifacts/godog-${{ github.event.release.tag_name }}-linux-amd64.tar.gz
asset_name: godog-${{ github.event.release.tag_name }}-linux-amd64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload linux arm64 binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./_artifacts/godog-${{ github.event.release.tag_name }}-linux-arm64.tar.gz
asset_name: godog-${{ github.event.release.tag_name }}-linux-arm64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload darwin amd64 binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./_artifacts/godog-${{ github.event.release.tag_name }}-darwin-amd64.tar.gz
asset_name: godog-${{ github.event.release.tag_name }}-darwin-amd64.tar.gz
asset_content_type: application/tar+gzip
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt

---

## [v0.12.3]

### Added

- Automated binary releases with GitHub Actions ([437]((https://github.com/cucumber/godog/pull/437) - [vearutop])
- Automated binary versioning with `go install` ([437]((https://github.com/cucumber/godog/pull/437) - [vearutop])
- Module with local replace in examples ([437]((https://github.com/cucumber/godog/pull/437) - [vearutop])

## [v0.12.2]

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: test gherkin bump cover

VERS := $(shell grep 'const Version' -m 1 godog.go | awk -F\" '{print $$2}')
VERS ?= $(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)

test:
@echo "running all tests"
Expand Down Expand Up @@ -52,9 +52,9 @@ artifacts:

define _build
mkdir $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2
env GOOS=$1 GOARCH=$2 go build -o $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/godog ./cmd/godog
env GOOS=$1 GOARCH=$2 go build -ldflags "-X github.com/cucumber/godog.Version=$(VERS)" -o $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/godog ./cmd/godog
cp README.md $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/README.md
cp LICENSE $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/LICENSE
cd $(ARTIFACT_DIR) && tar -c --use-compress-program="pigz --fast" -f godog-$(VERS)-$1-$2.tar.gz godog-$(VERS)-$1-$2 && cd ..
rm -rf $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2
#rm -rf $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2
endef
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,20 @@ When automated testing is this much fun, teams can easily protect themselves fro
- [Gherkin Reference](https://cucumber.io/docs/gherkin/reference/)

## Install
```
go get github.com/cucumber/godog/cmd/godog@v0.12.0
```
Adding `@v0.12.0` will install v0.12.0 specifically instead of master.

Running `within the $GOPATH`, you would also need to set `GO111MODULE=on`, like this:
Godog can operate as a standalone CLI runner or as a library in context of `go test`.

You can download prebuilt binary from [releases](https://github.com/cucumber/godog/releases).

Or build and install it with Go.
```
GO111MODULE=on go get github.com/cucumber/godog/cmd/godog@v0.12.0
go install github.com/cucumber/godog/cmd/godog@latest
```
Using `@v0.12.0` instead of `@latest` will install v0.12.0 specifically instead of the latest available version.

## Contributions

Godog is a community driven Open Source Project within the Cucumber organization, it is maintained by a handfull of developers, but we appreciate contributions from everyone.
Godog is a community driven Open Source Project within the Cucumber organization, it is maintained by a handful of developers, but we appreciate contributions from everyone.

If you are interested in developing Godog, we suggest you to visit one of our slack channels.

Expand Down Expand Up @@ -243,7 +244,7 @@ godogs
- godogs_test.go
```

#### Step 6 - Add some logic to the step defintions
#### Step 6 - Add some logic to the step definitions

Now lets implement our step definitions to test our feature requirements:

Expand Down
2 changes: 1 addition & 1 deletion _examples/api/features/version.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Feature: get version
And the response should match json:
"""
{
"version": "v0.11.0"
"version": "v0.0.0-dev"
}
"""
5 changes: 0 additions & 5 deletions _examples/api/go.mod

This file was deleted.

Loading

0 comments on commit 80f7137

Please sign in to comment.