Skip to content

Commit

Permalink
Prepare v0.9.0 (#59)
Browse files Browse the repository at this point in the history
* update dependencies to latest versions

* update ci config

* add goreleaser

* updated changelog and readme

* update docker image for goreleaser
  • Loading branch information
psampaz authored Feb 19, 2023
1 parent 32fc7a3 commit 359c31c
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 58 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,45 @@ jobs:
name: golangci-lint
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.37.1
version: v1.50.1
docker:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.20.x]
platform: [ubuntu-latest]
name: docker
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- run: |
go build -o go-mod-outdated main.go
docker build -t psampaz/go-mod-outdated .
go list -u -m -json all | docker run --rm -i psampaz/go-mod-outdated
tests:
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
go-version: [1.19.x, 1.20.x]
platform: [ubuntu-latest, macos-latest]
name: tests
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- run: |
go get github.com/mfridman/tparse
go install github.com/mfridman/tparse@latest
go test -v -race -cover -json ./... | $(go env GOPATH)/bin/tparse -all
- run: |
go install
Expand All @@ -57,15 +58,15 @@ jobs:
coverage:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.20.x]
platform: [ubuntu-latest]
name: coverage
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
vendor
go-mod-outdated
go-mod-outdated
dist
33 changes: 15 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,16 @@ linters-settings:
- wrapperFunc

linters:
enable-all: true
disable:
- maligned
- prealloc
- gochecknoglobals
- gofmt
- godot
- nlreturn
- gofumpt
- gci
- goerr113
- exhaustivestruct
- paralleltest
- errorlint
- thelper
- wrapcheck
- nestif
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- revive

run:
skip-dirs:
Expand All @@ -69,11 +62,15 @@ issues:
- text: "weak cryptographic primitive"
linters:
- gosec
- text: "fieldalignment: struct with"
linters:
- govet

exclude-use-default: false

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.31.x # use the fixed version to not introduce new linters unexpectedly
golangci-lint-version: 1.50.1 # use the fixed version to not introduce new linters unexpectedly
prepare:
- echo "here I can run custom commands, but no preparation needed for this repo"
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download
builds:
-
ldflags:
-s -w
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
dockers:
-
goos: linux
goarch: amd64
image_templates:
- "psampaz/go-mod-outdated:latest"
- "psampaz/go-mod-outdated:{{ .Tag }}"
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [ΝΕΧΤ] ΧΧΧΧ-ΧΧ-ΧΧ
## [0.9.0] 2023-02-19
### Added

- Goreleaser
- Tests for Go 1.19 and 1.20
### Changed
- Skip rendering the table if there are no updates to display https://github.com/psampaz/go-mod-outdated/pull/46

- Updated dependencies to latest versions
- Update ci config
### Removed
- Tests for Go 1.16 and 1.17

## [0.8.0] 2021-04-12
### Added
Expand Down
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM golang:1.17.8-alpine3.15
FROM golang:1.20.1-alpine3.17
RUN apk update
RUN apk add --no-cache git
WORKDIR /home
COPY ./ .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o go-mod-outdated .

FROM scratch
WORKDIR /home/
COPY --from=0 /home/go-mod-outdated .
ENTRYPOINT ["./go-mod-outdated"]
COPY go-mod-outdated /usr/bin/
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["go-mod-outdated"]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gorelease-dry:
goreleaser --snapshot --skip-publish --clean
gorelease:
goreleaser release
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,12 @@ there is a fully automated way to detect breaking changes in a codebase, a good
tests and avoid dependencies on modules not well maintained and documented.


## Supported Go versions
## Supported (tested) Go versions

- 1.13.x
- 1.14.x
- 1.15.x
- 1.19.x
- 1.20.x

## Supported operating systems
## Supported (tested) operating systems

- linux
- osx
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/psampaz/go-mod-outdated

go 1.17
go 1.18

require github.com/olekukonko/tablewriter v0.0.5

require (
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
)
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
)
6 changes: 5 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
14 changes: 7 additions & 7 deletions internal/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"errors"
"io"
"io/ioutil"
"os"
"testing"

"github.com/psampaz/go-mod-outdated/internal/runner"
Expand All @@ -27,10 +27,10 @@ func TestRun(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
var gotOut bytes.Buffer

inBytes, _ := ioutil.ReadFile("testdata/in.txt")
inBytes, _ := os.ReadFile("testdata/in.txt")
in := bytes.NewBuffer(inBytes)

outBytes, _ := ioutil.ReadFile(tt.expectedOutput)
outBytes, _ := os.ReadFile(tt.expectedOutput)
wantOut := bytes.NewBuffer(outBytes)

err := runner.Run(in, &gotOut, false, false, false, tt.style)
Expand All @@ -47,7 +47,7 @@ func TestRun(t *testing.T) {
}

func TestRunNoUpdatesCase(t *testing.T) {
inBytes, err := ioutil.ReadFile("testdata/no_direct_updates.json")
inBytes, err := os.ReadFile("testdata/no_direct_updates.json")
if err != nil {
t.Errorf("Failed to read input file: %s", err)
}
Expand All @@ -69,7 +69,7 @@ func TestRunNoUpdatesCase(t *testing.T) {
func TestRunWithError(t *testing.T) {
var out bytes.Buffer

inBytes, _ := ioutil.ReadFile("testdata/err.txt")
inBytes, _ := os.ReadFile("testdata/err.txt")
in := bytes.NewBuffer(inBytes)

err := runner.Run(in, &out, false, false, false, runner.StyleDefault)
Expand All @@ -82,7 +82,7 @@ func TestRunWithError(t *testing.T) {
func TestRunExitWithNonZero(t *testing.T) {
var out bytes.Buffer

inBytes, _ := ioutil.ReadFile("testdata/in.txt")
inBytes, _ := os.ReadFile("testdata/in.txt")
in := bytes.NewBuffer(inBytes)

oldOsExit := runner.OsExit
Expand All @@ -108,7 +108,7 @@ func TestRunExitWithNonZero(t *testing.T) {
}

func TestRunExitWithNonZeroIndirectsOnly(t *testing.T) {
inBytes, _ := ioutil.ReadFile("testdata/update_indirect.txt")
inBytes, _ := os.ReadFile("testdata/update_indirect.txt")
in := bytes.NewBuffer(inBytes)

oldOsExit := runner.OsExit
Expand Down

0 comments on commit 359c31c

Please sign in to comment.