github.com/systematiccaos/gorm@v1.22.6/.github/workflows/tests.yml (about)

     1  name: tests
     2  
     3  on:
     4    push:
     5      branches-ignore:
     6        - 'gh-pages'
     7    pull_request:
     8      branches-ignore:
     9        - 'gh-pages'
    10  
    11  jobs:
    12    # Label of the container job
    13    sqlite:
    14      strategy:
    15        matrix:
    16          go: ['1.17', '1.16']
    17          platform: [ubuntu-latest] # can not run in windows OS
    18      runs-on: ${{ matrix.platform }}
    19  
    20      steps:
    21      - name: Set up Go 1.x
    22        uses: actions/setup-go@v2
    23        with:
    24          go-version: ${{ matrix.go }}
    25  
    26      - name: Check out code into the Go module directory
    27        uses: actions/checkout@v2
    28  
    29      - name: go mod package cache
    30        uses: actions/cache@v2
    31        with:
    32          path: ~/go/pkg/mod
    33          key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
    34  
    35      - name: Tests
    36        run: GORM_DIALECT=sqlite ./tests/tests_all.sh
    37  
    38    mysql:
    39      strategy:
    40        matrix:
    41          dbversion: ['mysql:latest', 'mysql:5.7', 'mariadb:latest']
    42          go: ['1.17', '1.16']
    43          platform: [ubuntu-latest]
    44      runs-on: ${{ matrix.platform }}
    45  
    46      services:
    47        mysql:
    48          image: ${{ matrix.dbversion }}
    49          env:
    50            MYSQL_DATABASE: gorm
    51            MYSQL_USER: gorm
    52            MYSQL_PASSWORD: gorm
    53            MYSQL_RANDOM_ROOT_PASSWORD: "yes"
    54          ports:
    55            - 9910:3306
    56          options: >-
    57            --health-cmd "mysqladmin ping -ugorm -pgorm"
    58            --health-interval 10s
    59            --health-start-period 10s
    60            --health-timeout 5s
    61            --health-retries 10
    62  
    63      steps:
    64      - name: Set up Go 1.x
    65        uses: actions/setup-go@v2
    66        with:
    67          go-version: ${{ matrix.go }}
    68  
    69      - name: Check out code into the Go module directory
    70        uses: actions/checkout@v2
    71  
    72  
    73      - name: go mod package cache
    74        uses: actions/cache@v2
    75        with:
    76          path: ~/go/pkg/mod
    77          key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
    78  
    79      - name: Tests
    80        run: GORM_DIALECT=mysql GORM_DSN="gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True" ./tests/tests_all.sh
    81  
    82    postgres:
    83      strategy:
    84        matrix:
    85          dbversion: ['postgres:latest', 'postgres:13', 'postgres:12', 'postgres:11', 'postgres:10']
    86          go: ['1.17', '1.16']
    87          platform: [ubuntu-latest] # can not run in macOS and Windows
    88      runs-on: ${{ matrix.platform }}
    89  
    90      services:
    91        postgres:
    92          image: ${{ matrix.dbversion }}
    93          env:
    94            POSTGRES_PASSWORD: gorm
    95            POSTGRES_USER: gorm
    96            POSTGRES_DB: gorm
    97            TZ: Asia/Shanghai
    98          ports:
    99            - 9920:5432
   100          # Set health checks to wait until postgres has started
   101          options: >-
   102            --health-cmd pg_isready
   103            --health-interval 10s
   104            --health-timeout 5s
   105            --health-retries 5
   106  
   107      steps:
   108      - name: Set up Go 1.x
   109        uses: actions/setup-go@v2
   110        with:
   111          go-version: ${{ matrix.go }}
   112  
   113      - name: Check out code into the Go module directory
   114        uses: actions/checkout@v2
   115  
   116      - name: go mod package cache
   117        uses: actions/cache@v2
   118        with:
   119          path: ~/go/pkg/mod
   120          key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
   121  
   122      - name: Tests
   123        run: GORM_DIALECT=postgres GORM_DSN="user=gorm password=gorm dbname=gorm host=localhost port=9920 sslmode=disable TimeZone=Asia/Shanghai" ./tests/tests_all.sh
   124  
   125    sqlserver:
   126      strategy:
   127        matrix:
   128          go: ['1.17', '1.16']
   129          platform: [ubuntu-latest] # can not run test in macOS and windows
   130      runs-on: ${{ matrix.platform }}
   131  
   132      services:
   133        mssql:
   134          image: mcmoe/mssqldocker:latest
   135          env:
   136            ACCEPT_EULA: Y
   137            SA_PASSWORD: LoremIpsum86
   138            MSSQL_DB: gorm
   139            MSSQL_USER: gorm
   140            MSSQL_PASSWORD: LoremIpsum86
   141          ports:
   142            - 9930:1433
   143          options: >-
   144            --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P LoremIpsum86 -l 30 -Q \"SELECT 1\" || exit 1"
   145            --health-start-period 10s
   146            --health-interval 10s
   147            --health-timeout 5s
   148            --health-retries 10
   149  
   150      steps:
   151      - name: Set up Go 1.x
   152        uses: actions/setup-go@v2
   153        with:
   154          go-version: ${{ matrix.go }}
   155  
   156      - name: Check out code into the Go module directory
   157        uses: actions/checkout@v2
   158  
   159      - name: go mod package cache
   160        uses: actions/cache@v2
   161        with:
   162          path: ~/go/pkg/mod
   163          key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('tests/go.mod') }}
   164  
   165      - name: Tests
   166        run: GORM_DIALECT=sqlserver GORM_DSN="sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm" ./tests/tests_all.sh