github.com/Ali-iotechsys/sqlboiler/v4@v4.0.0-20221208124957-6aec9a5f1f71/.github/workflows/test.yaml (about) 1 name: test 2 on: [push, pull_request] 3 4 jobs: 5 test: 6 name: test 7 runs-on: ubuntu-latest 8 strategy: 9 matrix: 10 go: [1.19, 1.18] 11 services: 12 postgres: 13 image: postgres:12 14 ports: 15 - 5432:5432 16 env: 17 POSTGRES_PASSWORD: psqlpassword 18 options: >- 19 --health-cmd pg_isready 20 --health-interval 10s 21 --health-timeout 5s 22 --health-retries 5 23 mysql: 24 image: mysql:8.0 25 ports: 26 - 3306:3306 27 env: 28 MYSQL_ROOT_PASSWORD: mysqlpassword 29 mssql: 30 image: mcr.microsoft.com/mssql/server:2019-latest 31 ports: 32 - 1433:1433 33 env: 34 ACCEPT_EULA: 'Y' 35 SA_PASSWORD: 'Sqlboiler@1234' 36 steps: 37 # - name: install_tools 38 # run: > 39 # apt-get update 40 # && apt-get install -y apt-transport-https software-properties-common python3-software-properties 41 # && apt-add-repository ppa:git-core/ppa 42 # && apt-get update 43 # && apt-get install -y curl locales 44 45 # # Set up locales for sqlcmd (otherwise it breaks) 46 # - name: setup_locales 47 # run: > 48 # locale-gen en_US.UTF-8 49 # && echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale 50 # && echo "LANG=en_US.UTF-8" >> /etc/default/locale 51 52 # # Install database clients 53 # # MySQL 8.0 is still in development, so we're using 5.7 which is already 54 # # available in Ubuntu 18.04 55 # - name: install_clients 56 # run: > 57 # curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - 58 # && echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/psql.list 59 # && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 60 # && curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/msprod.list 61 # && apt-get update 62 # && env ACCEPT_EULA=Y apt-get install -y git postgresql-client-12.2 mysql-client-5.7 mssql-tools unixodbc-dev 63 64 - name: psql_creds 65 run: > 66 echo "*:*:*:*:psqlpassword" > $HOME/.pgpass 67 && chmod 600 $HOME/.pgpass 68 69 - name: mysql_creds 70 run: > 71 echo -e "[client]\nuser = root\npassword = mysqlpassword\nhost = localhost\nprotocol = tcp" > $HOME/.my.cnf 72 && chmod 600 $HOME/.my.cnf 73 74 - name: psql_wait 75 run: | 76 set -o errexit; 77 c=0; 78 for i in `seq 30`; do 79 echo "psql_wait" 80 psql --host localhost --username postgres --dbname template1 -c 'select * from information_schema.tables;' > /dev/null && c=0 && break || c=$? && sleep 1 81 done; 82 exit $c 83 84 - name: mysql_wait 85 run: | 86 set -o errexit; 87 c=0; 88 for i in `seq 30`; do 89 echo "mysql_wait" 90 mysql --execute 'select * from information_schema.tables;' > /dev/null > /dev/null && c=0 && break || c=$? && sleep 1 91 done; 92 exit $c 93 94 - name: mssql_wait 95 run: | 96 set -o errexit; 97 c=0; 98 for i in `seq 30`; do 99 echo "mssql_wait" 100 sqlcmd -H localhost -U sa -P Sqlboiler@1234 -Q "select * from information_schema.tables;" > /dev/null > /dev/null && c=0 && break || c=$? && sleep 1 101 done; 102 exit $c 103 104 - name: checkout 105 uses: actions/checkout@v2 106 with: { fetch-depth: 1 } 107 108 - name: psql_db 109 run: > 110 cd $GITHUB_WORKSPACE 111 && ./boil.sh test-user psql 112 && ./boil.sh test-db psql 113 && ./boil.sh driver-test-db psql 114 && ./boil.sh driver-test-user psql 115 116 - name: mysql_db 117 run: > 118 cd $GITHUB_WORKSPACE 119 && ./boil.sh test-user mysql 120 && ./boil.sh test-db mysql 121 && ./boil.sh driver-test-db mysql 122 && ./boil.sh driver-test-user mysql 123 124 - name: mssql_db 125 run: > 126 cd $GITHUB_WORKSPACE 127 && ./boil.sh test-user mssql 128 && ./boil.sh test-db mssql 129 && ./boil.sh driver-test-db mssql 130 && ./boil.sh driver-test-user mssql 131 132 - name: go 133 uses: actions/setup-go@v3 134 with: 135 go-version: ${{matrix.go}} 136 137 - name: deps 138 run: go mod download 139 env: { GOPROXY: 'https://proxy.golang.org' } 140 141 - name: chmodhome 142 run: chmod 0755 $HOME 143 144 - name: build 145 run: > 146 cd $GITHUB_WORKSPACE 147 && ./boil.sh build 148 && ./boil.sh build all 149 150 - name: test 151 run: > 152 cd $GITHUB_WORKSPACE 153 && go test -v ./...