Skip to content

Commit b912ce7

Browse files
committed
Merge branch 'master' of github.com:golang-migrate/migrate into ib
* 'master' of github.com:golang-migrate/migrate: (418 commits) Run gofmt on internal build dir go mod tidy Resolves golang-migrate#647 - Fixes typos in Mongo advisory locking parameters (golang-migrate#648) Bump version of autorest/adal Set syntax highlighting for pkger example Add pkger to README change github auth to use oauth token instead of basic. Use the recommended v4 in mysql README go mod tidy fix test Delete all rows Use ParseBool Support for AWS Keyspaces Update gosnowflake from v1.4.3 to v1.6.3 Update docker client usage with breaking change Update dktest to v0.3.7 to fix security warnings revert binary file location change in docker image fix source/file driver Update build constraints Update golangci-lint config ...
2 parents c2c9739 + cf68462 commit b912ce7

File tree

301 files changed

+15788
-3072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+15788
-3072
lines changed

.circleci/config.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Golang CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-go/ for more details
4+
version: 2.1
5+
6+
jobs:
7+
"golang-1_15": &template
8+
machine:
9+
# https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
10+
image: ubuntu-2004:202010-01
11+
# docker_layer_caching: true
12+
13+
# https://circleci.com/docs/2.0/configuration-reference/#resource_class
14+
resource_class: medium
15+
16+
# Leave working directory unspecified and use defaults:
17+
# https://circleci.com/blog/go-v1.11-modules-and-circleci/
18+
# working_directory: /go/src/github.com/golang-migrate/migrate
19+
20+
environment:
21+
GO111MODULE: "on"
22+
GO_VERSION: "1.15.x"
23+
24+
steps:
25+
# - setup_remote_docker:
26+
# version: 19.03.13
27+
# docker_layer_caching: true
28+
- run: curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
29+
- run: curl -sfL -o ~/bin/golangci-lint.sh https://install.goreleaser.com/github.com/golangci/golangci-lint.sh
30+
- run: chmod +x ~/bin/gimme ~/bin/golangci-lint.sh
31+
- run: eval "$(gimme $GO_VERSION)"
32+
- run: golangci-lint.sh -b ~/bin v1.37.0
33+
- checkout
34+
- restore_cache:
35+
keys:
36+
- go-mod-v1-{{ arch }}-{{ checksum "go.sum" }}
37+
- run: golangci-lint run
38+
- run: make test COVERAGE_DIR=/tmp/coverage
39+
- save_cache:
40+
key: go-mod-v1-{{ arch }}-{{ checksum "go.sum" }}
41+
paths:
42+
- "/go/pkg/mod"
43+
- run: go get github.com/mattn/goveralls
44+
- run: goveralls -service=circle-ci -coverprofile /tmp/coverage/combined.txt
45+
46+
"golang-1_16":
47+
<<: *template
48+
environment:
49+
GO_VERSION: "1.16.x"
50+
51+
workflows:
52+
version: 2
53+
build:
54+
jobs:
55+
- "golang-1_15"
56+
- "golang-1_16"

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
FAQ.md
33
README.md
44
LICENSE
5-
Makefile
65
.gitignore
76
.travis.yml
87
CONTRIBUTING.md

.github/ISSUE_TEMPLATE/bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ e.g. s3, github, go-bindata, gcs, file
2525
Obtained by running: `migrate -help`
2626

2727
**Loaded Database Drivers**
28-
e.g. spanner, stub, clickhouse, cockroachdb, crdb-postgres, postgres, postgresql, redshift, cassandra, cockroach, mysql
28+
e.g. spanner, stub, clickhouse, cockroachdb, crdb-postgres, postgres, postgresql, pgx, redshift, cassandra, cockroach, mysql
2929
Obtained by running: `migrate -help`
3030

3131
**Go Version**

.github/workflows/ci.yaml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: golangci-lint
14+
uses: golangci/golangci-lint-action@v2
15+
16+
test:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
go: ["1.16.x", "1.17.x"]
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- uses: actions/setup-go@v2
25+
with:
26+
go-version: ${{ matrix.go }}
27+
28+
- name: Run test
29+
run: make test COVERAGE_DIR=/tmp/coverage
30+
31+
- name: Send goveralls coverage
32+
uses: shogo82148/actions-goveralls@v1
33+
with:
34+
path-to-profile: /tmp/coverage/combined.txt
35+
flag-name: Go-${{ matrix.go }}
36+
parallel: true
37+
38+
check-coverage:
39+
name: Check coverage
40+
needs: [test]
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: shogo82148/actions-goveralls@v1
44+
with:
45+
parallel-finished: true
46+
47+
goreleaser:
48+
name: Release a new version
49+
needs: [lint, test]
50+
runs-on: ubuntu-latest
51+
environment: GoReleaser
52+
# This job only runs when
53+
# 1. When the previous `lint` and `test` jobs has completed successfully
54+
# 2. When the repository is not a fork, i.e. it will only run on the official golang-migrate/migrate
55+
# 3. When the workflow is triggered by a tag with `v` prefix
56+
if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }}
57+
steps:
58+
- uses: actions/checkout@v2
59+
with:
60+
fetch-depth: 0
61+
- uses: ruby/setup-ruby@v1
62+
with:
63+
ruby-version: 2.7
64+
- uses: actions/setup-go@v2
65+
with:
66+
go-version: "1.17.x"
67+
68+
- uses: docker/setup-qemu-action@v1
69+
- uses: docker/setup-buildx-action@v1
70+
- uses: docker/login-action@v1
71+
with:
72+
username: golangmigrate
73+
password: ${{ secrets.DOCKERHUB_TOKEN }}
74+
75+
- run: echo "SOURCE=$(make echo-source)" >> $GITHUB_ENV
76+
- run: echo "DATABASE=$(make echo-database)" >> $GITHUB_ENV
77+
78+
- uses: goreleaser/goreleaser-action@v2
79+
with:
80+
version: latest
81+
args: release --rm-dist
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- run: gem install package_cloud
86+
- run: package_cloud push golang-migrate/migrate/ubuntu/bionic dist/migrate.linux-amd64.deb
87+
env:
88+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
89+
- run: package_cloud push golang-migrate/migrate/ubuntu/focal dist/migrate.linux-amd64.deb
90+
env:
91+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
92+
- run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb
93+
env:
94+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
95+
- run: package_cloud push golang-migrate/migrate/debian/bullseye dist/migrate.linux-amd64.deb
96+
env:
97+
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
.idea
21
.DS_Store
32
cli/build
43
cli/cli
54
cli/migrate
65
.coverage
76
.godoc.pid
87
vendor/
8+
.vscode/
9+
.idea
10+
dist/

