github.com/rjgonzale/pop/v5@v5.1.3-dev/.github/workflows/tests.yml (about) 1 name: Tests 2 on: [push, pull_request] 3 jobs: 4 mysql-tests: 5 name: MySQL tests 6 runs-on: ubuntu-latest 7 8 services: 9 mysql: 10 image: mysql:5.7 11 env: 12 MYSQL_ROOT_PASSWORD: root 13 ports: 14 - 3307:3306 15 # needed because the mysql container does not provide a healthcheck 16 options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5 17 18 steps: 19 - name: Set up Go 20 uses: actions/setup-go@v1 21 with: 22 go-version: 1.13 23 id: go 24 - name: Checkout Code 25 uses: actions/checkout@v1 26 with: 27 fetch-depth: 1 28 - name: Get dependencies 29 run: | 30 go get -v -tags sqlite -t -d ./... 31 - name: Build and run soda 32 env: 33 SODA_DIALECT: "mysql" 34 MYSQL_PORT: 3307 35 run: | 36 go build -v -tags sqlite -o tsoda ./soda 37 ./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations 38 ./tsoda create -e $SODA_DIALECT -p ./testdata/migrations 39 ./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations 40 - name: Test 41 env: 42 SODA_DIALECT: "mysql" 43 MYSQL_PORT: 3307 44 run: | 45 go test -tags sqlite -race ./... 46 47 pg-tests: 48 name: PostgreSQL tests 49 runs-on: ubuntu-latest 50 51 services: 52 postgres: 53 image: postgres:10.8 54 env: 55 POSTGRES_USER: postgres 56 POSTGRES_PASSWORD: postgres 57 POSTGRES_DB: postgres 58 ports: 59 - 5432:5432 60 # needed because the postgres container does not provide a healthcheck 61 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 62 63 steps: 64 - name: Set up Go 65 uses: actions/setup-go@v1 66 with: 67 go-version: 1.13 68 id: go 69 - name: Checkout Code 70 uses: actions/checkout@v1 71 with: 72 fetch-depth: 1 73 - name: Get dependencies 74 run: | 75 go get -v -tags sqlite -t -d ./... 76 - name: Build and run soda 77 env: 78 SODA_DIALECT: "postgres" 79 POSTGRESQL_URL: "postgres://postgres:postgres@${{job.services.postgres.host}}:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable" 80 run: | 81 go build -v -tags sqlite -o tsoda ./soda 82 ./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations 83 ./tsoda create -e $SODA_DIALECT -p ./testdata/migrations 84 ./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations 85 - name: Test 86 env: 87 SODA_DIALECT: "postgres" 88 POSTGRESQL_URL: "postgres://postgres:postgres@${{job.services.postgres.host}}:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable" 89 run: | 90 go test -tags sqlite -race ./... 91 92 crdbssl-tests: 93 name: Cockroach SSL tests 94 runs-on: ubuntu-latest 95 96 steps: 97 - name: Set up Go 98 uses: actions/setup-go@v1 99 with: 100 go-version: 1.13 101 id: go 102 - name: Checkout Code 103 uses: actions/checkout@v1 104 with: 105 fetch-depth: 1 106 - name: Get dependencies 107 run: | 108 go get -v -tags sqlite -t -d ./... 109 - name: Install Cockroach SSL 110 run: | 111 mkdir -p crdb/certs 112 pushd crdb 113 wget -qO- https://binaries.cockroachdb.com/cockroach-v2.1.0.linux-amd64.tgz | tar zxv 114 mv cockroach-v2.1.0.linux-amd64/cockroach . 115 ./cockroach cert create-ca --certs-dir certs --ca-key key 116 ./cockroach cert create-client root --certs-dir certs --ca-key key 117 ./cockroach cert create-node localhost 127.0.0.1 `hostname -s` `hostname -f` --certs-dir certs --ca-key key 118 ./cockroach start --certs-dir certs --listen-addr localhost --port 26259 --http-port 8089 --background 119 popd 120 - name: Build and run soda 121 env: 122 SODA_DIALECT: "cockroach_ssl" 123 run: | 124 go build -v -tags sqlite -o tsoda ./soda 125 ./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations 126 ./tsoda create -e $SODA_DIALECT -p ./testdata/migrations 127 ./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations 128 - name: Test 129 env: 130 SODA_DIALECT: "cockroach_ssl" 131 run: | 132 go test -tags sqlite -race ./... 133 134 crdb-tests: 135 name: Cockroach tests 136 runs-on: ubuntu-latest 137 138 steps: 139 - name: Set up Go 140 uses: actions/setup-go@v1 141 with: 142 go-version: 1.13 143 id: go 144 - name: Checkout Code 145 uses: actions/checkout@v1 146 with: 147 fetch-depth: 1 148 - name: Get dependencies 149 run: | 150 go get -v -tags sqlite -t -d ./... 151 - name: Install Cockroach 152 run: | 153 mkdir -p crdb 154 pushd crdb 155 wget -qO- https://binaries.cockroachdb.com/cockroach-v2.1.0.linux-amd64.tgz | tar zxv 156 mv cockroach-v2.1.0.linux-amd64/cockroach . 157 ./cockroach start --insecure --background 158 popd 159 - name: Build and run soda 160 env: 161 SODA_DIALECT: "cockroach" 162 run: | 163 go build -v -tags sqlite -o tsoda ./soda 164 ./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations 165 ./tsoda create -e $SODA_DIALECT -p ./testdata/migrations 166 ./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations 167 - name: Test 168 env: 169 SODA_DIALECT: "cockroach" 170 run: | 171 go test -tags sqlite -race ./... 172 173 sqlite-tests: 174 name: SQLite tests 175 runs-on: ${{ matrix.os }} 176 strategy: 177 matrix: 178 os: [ubuntu-latest, macOS-latest, windows-latest] 179 180 steps: 181 - name: Set up Go 182 uses: actions/setup-go@v1 183 with: 184 go-version: 1.13 185 id: go 186 - name: Checkout Code 187 uses: actions/checkout@v1 188 with: 189 fetch-depth: 1 190 - name: Get dependencies 191 run: | 192 go get -v -tags sqlite -t -d ./... 193 - name: Build and run soda 194 env: 195 SODA_DIALECT: "sqlite" 196 run: | 197 go build -v -tags sqlite -o tsoda ./soda 198 ./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations 199 ./tsoda create -e $SODA_DIALECT -p ./testdata/migrations 200 ./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations 201 shell: bash 202 - name: Test 203 env: 204 SODA_DIALECT: "sqlite" 205 run: | 206 go test -tags sqlite -race ./...