From ca2c80c8e385a5959f483cd73d1df58beffd806f Mon Sep 17 00:00:00 2001 From: mojotv <34467684+mojocn@users.noreply.github.com> Date: Wed, 17 Jun 2020 20:29:37 +0800 Subject: [PATCH] add githubAction CI for tests (#3057) --- .github/workflows/go.yml | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..a5dc41a3 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,73 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + # Label of the container job + containerTest: + # Containers must run in Linux based operating systems + runs-on: ubuntu-latest + # Docker Hub image that `container-job` executes in + #container: node:10.18-jessie + + # Service containers to run with `container-job` + services: + # start postgres + postgres: + image: postgres:latest + env: + POSTGRES_PASSWORD: gorm + POSTGRES_USER: gorm + POSTGRES_DB: gorm + TZ: Asia/Shanghai + + ports: + - 9920:5432 + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + # start mysql + mysql: + image: mysql:latest + env: + MYSQL_DATABASE: gorm + MYSQL_USER: gorm + MYSQL_PASSWORD: gorm + MYSQL_RANDOM_ROOT_PASSWORD: "yes" + + ports: + - 9910:3306 + # start mssql + mssql: + image: mcmoe/mssqldocker:latest + env: + ACCEPT_EULA: Y + SA_PASSWORD: LoremIpsum86 + MSSQL_DB: gorm + MSSQL_USER: gorm + MSSQL_PASSWORD: LoremIpsum86 + ports: + - 9930:1433 + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: show ports + run: netstat -lntp + + - name: run tests + run: cd tests && ./tests_all.sh