github.com/polarismesh/polaris@v1.17.8/.github/workflows/codecov.yaml (about)

     1  # Tencent is pleased to support the open source community by making Polaris available.
     2  #
     3  # Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
     4  #
     5  # Licensed under the BSD 3-Clause License (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  # https://opensource.org/licenses/BSD-3-Clause
    10  #
    11  # Unless required by applicable law or agreed to in writing, software distributed
    12  # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
    13  # CONDITIONS OF ANY KIND, either express or implied. See the License for the
    14  # specific language governing permissions and limitations under the License.
    15  
    16  name: Codecov
    17  
    18  on:
    19    push:
    20      branches:
    21        - main
    22        - release*
    23    pull_request:
    24      branches:
    25        - main
    26        - release*
    27  
    28  permissions:
    29    contents: write
    30  
    31  # Always force the use of Go modules
    32  env:
    33    GO111MODULE: on
    34  
    35  jobs:
    36    build:
    37      runs-on: ubuntu-latest
    38      services:
    39        # Label used to access the service container
    40        redis:
    41          # Docker Hub image
    42          image: redis
    43          # Set health checks to wait until redis has started
    44          options: >-
    45            --health-cmd "redis-cli ping"
    46            --health-interval 10s
    47            --health-timeout 5s
    48            --health-retries 5
    49          ports:
    50            # Maps port 6379 on service container to the host
    51            - 6379:6379
    52      steps:
    53        # Setup the environment.
    54        - name: Setup Go
    55          uses: actions/setup-go@v4
    56          with:
    57            go-version: "1.20"
    58        # Checkout latest code
    59        - name: Checkout repo
    60          uses: actions/checkout@v2
    61          with:
    62            fetch-depth: 2
    63  
    64        - name: Initialize database
    65          env:
    66            MYSQL_DB_USER: root
    67            MYSQL_DB_PWD: root
    68            MYSQL_DATABASE: polaris_server
    69          run: |
    70            sudo systemctl start mysql.service
    71            mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
    72            mysql -e "ALTER USER '${{ env.MYSQL_DB_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"  -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
    73  
    74        # Execute vert check
    75        - name: Vert check
    76          run: bash vert.sh -install && bash vert.sh
    77  
    78        - name: Standalone Test
    79          env:
    80            MYSQL_DB_USER: root
    81            MYSQL_DB_PWD: root
    82            RUN_MODE: STANDALONE
    83          run: |
    84            # bash coverage.sh
    85            export MYSQL_DB_USER=${{ env.MYSQL_DB_USER }}
    86            export MYSQL_DB_PWD=${{ env.MYSQL_DB_PWD }}
    87            bash test/codecov.sh
    88  
    89        - name: Cluster Test
    90          env:
    91            MYSQL_DB_USER: root
    92            MYSQL_DB_PWD: root
    93            REDIS_ADDR: 127.0.0.1:6379
    94            REDIS_PWD: ""
    95            RUN_MODE: CLUSTER
    96          run: |
    97            # bash coverage.sh
    98            export MYSQL_DB_USER=${{ env.MYSQL_DB_USER }}
    99            export MYSQL_DB_PWD=${{ env.MYSQL_DB_PWD }}
   100            bash test/codecov.sh
   101  
   102        - name: Upload Codecov
   103          uses: codecov/codecov-action@v3
   104          with:
   105            token: ${{ secrets.CODECOV_TOKEN }}