Skip to content

Commit bcd9b51

Browse files
authored
Setup GitHub Action for build and release (#21)
Add initial GitHub actions to replace Travis CI
1 parent a7b9c06 commit bcd9b51

File tree

5 files changed

+132
-3
lines changed

5 files changed

+132
-3
lines changed

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release workflow for tagged versions
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/tags
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Install Golang
12+
uses: actions/setup-go@v2
13+
with:
14+
go-version: 1.16.x
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
- name: Setup Dependencies
18+
run: |
19+
go get github.com/mitchellh/gox
20+
go get github.com/golang/mock/gomock
21+
go install github.com/golang/mock/mockgen
22+
- name: Check Format
23+
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
24+
if: matrix.os == 'ubuntu-latest'
25+
- name: Build
26+
run: |
27+
go build ./...
28+
- name: Generate
29+
run: go generate ./...
30+
- name: Test
31+
run: go test -v -race ./...
32+
- name: Build Binaries
33+
run: gox -osarch="darwin/amd64 windows/amd64 linux/amd64 linux/arm" -output="bundle-helper.{{.OS}}.{{.Arch}}" -verbose ./cmd/cli
34+
- name: Create Release
35+
id: create_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
39+
with:
40+
tag_name: ${{ github.ref }}
41+
release_name: Release ${{ github.ref }}
42+
draft: false
43+
prerelease: false
44+
- name: Upload Windows Release Asset
45+
id: upload-release-asset
46+
uses: actions/upload-release-asset@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
51+
asset_path: ./bundle-helper.windows.amd64.exe
52+
asset_name: bundle-helper.windows.amd64.exe
53+
asset_content_type: application/octet-stream
54+
- name: Upload Linux amd64 Release Asset
55+
id: upload-release-asset
56+
uses: actions/upload-release-asset@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
61+
asset_path: ./bundle-helper.linux.amd64
62+
asset_name: bundle-helper.linux.amd64
63+
asset_content_type: application/octet-stream
64+
- name: Upload Linux arm Release Asset
65+
id: upload-release-asset
66+
uses: actions/upload-release-asset@v1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
71+
asset_path: ./bundle-helper.linux.arm
72+
asset_name: bundle-helper.linux.arm
73+
asset_content_type: application/octet-stream
74+
- name: Upload Darwin amd64 Release Asset
75+
id: upload-release-asset
76+
uses: actions/upload-release-asset@v1
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
with:
80+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
81+
asset_path: ./bundle-helper.darwin.amd64
82+
asset_name: bundle-helper.darwin.amd64
83+
asset_content_type: application/octet-stream

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Testing workflows for aws-robomaker-bundle-support-library
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
schedule:
9+
- cron: '0 0 * * *'
10+
jobs:
11+
test:
12+
env:
13+
GO111MODULE: on
14+
strategy:
15+
matrix:
16+
go-version: [ 1.15.x, 1.16.x ]
17+
os: [ ubuntu-latest, macos-latest ]
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- name: Install Golang
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: ${{ matrix.go-version }}
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
- name: Setup Dependencies
27+
run: |
28+
go get github.com/mitchellh/gox
29+
go get github.com/golang/mock/gomock
30+
go install github.com/golang/mock/mockgen
31+
- name: Check Format
32+
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
33+
if: matrix.os == 'ubuntu-latest'
34+
- name: Build
35+
run: |
36+
go build ./...
37+
- name: Generate
38+
run: go generate ./...
39+
- name: Test
40+
run: go test -v -race ./...

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.11
44

55
require (
66
github.com/aws/aws-sdk-go v1.19.11
7-
github.com/golang/mock v1.2.0
7+
github.com/golang/mock v1.4.4
88
github.com/google/uuid v1.1.1
99
github.com/mitchellh/gox v1.0.0 // indirect
1010
github.com/stretchr/testify v1.3.0

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
44
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
55
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
66
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
7+
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
8+
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
79
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
810
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
911
github.com/hashicorp/go-version v1.0.0 h1:21MVWPKDphxa7ineQQTrCU5brh7OuVVAzGOCnnCPtE8=
@@ -22,8 +24,12 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
2224
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
2325
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
2426
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
27+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
2528
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
2629
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
30+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
2731
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
2832
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
2933
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
34+
golang.org/x/tools v0.0.0-20190425150028-36563e24a262 h1:qsl9y/CJx34tuA7QCPNp86JNJe4spst6Ff8MjvPUdPg=
35+
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=

pkg/bundle/provider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
package bundle
55

6-
//go:generate mockgen -destination=mock_cache.go -package=bundle github.com/aws-robotics/aws-robomaker-bundle-support-library/pkg/bundle Cache
7-
//go:generate mockgen -destination=mock_extractor.go -package=bundle github.com/aws-robotics/aws-robomaker-bundle-support-library/pkg/bundle Extractor
6+
//go:generate mockgen -destination=mock_cache.go -self_package=github.com/aws-robotics/aws-robomaker-bundle-support-library/pkg/bundle -package=bundle github.com/aws-robotics/aws-robomaker-bundle-support-library/pkg/bundle Cache
7+
//go:generate mockgen -destination=mock_extractor.go -self_package=github.com/aws-robotics/aws-robomaker-bundle-support-library/pkg/bundle -package=bundle github.com/aws-robotics/aws-robomaker-bundle-support-library/pkg/bundle Extractor
88

99
import (
1010
"fmt"

0 commit comments

Comments
 (0)