.golangci.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
run:
2+
# timeout for analysis, e.g. 30s, 5m, default is 1m
3+
timeout: 5m
4+
linters:
5+
enable:
6+
#- golint
7+
- interfacer
8+
- unconvert
9+
#- dupl
10+
- goconst
11+
- gofmt
12+
- misspell
13+
- unparam
14+
- nakedret
15+
- prealloc
16+
#- gosec
17+
linters-settings:
18+
misspell:
19+
locale: US
20+
issues:
21+
max-same-issues: 0
22+
max-issues-per-linter: 0
23+
exclude-use-default: false
24+
exclude:
25+
# gosec: Duplicated errcheck checks
26+
- G104

.goreleaser.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
project_name: migrate
2+
before:
3+
hooks:
4+
- go mod tidy
5+
builds:
6+
- env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- linux
10+
- windows
11+
- darwin
12+
goarch:
13+
- amd64
14+
- arm
15+
- arm64
16+
- 386
17+
goarm:
18+
- 7
19+
main: ./cmd/migrate
20+
ldflags:
21+
- '-w -s -X main.Version={{ .Version }} -extldflags "static"'
22+
flags:
23+
- "-tags={{ .Env.DATABASE }} {{ .Env.SOURCE }}"
24+
- "-trimpath"
25+
nfpms:
26+
- homepage: "https://github.com/golang-migrate/migrate"
27+
maintainer: "[email protected]"
28+
license: MIT
29+
description: "Database migrations"
30+
formats:
31+
- deb
32+
file_name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
33+
dockers:
34+
- goos: linux
35+
goarch: amd64
36+
dockerfile: Dockerfile.github-actions
37+
use: buildx
38+
ids:
39+
- migrate
40+
image_templates:
41+
- 'migrate/migrate:{{ .Tag }}-amd64'
42+
build_flag_templates:
43+
- '--label=org.opencontainers.image.created={{ .Date }}'
44+
- '--label=org.opencontainers.image.title={{ .ProjectName }}'
45+
- '--label=org.opencontainers.image.revision={{ .FullCommit }}'
46+
- '--label=org.opencontainers.image.version={{ .Version }}'
47+
- "--label=org.opencontainers.image.source={{ .GitURL }}"
48+
- "--platform=linux/amd64"
49+
- goos: linux
50+
goarch: arm64
51+
dockerfile: Dockerfile.github-actions
52+
use: buildx
53+
ids:
54+
- migrate
55+
image_templates:
56+
- 'migrate/migrate:{{ .Tag }}-arm64'
57+
build_flag_templates:
58+
- '--label=org.opencontainers.image.created={{ .Date }}'
59+
- '--label=org.opencontainers.image.title={{ .ProjectName }}'
60+
- '--label=org.opencontainers.image.revision={{ .FullCommit }}'
61+
- '--label=org.opencontainers.image.version={{ .Version }}'
62+
- "--label=org.opencontainers.image.source={{ .GitURL }}"
63+
- "--platform=linux/arm64"
64+
65+
docker_manifests:
66+
- name_template: 'migrate/migrate:{{ .Tag }}'
67+
image_templates:
68+
- 'migrate/migrate:{{ .Tag }}-amd64'
69+
- 'migrate/migrate:{{ .Tag }}-arm64'
70+
- name_template: 'migrate/migrate:{{ .Major }}'
71+
image_templates:
72+
- 'migrate/migrate:{{ .Tag }}-amd64'
73+
- 'migrate/migrate:{{ .Tag }}-arm64'
74+
- name_template: 'migrate/migrate:latest'
75+
image_templates:
76+
- 'migrate/migrate:{{ .Tag }}-amd64'
77+
- 'migrate/migrate:{{ .Tag }}-arm64'
78+
archives:
79+
- name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
80+
format_overrides:
81+
- goos: windows
82+
format: zip
83+
checksum:
84+
name_template: 'sha256sum.txt'
85+
release:
86+
draft: true
87+
prerelease: auto
88+
source:
89+
enabled: true
90+
format: zip
91+
changelog:
92+
skip: false
93+
sort: asc
94+
filters:
95+
exclude:
96+
- '^docs:'
97+
- '^test:'
98+
- Merge pull request
99+
- Merge branch
100+
- go mod tidy
101+
snapshot:
102+
name_template: "{{ .Tag }}-next"

0 commit comments

Comments
 (0)