|
1 | | -linters-settings: |
2 | | - gocritic: |
3 | | - disabled-checks: |
4 | | - - ifElseChain |
5 | | - |
6 | | - goimports: |
7 | | - local-prefixes: github.com/rubenv/sql-migrate |
8 | | - |
9 | | - govet: |
10 | | - enable-all: true |
11 | | - disable: |
12 | | - - fieldalignment |
13 | | - |
14 | | - depguard: |
15 | | - rules: |
16 | | - main: |
17 | | - allow: |
18 | | - - $gostd |
19 | | - - github.com/denisenkom/go-mssqldb |
20 | | - - github.com/go-sql-driver/mysql |
21 | | - - github.com/go-gorp/gorp/v3 |
22 | | - - github.com/lib/pq |
23 | | - - github.com/mattn/go-sqlite3 |
24 | | - - github.com/mitchellh/cli |
25 | | - - github.com/olekukonko/tablewriter |
26 | | - - github.com/rubenv/sql-migrate |
27 | | - - gopkg.in/check.v1 |
28 | | - - gopkg.in/yaml.v2 |
29 | | - |
30 | | - exhaustive: |
31 | | - default-signifies-exhaustive: true |
32 | | - |
33 | | - nolintlint: |
34 | | - allow-unused: false |
35 | | - allow-no-explanation: |
36 | | - - depguard |
37 | | - require-explanation: true |
38 | | - require-specific: true |
39 | | - |
40 | | - revive: |
41 | | - enable-all-rules: false |
42 | | - rules: |
43 | | - - name: atomic |
44 | | - - name: blank-imports |
45 | | - - name: bool-literal-in-expr |
46 | | - - name: call-to-gc |
47 | | - - name: constant-logical-expr |
48 | | - - name: context-as-argument |
49 | | - - name: context-keys-type |
50 | | - - name: dot-imports |
51 | | - - name: duplicated-imports |
52 | | - - name: empty-block |
53 | | - - name: empty-lines |
54 | | - - name: error-naming |
55 | | - - name: error-return |
56 | | - - name: error-strings |
57 | | - - name: errorf |
58 | | - - name: exported |
59 | | - - name: identical-branches |
60 | | - - name: imports-blocklist |
61 | | - - name: increment-decrement |
62 | | - - name: indent-error-flow |
63 | | - - name: modifies-parameter |
64 | | - - name: modifies-value-receiver |
65 | | - - name: package-comments |
66 | | - - name: range |
67 | | - - name: range-val-address |
68 | | - - name: range-val-in-closure |
69 | | - - name: receiver-naming |
70 | | - - name: string-format |
71 | | - - name: string-of-int |
72 | | - - name: struct-tag |
73 | | - - name: time-naming |
74 | | - - name: unconditional-recursion |
75 | | - - name: unexported-naming |
76 | | - - name: unexported-return |
77 | | - - name: superfluous-else |
78 | | - - name: unreachable-code |
79 | | - - name: var-declaration |
80 | | - - name: waitgroup-by-value |
81 | | - - name: unused-receiver |
82 | | - - name: unnecessary-stmt |
83 | | - - name: unused-parameter |
84 | | - |
85 | | -run: |
86 | | - tests: true |
87 | | - timeout: 1m |
88 | | - |
89 | | -linters: |
90 | | - disable-all: true |
91 | | - enable: |
92 | | - - asciicheck |
93 | | - - depguard |
94 | | - - errcheck |
95 | | - - exhaustive |
96 | | - - gocritic |
97 | | - - gofmt |
98 | | - - gofumpt |
99 | | - - goimports |
100 | | - - govet |
101 | | - - ineffassign |
102 | | - - nolintlint |
103 | | - - revive |
104 | | - - staticcheck |
105 | | - - typecheck |
106 | | - - unused |
107 | | - - whitespace |
108 | | - - errorlint |
109 | | - - gosimple |
110 | | - - unparam |
111 | | - |
112 | | -issues: |
113 | | - exclude: |
114 | | - - 'declaration of "err" shadows declaration at' |
115 | | - - 'error-strings: error strings should not be capitalized or end with punctuation or a newline' |
116 | | - max-same-issues: 10000 |
117 | | - max-issues-per-linter: 10000 |
| 1 | +name: Test |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | +jobs: |
| 8 | + test: |
| 9 | + strategy: |
| 10 | + fail-fast: true |
| 11 | + matrix: |
| 12 | + go-version: ["1.23", "1.24"] |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + - name: setup-go |
| 18 | + uses: actions/setup-go@v5 |
| 19 | + with: |
| 20 | + go-version: ${{ matrix.go-version }} |
| 21 | + cache: true |
| 22 | + cache-dependency-path: go.sum |
| 23 | + - name: go build |
| 24 | + run: go build -o ./bin/sql-migrate ./sql-migrate && ./bin/sql-migrate --help |
| 25 | + - name: go test |
| 26 | + run: go test ./... |
| 27 | + lint: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + - name: setup-go |
| 33 | + uses: actions/setup-go@v5 |
| 34 | + with: |
| 35 | + go-version: "1.24" |
| 36 | + cache: true |
| 37 | + cache-dependency-path: go.sum |
| 38 | + - name: golangci-lint |
| 39 | + uses: golangci/golangci-lint-action@v6 |
| 40 | + with: |
| 41 | + version: v1.64 |
| 42 | + - name: go mod tidy |
| 43 | + run: go mod tidy |
| 44 | + - name: check for any changes |
| 45 | + run: | |
| 46 | + [[ $(git status --porcelain) == "" ]] || (echo "changes detected" && exit 1) |
| 47 | + integration: |
| 48 | + needs: |
| 49 | + - test |
| 50 | + - lint |
| 51 | + runs-on: ubuntu-latest |
| 52 | + strategy: |
| 53 | + fail-fast: true |
| 54 | + matrix: |
| 55 | + go-version: ["1.23", "1.24"] |
| 56 | + services: |
| 57 | + mysql: |
| 58 | + image: mysql:8.0 |
| 59 | + env: |
| 60 | + MYSQL_ALLOW_EMPTY_PASSWORD: "1" |
| 61 | + MYSQL_ROOT_PASSWORD: "" |
| 62 | + MYSQL_DATABASE: "test" |
| 63 | + ports: |
| 64 | + - 3306:3306 |
| 65 | + options: >- |
| 66 | + --health-cmd="mysqladmin ping" |
| 67 | + --health-interval=10s |
| 68 | + --health-timeout=5s |
| 69 | + --health-retries=3 |
| 70 | + postgres: |
| 71 | + image: postgres:15 |
| 72 | + env: |
| 73 | + POSTGRES_PASSWORD: "password" |
| 74 | + ports: |
| 75 | + - 5432:5432 |
| 76 | + options: >- |
| 77 | + --health-cmd pg_isready |
| 78 | + --health-interval 10s |
| 79 | + --health-timeout 5s |
| 80 | + --health-retries 5 |
| 81 | + env: |
| 82 | + MYSQL_HOST: "127.0.0.1" |
| 83 | + PGHOST: "127.0.0.1" |
| 84 | + PGUSER: "postgres" |
| 85 | + PGPASSWORD: "password" |
| 86 | + steps: |
| 87 | + - name: checkout |
| 88 | + uses: actions/checkout@v4 |
| 89 | + - name: setup-go |
| 90 | + uses: actions/setup-go@v5 |
| 91 | + with: |
| 92 | + go-version: ${{ matrix.go-version }} |
| 93 | + cache: true |
| 94 | + cache-dependency-path: go.sum |
| 95 | + - name: setup databases |
| 96 | + run: | |
| 97 | + mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test;' |
| 98 | + mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test_env;' |
| 99 | + psql -U postgres -c 'CREATE DATABASE test;' |
| 100 | + - name: install sql-migrate |
| 101 | + run: go install ./... |
| 102 | + - name: postgres |
| 103 | + run: bash ./test-integration/postgres.sh |
| 104 | + - name: mysql |
| 105 | + run: bash ./test-integration/mysql.sh |
| 106 | + - name: mysql-flag |
| 107 | + run: bash ./test-integration/mysql-flag.sh |
| 108 | + - name: mysql-env |
| 109 | + run: bash ./test-integration/mysql-env.sh |
| 110 | + - name: sqlite |
| 111 | + run: bash ./test-integration/sqlite.sh |
0 commit comments