-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into saraj/ctx
- Loading branch information
Showing
23 changed files
with
331 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: golang | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- name: setup-go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: go build | ||
run: go build -o ./bin/sql-migrate ./sql-migrate && ./bin/sql-migrate --help | ||
- name: go test | ||
run: go test ./... | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- name: setup-go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.52.2 | ||
- name: go mod tidy | ||
run: go mod tidy | ||
- name: check for any changes | ||
run: | | ||
[[ $(git status --porcelain) == "" ]] || (echo "changes detected" && exit 1) | ||
integration: | ||
needs: | ||
- test | ||
- lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20'] | ||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: '1' | ||
MYSQL_ROOT_PASSWORD: '' | ||
MYSQL_DATABASE: 'test' | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
postgres: | ||
image: postgres:15 | ||
env: | ||
POSTGRES_PASSWORD: 'password' | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
env: | ||
MYSQL_HOST: '127.0.0.1' | ||
PGHOST: '127.0.0.1' | ||
PGUSER: 'postgres' | ||
PGPASSWORD: 'password' | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- name: setup-go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
cache: true | ||
cache-dependency-path: go.sum | ||
- name: setup databases | ||
run: | | ||
mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test;' | ||
mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test_env;' | ||
psql -U postgres -c 'CREATE DATABASE test;' | ||
- name: install sql-migrate | ||
run: go install ./... | ||
- name: postgres | ||
run: bash ./test-integration/postgres.sh | ||
- name: mysql | ||
run: bash ./test-integration/mysql.sh | ||
- name: mysql-flag | ||
run: bash ./test-integration/mysql-flag.sh | ||
- name: mysql-env | ||
run: bash ./test-integration/mysql-env.sh | ||
- name: sqlite | ||
run: bash ./test-integration/sqlite.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
|
||
/sql-migrate/test.db | ||
/test.db | ||
.vscode/ | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
linters-settings: | ||
gocritic: | ||
disabled-checks: | ||
- ifElseChain | ||
goimports: | ||
local-prefixes: github.com/rubenv/sql-migrate | ||
govet: | ||
enable-all: true | ||
disable: | ||
- fieldalignment | ||
depguard: | ||
list-type: blacklist | ||
include-go-root: true | ||
include-go-std-lib: true | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
nolintlint: | ||
allow-unused: false | ||
allow-leading-space: false | ||
allow-no-explanation: | ||
- depguard | ||
require-explanation: true | ||
require-specific: true | ||
revive: | ||
enable-all-rules: false | ||
rules: | ||
- name: atomic | ||
- name: blank-imports | ||
- name: bool-literal-in-expr | ||
- name: call-to-gc | ||
- name: constant-logical-expr | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: dot-imports | ||
- name: duplicated-imports | ||
- name: empty-block | ||
- name: empty-lines | ||
- name: error-naming | ||
- name: error-return | ||
- name: error-strings | ||
- name: errorf | ||
- name: exported | ||
- name: identical-branches | ||
- name: imports-blacklist | ||
- name: increment-decrement | ||
- name: indent-error-flow | ||
- name: modifies-parameter | ||
- name: modifies-value-receiver | ||
- name: package-comments | ||
- name: range | ||
- name: range-val-address | ||
- name: range-val-in-closure | ||
- name: receiver-naming | ||
- name: string-format | ||
- name: string-of-int | ||
- name: struct-tag | ||
- name: time-naming | ||
- name: unconditional-recursion | ||
- name: unexported-naming | ||
- name: unexported-return | ||
- name: superfluous-else | ||
- name: unreachable-code | ||
- name: var-declaration | ||
- name: waitgroup-by-value | ||
- name: unused-receiver | ||
- name: unnecessary-stmt | ||
- name: unused-parameter | ||
run: | ||
tests: true | ||
timeout: 1m | ||
linters: | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- depguard | ||
- errcheck | ||
- exhaustive | ||
- gocritic | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- govet | ||
- ineffassign | ||
- nolintlint | ||
- revive | ||
- staticcheck | ||
- typecheck | ||
- unused | ||
- whitespace | ||
- errorlint | ||
- gosimple | ||
- unparam | ||
issues: | ||
exclude: | ||
- 'declaration of "err" shadows declaration at' # Allow shadowing of `err` because it's so common | ||
- 'error-strings: error strings should not be capitalized or end with punctuation or a newline' | ||
max-same-issues: 10000 | ||
max-issues-per-linter: 10000 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.PHONY: test lint build | ||
|
||
test: | ||
go test ./... | ||
|
||
lint: | ||
golangci-lint run --fix --config .golangci.yaml | ||
|
||
build: | ||
mkdir -p bin | ||
go build -o ./bin/sql-migrate ./sql-migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.