vitess.io/vitess@v0.16.2/test/templates/cluster_endtoend_test.tpl (about)

     1  name: {{.Name}}
     2  on: [push, pull_request]
     3  concurrency:
     4    group: format('{0}-{1}', ${{"{{"}} github.ref {{"}}"}}, '{{.Name}}')
     5    cancel-in-progress: true
     6  
     7  env:
     8    LAUNCHABLE_ORGANIZATION: "vitess"
     9    LAUNCHABLE_WORKSPACE: "vitess-app"
    10    GITHUB_PR_HEAD_SHA: "${{`{{ github.event.pull_request.head.sha }}`}}"
    11  
    12  jobs:
    13    build:
    14      name: Run endtoend tests on {{.Name}}
    15      runs-on: ubuntu-22.04
    16  
    17      steps:
    18      - name: Skip CI
    19        run: |
    20          if [[ "{{"${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}"}}" == "true" ]]; then
    21            echo "skipping CI due to the 'Skip CI' label"
    22            exit 1
    23          fi
    24  
    25      - name: Check if workflow needs to be skipped
    26        id: skip-workflow
    27        run: |
    28          skip='false'
    29          if [[ "{{"${{github.event.pull_request}}"}}" ==  "" ]] && [[ "{{"${{github.ref}}"}}" != "refs/heads/main" ]] && [[ ! "{{"${{github.ref}}"}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "{{"${{github.ref}}"}}" =~ "refs/tags/.*" ]]; then
    30            skip='true'
    31          fi
    32          echo Skip ${skip}
    33          echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
    34  
    35      - name: Check out code
    36        if: steps.skip-workflow.outputs.skip-workflow == 'false'
    37        uses: actions/checkout@v3
    38  
    39      - name: Check for changes in relevant files
    40        if: steps.skip-workflow.outputs.skip-workflow == 'false'
    41        uses: frouioui/paths-filter@main
    42        id: changes
    43        with:
    44          token: ''
    45          filters: |
    46            end_to_end:
    47              - 'go/**/*.go'
    48              - 'test.go'
    49              - 'Makefile'
    50              - 'build.env'
    51              - 'go.sum'
    52              - 'go.mod'
    53              - 'proto/*.proto'
    54              - 'tools/**'
    55              - 'config/**'
    56              - 'bootstrap.sh'
    57              - '.github/workflows/{{.FileName}}'
    58              {{- if or (contains .Name "onlineddl") (contains .Name "schemadiff") }}
    59              - 'go/test/endtoend/onlineddl/vrepl_suite/testdata'
    60              {{- end}}
    61  
    62      - name: Set up Go
    63        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
    64        uses: actions/setup-go@v3
    65        with:
    66          go-version: 1.20.3
    67  
    68      - name: Set up python
    69        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
    70        uses: actions/setup-python@v4
    71  
    72      - name: Tune the OS
    73        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
    74        run: |
    75          # Limit local port range to not use ports that overlap with server side
    76          # ports that we listen on.
    77          sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535"
    78          # Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio
    79          echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
    80          sudo sysctl -p /etc/sysctl.conf
    81  
    82      - name: Get dependencies
    83        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
    84        run: |
    85          {{if .InstallXtraBackup}}
    86  
    87          # Setup Percona Server for MySQL 8.0
    88          sudo apt-get update
    89          sudo apt-get install -y lsb-release gnupg2 curl
    90          wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
    91          sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
    92          sudo percona-release setup ps80
    93          sudo apt-get update
    94  
    95          # Install everything else we need, and configure
    96          sudo apt-get install -y percona-server-server percona-server-client make unzip g++ etcd git wget eatmydata xz-utils libncurses5
    97  
    98          {{else}}
    99  
   100          # Get key to latest MySQL repo
   101          sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29
   102          # Setup MySQL 8.0
   103          wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
   104          echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
   105          sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
   106          sudo apt-get update
   107          # Install everything else we need, and configure
   108          sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata xz-utils libncurses5
   109  
   110          {{end}}
   111  
   112          sudo service mysql stop
   113          sudo service etcd stop
   114          sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
   115          sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
   116          go mod download
   117  
   118          # install JUnit report formatter
   119          go install github.com/vitessio/go-junit-report@HEAD
   120  
   121          {{if .InstallXtraBackup}}
   122  
   123          sudo apt-get install percona-xtrabackup-80 lz4
   124  
   125          {{end}}
   126  
   127      {{if .MakeTools}}
   128  
   129      - name: Installing zookeeper and consul
   130        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
   131        run: |
   132            make tools
   133  
   134      {{end}}
   135  
   136      - name: Setup launchable dependencies
   137        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main'
   138        run: |
   139          # Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up
   140          pip3 install --user launchable~=1.0 > /dev/null
   141  
   142          # verify that launchable setup is all correct.
   143          launchable verify || true
   144  
   145          # Tell Launchable about the build you are producing and testing
   146          launchable record build --name "$GITHUB_RUN_ID" --source .
   147  
   148      - name: Run cluster endtoend test
   149        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
   150        timeout-minutes: 45
   151        run: |
   152          # We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file
   153          # which musn't be more than 107 characters long.
   154          export VTDATAROOT="/tmp/"
   155          source build.env
   156  
   157          set -x
   158  
   159          {{if .LimitResourceUsage}}
   160          # Increase our open file descriptor limit as we could hit this
   161          ulimit -n 65536
   162          cat <<-EOF>>./config/mycnf/mysql80.cnf
   163          innodb_buffer_pool_dump_at_shutdown=OFF
   164          innodb_buffer_pool_in_core_file=OFF
   165          innodb_buffer_pool_load_at_startup=OFF
   166          innodb_buffer_pool_size=64M
   167          innodb_doublewrite=OFF
   168          innodb_flush_log_at_trx_commit=0
   169          innodb_flush_method=O_DIRECT
   170          innodb_numa_interleave=ON
   171          innodb_adaptive_hash_index=OFF
   172          sync_binlog=0
   173          sync_relay_log=0
   174          performance_schema=OFF
   175          slow-query-log=OFF
   176          EOF
   177          {{end}}
   178  
   179          # run the tests however you normally do, then produce a JUnit XML file
   180          eatmydata -- go run test.go -docker={{if .Docker}}true -flavor={{.Platform}}{{else}}false{{end}} -follow -shard {{.Shard}}{{if .PartialKeyspace}} -partial-keyspace=true {{end}} | tee -a output.txt | go-junit-report -set-exit-code > report.xml
   181  
   182      - name: Print test output and Record test result in launchable
   183        if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
   184        run: |
   185          # send recorded tests to launchable
   186          launchable record tests --build "$GITHUB_RUN_ID" go-test . || true
   187  
   188          # print test output
   189          cat output.txt