|
| 1 | +name: Go |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + services: |
| 14 | + |
| 15 | + mysql: |
| 16 | + image: mysql |
| 17 | + env: |
| 18 | + MYSQL_ROOT_PASSWORD: root-password |
| 19 | + MYSQL_DATABASE: dbname |
| 20 | + MYSQL_USER: user |
| 21 | + MYSQL_PASSWORD: password |
| 22 | + options: >- |
| 23 | + --health-cmd "mysqladmin ping --silent" |
| 24 | + --health-interval 10s |
| 25 | + --health-timeout 5s |
| 26 | + --health-retries 5 |
| 27 | + ports: |
| 28 | + - 3306:3306 |
| 29 | + |
| 30 | + postgres: |
| 31 | + image: postgres |
| 32 | + env: |
| 33 | + POSTGRES_DB: dbname |
| 34 | + POSTGRES_USER: user |
| 35 | + POSTGRES_PASSWORD: password |
| 36 | + options: >- |
| 37 | + --health-cmd pg_isready |
| 38 | + --health-interval 10s |
| 39 | + --health-timeout 5s |
| 40 | + --health-retries 5 |
| 41 | + ports: |
| 42 | + - 5432:5432 |
| 43 | + |
| 44 | + redis: |
| 45 | + image: redis |
| 46 | + options: >- |
| 47 | + --health-cmd "redis-cli ping" |
| 48 | + --health-interval 10s |
| 49 | + --health-timeout 5s |
| 50 | + --health-retries 5 |
| 51 | + ports: |
| 52 | + - 6379:6379 |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Set up Go |
| 58 | + uses: actions/setup-go@v5 |
| 59 | + with: |
| 60 | + go-version: '1.20' |
| 61 | + |
| 62 | + - name: Test |
| 63 | + run: go test -race -v ./... |
| 64 | + |
| 65 | + - name: Run postgres migrations |
| 66 | + run: psql -f pgxstore/testdata/schema.sql postgres://user:password@localhost:5432/dbname |
| 67 | + |
| 68 | + - name: Run mysql migrations |
| 69 | + run: mysql --protocol=TCP --host=localhost --port=3306 --user=user --password=password dbname < mysqlstore/testdata/schema.sql |
| 70 | + |
| 71 | + - name: Test goredisstore |
| 72 | + env: |
| 73 | + SCS_REDIS_TEST_DSN: redis://localhost:6379 |
| 74 | + working-directory: goredisstore |
| 75 | + run: go test -race -v ./... |
| 76 | + |
| 77 | + - name: Test mysqlstore |
| 78 | + env: |
| 79 | + SCS_MYSQL_TEST_DSN: user:password@tcp(localhost:3306)/dbname |
| 80 | + working-directory: mysqlstore |
| 81 | + run: go test -race -v ./... |
| 82 | + |
| 83 | + - name: Test pgxstore |
| 84 | + env: |
| 85 | + SCS_POSTGRES_TEST_DSN: postgres://user:password@localhost:5432/dbname |
| 86 | + working-directory: pgxstore |
| 87 | + run: go test -race -v ./... |
| 88 | + |
| 89 | + - name: Test postgresstore |
| 90 | + env: |
| 91 | + SCS_POSTGRES_TEST_DSN: postgres://user:password@localhost:5432/dbname?sslmode=disable |
| 92 | + working-directory: postgresstore |
| 93 | + run: go test -race -v ./... |
| 94 | + |
| 95 | + - name: Test redisstore |
| 96 | + env: |
| 97 | + SCS_REDIS_TEST_DSN: localhost:6379 |
| 98 | + working-directory: redisstore |
| 99 | + run: go test -race -v ./... |
| 100 | + |
| 101 | + - name: Test sqlite3store |
| 102 | + working-directory: sqlite3store |
| 103 | + run: go test -race -v ./... |
0 commit comments