name: GoFrame Main CI on: push: branches: - master - develop - personal/** - feature/** - enhance/** - fix/** pull_request: branches: - master - develop - personal/** - feature/** - enhance/** - fix/** # This allows a subsequently queued workflow run to interrupt previous runs concurrency: group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' cancel-in-progress: true env: TZ: "Asia/Shanghai" jobs: code-test: runs-on: ubuntu-latest # Service containers to run with `code-test` services: # Redis backend server. redis: image : loads/redis:latest options: >- --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 ports: # Maps tcp port 6379 on service container to the host - 6379:6379 # MySQL backend server. mysql: image: loads/mysql:5.7 env: MYSQL_DATABASE : test MYSQL_ROOT_PASSWORD: 12345678 ports: # Maps tcp port 3306 on service container to the host - 3306:3306 # PostgreSQL backend server. # docker run -d --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=12345678 -e POSTGRES_USER=postgres -e POSTGRES_DB=test -v postgres:/Users/john/Temp/postgresql/data loads/postgres:13 postgres: image: loads/postgres:13 env: POSTGRES_PASSWORD: 12345678 POSTGRES_USER: postgres POSTGRES_DB: test TZ: Asia/Shanghai ports: - 5432:5432 # Set health checks to wait until postgres has started options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 # MSSQL backend server. mssql: image: loads/mssqldocker:latest env: ACCEPT_EULA: Y SA_PASSWORD: LoremIpsum86 MSSQL_DB: test MSSQL_USER: root MSSQL_PASSWORD: LoremIpsum86 ports: - 1433:1433 options: >- --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P LoremIpsum86 -l 30 -Q \"SELECT 1\" || exit 1" --health-start-period 10s --health-interval 10s --health-timeout 5s --health-retries 10 # ClickHouse backend server. # docker run -d --name clickhouse -p 9000:9000 -p 8123:8123 -p 9001:9001 loads/clickhouse-server:latest clickhouse-server: image: loads/clickhouse-server:latest ports: - 9000:9000 - 8123:8123 - 9001:9001 # Polaris backend server. polaris: image: loads/polaris-server-standalone:latest ports: - 8090:8090 - 8091:8091 - 8093:8093 # Oracle 11g server oracle-server: image: loads/oracle-xe-11g-r2:latest env: ORACLE_ALLOW_REMOTE: true ORACLE_SID: XE ORACLE_DB_USER_NAME: system ORACLE_DB_PASSWORD: oracle ports: - 1521:1521 # dm8 server dm-server: image: loads/dm:v8.1.2.128_ent_x86_64_ctm_pack4 ports: - 5236:5236 strategy: matrix: go-version: [ "1.15", "1.16", "1.17", "1.18" ] goarch: [ "386", "amd64" ] steps: # TODO: szenius/set-timezone update to node16 - name: Setup Timezone uses: szenius/set-timezone@v1.1 with: timezoneLinux: "Asia/Shanghai" - name: Checkout Repository uses: actions/checkout@v3 - name: Start Apollo Containers run: docker-compose -f ".github/workflows/apollo/docker-compose.yml" up -d --build - name: Start Nacos Containers run: docker-compose -f ".github/workflows/nacos/docker-compose.yml" up -d --build - name: Start Redis Cluster Containers run: docker-compose -f ".github/workflows/redis/docker-compose.yml" up -d --build - name: Start Minikube uses: medyagh/setup-minikube@master - name: Setup Golang ${{ matrix.go-version }} uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Setup Golang caches uses: actions/cache@v3 with: path: | ~/go/pkg/mod ~/.cache/go-build ~/Library/Caches/go-build ~\AppData\Local\go-build key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ matrix.go-version }}- - name: Before Script run: bash .github/workflows/before_script.sh - name: Build & Test run: bash .github/workflows/build_and_test.sh - name: Stop Redis Cluster Containers run: docker-compose -f ".github/workflows/redis/docker-compose.yml" down - name: Stop Apollo Containers run: docker-compose -f ".github/workflows/apollo/docker-compose.yml" down - name: Stop Nacos Containers run: docker-compose -f ".github/workflows/nacos/docker-compose.yml" down - name: Report Coverage uses: codecov/codecov-action@v3 with: flags: go-${{ matrix.go-version }}-${{ matrix.goarch }}