Skip to content

Commit

Permalink
chore: update deps and tools
Browse files Browse the repository at this point in the history
  • Loading branch information
powerman committed May 29, 2021
1 parent 439cdef commit dd92f14
Show file tree
Hide file tree
Showing 24 changed files with 931 additions and 296 deletions.
32 changes: 7 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ setup_env: &setup_env
run:
name: Setup environment
command: |
env | sort > /tmp/env.old
export HADOLINT_VER=1.19.0
export SHELLCHECK_VER=0.7.1
env | sort > /tmp/env.new
! diff -u /tmp/env.old /tmp/env.new | sed -n '/^+[^+]/s/^./export /p' >> $BASH_ENV
env | grep _VER | sort > /tmp/tools.ver
test -d ~/.ssh || install -m 0700 -d ~/.ssh
test -f ~/.ssh/config || install -m 0600 /dev/null ~/.ssh/config
test -d /run/.ssh && sudo sh -c "cp /run/.ssh/* $HOME/.ssh/; chown -R circleci:circleci $HOME/.ssh" || true # For scripts/test-ci-circle.
Expand All @@ -24,7 +15,7 @@ setup_env: &setup_env
jobs:
test:
docker:
- image: "cimg/go:1.15"
- image: "cimg/go:1.16"
environment:
GOFLAGS: "-mod=readonly"
EXAMPLE_APIKEY_ADMIN: "admin"
Expand All @@ -39,38 +30,29 @@ jobs:
- *setup_env
- restore_cache:
keys:
- v2-{{ checksum "/tmp/tools.ver" }}-{{ checksum "go.mod" }}-{{ .Branch }}
- v2-{{ checksum "/tmp/tools.ver" }}-{{ checksum "go.mod" }}-
- v2-{{ checksum "/tmp/tools.ver" }}-
- run:
name: Install tools
command: |
GO111MODULE=off go get -u github.com/myitcv/gobin
hadolint --version | tee /dev/stderr | grep -wq v$HADOLINT_VER ||
curl -sSfL https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VER}/hadolint-$(uname)-x86_64 | install /dev/stdin $(go env GOPATH)/bin/hadolint
shellcheck --version | tee /dev/stderr | grep -wq $SHELLCHECK_VER ||
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VER}/shellcheck-v${SHELLCHECK_VER}.$(uname).x86_64.tar.xz | tar xJf - -C $(go env GOPATH)/bin --strip-components=1 shellcheck-v${SHELLCHECK_VER}/shellcheck
- v3-{{ checksum "go.mod" }}-{{ .Branch }}
- v3-{{ checksum "go.mod" }}-
- v3-
- run: scripts/test
- run:
name: Ensure API spec match auto-generated code
command: |
go generate ./api/...
git add . && git status --short && git diff-index --quiet HEAD
- run: scripts/test
- run:
name: Report code coverage
command: |
scripts/cover
# gobin -m -run github.com/mattn/goveralls -coverprofile=cover.out -service=CircleCI
# .gobincache/goveralls -coverprofile=cover.out -service=CircleCI
- save_cache:
when: always
key: v2-{{ checksum "/tmp/tools.ver" }}-{{ checksum "go.mod" }}-{{ .Branch }}
key: v3-{{ checksum "go.mod" }}-{{ .Branch }}
paths:
- ~/go/bin/
- ~/go/pkg/
- ~/go/src/
- ~/.cache/go-build/
- ~/.cache/golangci-lint/
- ~/.cache/gobin/
- .gobincache/

workflows:
Expand Down
27 changes: 6 additions & 21 deletions .github/workflows/CI&CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: master

env:
GO_VERSION: '^1.15.2'
GO_VERSION: '^1.16'
GOFLAGS: '-mod=readonly'

jobs:
Expand All @@ -22,10 +22,8 @@ jobs:
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
ports:
- 3306:3306
- '3306:3306'
env:
HADOLINT_VER: '1.19.0'
SHELLCHECK_VER: '0.7.1'
EXAMPLE_APIKEY_ADMIN: 'admin'
EXAMPLE_MYSQL_ADDR_HOST: 'localhost'
EXAMPLE_MYSQL_AUTH_LOGIN: 'root'
Expand All @@ -37,10 +35,6 @@ jobs:

- uses: actions/checkout@v2

- name: Setup
run: |
env | grep _VER | sort > /tmp/tools.ver
- uses: actions/cache@v2
with:
path: |
Expand All @@ -49,34 +43,25 @@ jobs:
~/go/src
~/.cache/go-build
~/.cache/golangci-lint
~/.cache/gobin
.gobincache
key: v2-test-${{ runner.os }}-${{ hashFiles('/tmp/tools.ver') }}-${{ hashFiles('go.mod') }}
key: v3-test-${{ runner.os }}-${{ hashFiles('go.mod') }}
restore-keys: |
v2-test-${{ runner.os }}-${{ hashFiles('/tmp/tools.ver') }}-
v3-test-${{ runner.os }}-
- name: Install tools
run: |
GO111MODULE=off go get -u github.com/myitcv/gobin
hadolint --version | tee /dev/stderr | grep -wq v$HADOLINT_VER ||
curl -sSfL https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VER}/hadolint-$(uname)-x86_64 | install /dev/stdin $(go env GOPATH)/bin/hadolint
shellcheck --version | tee /dev/stderr | grep -wq $SHELLCHECK_VER ||
curl -sSfL https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VER}/shellcheck-v${SHELLCHECK_VER}.$(uname).x86_64.tar.xz | tar xJf - -C $(go env GOPATH)/bin --strip-components=1 shellcheck-v${SHELLCHECK_VER}/shellcheck
- run: scripts/test

- name: Ensure API spec match auto-generated code
run: |
go generate ./api/...
git add . && git status --short && git diff-index --quiet HEAD
- run: scripts/test

- name: Report code coverage
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
if: env.COVERALLS_TOKEN
run: |
scripts/cover
gobin -m -run github.com/mattn/goveralls -coverprofile=cover.out -service=GitHub
.gobincache/goveralls -coverprofile=cover.out -service=GitHub
build-and-release:
needs: test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Create-GitHub-Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v0.4.4
uses: metcalfc/changelog-generator@v1.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Generate-TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: technote-space/toc-generator@v3
- uses: technote-space/toc-generator@v4
Loading

0 comments on commit dd92f14

Please sign in to comment.