diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 34b5b1cd78..9e9de6a3ca 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -45,7 +45,7 @@ jobs: go: [1.17] db: [MySQL8.0, SQLite3] steps: - - name: CacheGolangFile + - name: Setup Cache uses: actions/cache@v2 with: path: | diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5d22279a42..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,99 +0,0 @@ -# 10月28日前迁出 -os: linux -dist: xenial -language: go - -addons: - hosts: - - local.iqka.com -services: - - docker -env: - global: - # GITHUB TOKEN - # https://github.com/settings/tokens - - CI_USER_TOKEN="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 --private -r yaoapp/gou" - - # CODECOV TOKEN - # https://app.codecov.io/gh/YaoApp/xiang/settings - - CODECOV_TOKEN="0e0438c9-b1fc-4bc7-816f-8cf761a3337f" - - # 象传服务配置 - - XIANG_MODE=debug - - XIANG_SOURCE=$TRAVIS_BUILD_DIR - - XIANG_ROOT=fs:///$TRAVIS_BUILD_DIR/app - - # 服务配置 - - XIANG_SERVICE_DEBUG=true - - XIANG_SERVICE_ALLOW="xiang.yao.run:3000|xiang.yao.run:3001" - - XIANG_SERVICE_HOST=0.0.0.0 - - XIANG_SERVICE_PORT=5099 - - # 数据库配置 - - XIANG_DB_DEBUG=true - - XIANG_DB_PRIMARY="root:123456@tcp(db-server:3308)/xun?charset=utf8mb4&parseTime=True&loc=Local" - - XIANG_DB_SECONDARY="root:123456@tcp(db-server:3308)/xun?charset=utf8mb4&parseTime=True&loc=Local" - - XIANG_DB_AESKEY="ZLX=T&f6refeCh-ro*r@" - - # JWT配置 - - XIANG_JWT_DEBUG=true - - XIANG_JWT_SECRET="bLp@bi!oqo-2U+hoTRUG" - - # 存储配置 - - XIANG_STOR_DEBUG=true - - XIANG_STOR_PATH="fs:///$TRAVIS_BUILD_DIR/upload" - - # 日志配置 - - XIANG_LOG_ACCESS="fs:///$TRAVIS_BUILD_DIR/logs/access.log" - - XIANG_LOG_ERROR="fs:///$TRAVIS_BUILD_DIR/logs/error.log" - - XIANG_LOG_DB="fs:///$TRAVIS_BUILD_DIR/logs/db.log" - - XIANG_LOG_PLUGIN="fs:///$TRAVIS_BUILD_DIR/logs/plugin.log" - -jobs: - fast_finish: true - include: - - name: MySQL8.0-1.17.x - go: 1.17.x - env: - - XIANG_DB_PRIMARY="root:123456@tcp(127.0.0.1:3308)/xun?charset=utf8mb4&parseTime=True&loc=Local" - - XIANG_DB_SECONDARY="root:123456@tcp(127.0.0.1:3308)/xun?charset=utf8mb4&parseTime=True&loc=Local" - before_install: - - echo -e "machine github.com\n login $CI_USER_TOKEN" > ~/.netrc - - unit/service.sh mysql8.0 # Start MySQL 8.0 service - - name: MySQL5.7-1.17.x - go: 1.17.x - env: - - XIANG_DB_PRIMARY="root:123456@tcp(127.0.0.1:3306)/xun?charset=utf8mb4&parseTime=True&loc=Local" - - XIANG_DB_SECONDARY="root:123456@tcp(127.0.0.1:3306)/xun?charset=utf8mb4&parseTime=True&loc=Local" - before_install: - - echo -e "machine github.com\n login $CI_USER_TOKEN" > ~/.netrc - - unit/service.sh mysql5.7 # Start MySQL 5.7 service - - name: MySQL5.6-1.17.x - go: 1.17.x - env: - - XIANG_DB_PRIMARY="root:123456@tcp(127.0.0.1:3307)/xun?charset=utf8mb4&parseTime=True&loc=Local" - - XIANG_DB_SECONDARY="root:123456@tcp(127.0.0.1:3307)/xun?charset=utf8mb4&parseTime=True&loc=Local" - before_install: - - echo -e "machine github.com\n login $CI_USER_TOKEN" > ~/.netrc - - unit/service.sh mysql5.6 # Start MySQL 5.6 service -git: - depth: 10 -install: - - if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi - - if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi - - if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi - -go_import_path: github.com/yaoapp/gou - -script: - - export - - cat ~/.netrc - - make vet - - make fmt-check - - make misspell-check - - make plugin - - make migrate - - make test - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/unit/service.sh b/unit/service.sh deleted file mode 100755 index 96a1175846..0000000000 --- a/unit/service.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -StartMySQL5.7() { - docker pull mysql:5.7.25 - docker run --name=mysql5.7 -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7.25 --default-authentication-plugin=mysql_native_password - Waiting "mysql5.7" "Version: '5.7.25' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)" 30 - docker logs mysql5.7 - docker exec mysql5.7 mysql -uroot -p123456 -e "CREATE DATABASE xun CHARACTER SET utf8 COLLATE utf8_general_ci" - docker exec mysql5.7 mysql -uroot -p123456 -e "CREATE USER xun@'%' IDENTIFIED BY '123456'" - docker exec mysql5.7 mysql -uroot -p123456 -e "GRANT SELECT ON xun.* TO 'xun'@'%'"; -} - -StartMySQL8.0() { - docker pull mysql:8.0.26 - docker run --name=mysql8.0 -d -p 3308:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0.26 --default-authentication-plugin=mysql_native_password - Waiting "mysql8.0" "Version: '8.0.26' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL" 30 - docker logs mysql8.0 - docker exec mysql8.0 mysql -uroot -p123456 -e "CREATE DATABASE xun CHARACTER SET utf8 COLLATE utf8_general_ci" - docker exec mysql8.0 mysql -uroot -p123456 -e "CREATE USER xun@'%' IDENTIFIED BY '123456'" - docker exec mysql8.0 mysql -uroot -p123456 -e "GRANT SELECT ON xun.* TO 'xun'@'%'"; -} - - -StartMySQL5.6() { - docker pull mysql:5.6.51 - docker run --name=mysql5.6 -d -p 3307:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.6.51 --default-authentication-plugin=mysql_native_password - Waiting "mysql5.6" "Version: '5.6.51' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)" 30 - docker logs mysql5.6 - docker exec mysql5.6 mysql -uroot -p123456 -e "CREATE DATABASE xun CHARACTER SET utf8 COLLATE utf8_general_ci" - docker exec mysql5.6 mysql -uroot -p123456 -e "CREATE USER xun@'%' IDENTIFIED BY '123456'" - docker exec mysql5.6 mysql -uroot -p123456 -e "GRANT SELECT ON xun.* TO 'xun'@'%'"; -} - - -StartPostgres9.6() { - docker pull postgres:9.6 - docker run --name=postgres9.6 -d -p 5432:5432 -e POSTGRES_PASSWORD=123456 postgres:9.6 - Waiting "postgres9.6" "PostgreSQL init process complete; ready for start up" 30 - docker logs postgres9.6 - docker exec postgres9.6 su - postgres -c "psql -c 'CREATE DATABASE xun'" - docker exec postgres9.6 su - postgres -c "psql -c \"CREATE USER xun WITH PASSWORD '123456'\"" - docker exec postgres9.6 su - postgres -c "psql -c 'GRANT ALL PRIVILEGES ON DATABASE \"xun\" to xun;'" -} - -IsReady() { - name=$1 - checkstr=$2 - res=$(docker logs $1 2>&1 | grep "$checkstr") - if [ "$res" == "" ]; then - echo "0" - else - echo "1" - fi -} - -Waiting() { - name=$1 - checkstr=$2 - let timeout=$3 - echo -n "Starting $name ." - isready=$(IsReady "$name" "$checkstr") - timing=0 - while [ "$isready" == "0" ]; - do - sleep 1 - isready=$(IsReady "$name" "$checkstr") - let timing=${timing}+1 - echo -n "." - if [ $timing -eq $timeout ]; then - echo " failed. timout($timeout)" >&2 - docker logs $name >&2 - exit 1 - fi - done - echo " done" -} - -command=$1 -case $command in - mysql8.0) StartMySQL8.0;; - mysql5.7) StartMySQL5.7;; - mysql5.6) StartMySQL5.6;; - postgres9.6) StartPostgres9.6;; - *) $(echo "please input command" >&2) ;; -esac \ No newline at end of file