Skip to content

Commit

Permalink
Merge pull request #383 from segmentio/mckern/what-if
Browse files Browse the repository at this point in the history
What If... our Go dependencies were current?
  • Loading branch information
mckern authored May 10, 2023
2 parents 85c5971 + b345a92 commit d554ab6
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 157 deletions.
93 changes: 46 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Test & Build
on:
push:
Expand All @@ -11,70 +10,70 @@ jobs:
install-go-modules:
strategy:
matrix:
go: ['1.20.x', '1.19.x', '1.18.x', '1.17.x', '1.16.x']
go: ["1.20.x", "1.19.x"]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Test install Go modules for v${{ matrix.go }}
run: go install -v . && chamber version
- name: Test install Go modules for v${{ matrix.go }}
run: go install -v . && chamber version

test:
strategy:
matrix:
go: ['1.20.x', '1.19.x', '1.18.x', '1.17.x', '1.16.x']
go: ["1.20.x", "1.19.x"]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Test
run: make test

- name: Check modules are tidy and checked in
run: |
export GO111MODULE=on
go mod tidy
if [ "$(git status --porcelain)" != "" ]; then
echo "git tree is dirty after tidying modules"
echo "ensure go.mod and go.sum are tidy"
git status
exit 1
fi
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Test
run: make test

- name: Check modules are tidy and checked in
run: |
export GO111MODULE=on
go mod tidy
if [ "$(git status --porcelain)" != "" ]; then
echo "git tree is dirty after tidying modules"
echo "ensure go.mod and go.sum are tidy"
git status
exit 1
fi
dist:
strategy:
matrix:
go: ['1.20.x', '1.19.x', '1.18.x', '1.17.x', '1.16.x']
go: ["1.20.x", "1.19.x"]
runs-on: ubuntu-latest
needs: test

steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Install nfpm, rpmbuild
run: sudo make -f Makefile.tools nfpm-debian rpmbuild-debian

- name: Make distributables
run: make -f Makefile.release dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: 'dist/*'
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Install nfpm, rpmbuild
run: sudo make -f Makefile.tools nfpm-debian rpmbuild-debian

- name: Make distributables
run: make -f Makefile.release dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: "dist/*"
105 changes: 52 additions & 53 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-[a-zA-Z0-9]+'
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]-[a-zA-Z0-9]+"

jobs:
dist:
strategy:
matrix:
go: ['1.19.x']
go: ["1.20.x"]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Install nfpm, rpmbuild
run: sudo make -f Makefile.tools nfpm-debian rpmbuild-debian
- name: Install nfpm, rpmbuild
run: sudo make -f Makefile.tools nfpm-debian rpmbuild-debian

- name: Make distributables
run: make -f Makefile.release dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: 'dist/*'
- name: Make distributables
run: make -f Makefile.release dist
- uses: actions/upload-artifact@v3
with:
name: dist
path: "dist/*"

publish-github-release:
runs-on: ubuntu-latest
Expand All @@ -37,54 +37,53 @@ jobs:
needs: dist

steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@v3
with:
name: dist
path: 'dist'

- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
dist/*
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: dist
path: "dist"

- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
dist/*
publish-dockerhub:
strategy:
matrix:
go: ['1.19.x']
go: ["1.20.x"]
runs-on: ubuntu-latest
needs: dist

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: dist
path: 'dist/*'
- uses: actions/download-artifact@v3
with:
name: dist
path: "dist/*"

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Release
run:
make -f Makefile.release publish-dockerhub
- name: Release
run: make -f Makefile.release publish-dockerhub
2 changes: 1 addition & 1 deletion cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/segmentio/chamber/v2/store"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

// deleteCmd represents the delete command
Expand Down
2 changes: 1 addition & 1 deletion cmd/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/pkg/errors"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/pkg/errors"
"github.com/segmentio/chamber/v2/environ"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

// When true, only use variables retrieved from the backend, do not inherit existing environment variables
Expand Down
2 changes: 1 addition & 1 deletion cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/pkg/errors"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
"gopkg.in/yaml.v3"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/segmentio/chamber/v2/store"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

// historyCmd represents the history command
Expand Down
2 changes: 1 addition & 1 deletion cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/segmentio/chamber/v2/store"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
"gopkg.in/yaml.v3"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/segmentio/chamber/v2/store"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

// listCmd represents the list command
Expand Down
2 changes: 1 addition & 1 deletion cmd/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/segmentio/chamber/v2/store"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/pkg/errors"
"github.com/segmentio/chamber/v2/store"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

// Regex's used to validate service and key names
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

// versionCmd represents the version command
Expand Down
2 changes: 1 addition & 1 deletion cmd/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/segmentio/chamber/v2/store"
"github.com/segmentio/chamber/v2/utils"
"github.com/spf13/cobra"
analytics "gopkg.in/segmentio/analytics-go.v3"
analytics "github.com/segmentio/analytics-go/v3"
)

var (
Expand Down
Loading

0 comments on commit d554ab6

Please sign in to comment.