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

Automate binary releases #437

Merged
merged 6 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt

## [Unreleased]

### 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])

### Changed

- suggest to use `go install` instead of the deprecated `go get` to install the `godog` binary ([449](https://github.com/cucumber/godog/pull/449) - [dmitris](https://github.com/dmitris))
Expand Down
4 changes: 2 additions & 2 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)

FOUND_GO_VERSION := $(shell go version)
EXPECTED_GO_VERSION = 1.17
Expand Down Expand Up @@ -58,7 +58,7 @@ 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 ..
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,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.

329 changes: 0 additions & 329 deletions _examples/api/go.sum

This file was deleted.

9 changes: 0 additions & 9 deletions _examples/assert-godogs/go.mod

This file was deleted.

329 changes: 0 additions & 329 deletions _examples/assert-godogs/go.sum

This file was deleted.

13 changes: 0 additions & 13 deletions _examples/custom-formatter/go.mod

This file was deleted.

5 changes: 4 additions & 1 deletion _examples/custom-formatter/godogs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func TestMain(m *testing.M) {
Options: &opts,
}.Run()

os.Exit(status)
// This example test is expected to fail to showcase custom formatting, suppressing status.
if status != 1 {
os.Exit(1)
}
}

func thereAreGodogs(available int) error {
Expand Down
10 changes: 0 additions & 10 deletions _examples/db/go.mod

This file was deleted.

Loading