github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/.github/workflows/dm_binlog_999999.yaml (about)

     1  name: DM Binlog 999999
     2  
     3  on:
     4    schedule:
     5      - cron: '0 17-23 * * *' # run at minute 0 every hour from 01:00 ~ 07:00 UTC+8
     6    workflow_dispatch:
     7      inputs:
     8        pr:
     9          description: 'Which PR do you want to trigger'
    10          required: true
    11          default: ''
    12  
    13  jobs:
    14    test-binlog-999999:
    15      name: Test binlog 999999
    16      runs-on: ubuntu-20.04
    17  
    18      steps:
    19        - name: Set up Go env
    20          uses: actions/setup-go@v3
    21          with:
    22            go-version: '1.21'
    23  
    24        - name: Check out code
    25          uses: actions/checkout@v2
    26  
    27        - name: Check out code by workflow dispatch
    28          if: ${{ github.event.inputs.pr != '' }}
    29          uses: actions/checkout@v2
    30          with:
    31            ref: refs/pull/${{ github.event.inputs.pr }}/head
    32  
    33        - name: Cache go modules
    34          uses: actions/cache@v2
    35          with:
    36            path: ~/go/pkg/mod
    37            key: ${{ runner.os }}-ticdc-${{ hashFiles('go.sum') }}
    38  
    39        - name: Cache Tools
    40          id: cache-tools
    41          uses: actions/cache@v2
    42          with:
    43            path: tools/bin
    44            key: ${{ runner.os }}-ticdc-tools-${{ hashFiles('tools/check/go.sum') }}
    45  
    46        - name: Build DM binary
    47          run: make dm_integration_test_build
    48  
    49        - name: Setup CI environment
    50          run: |
    51            docker-compose -f ./dm/tests/binlog_999999/docker-compose.yml up -d
    52            curl http://download.pingcap.org/tidb-enterprise-tools-nightly-linux-amd64.tar.gz | tar xz
    53            mv tidb-enterprise-tools-nightly-linux-amd64/bin/sync_diff_inspector bin/
    54            curl http://download.pingcap.org/tidb-nightly-linux-amd64.tar.gz | tar xz
    55            mv tidb-nightly-linux-amd64/bin/tidb-server bin/
    56            curl -O https://dl.min.io/server/minio/release/linux-amd64/minio
    57            chmod +x minio
    58            mv minio bin/
    59  
    60        - name: change binlog sequence number to 999998
    61          run: |
    62            while ! mysqladmin -h127.0.0.1 -P3306 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do
    63              echo "wait mysql"
    64              sleep 1
    65            done
    66            while ! mysqladmin -h127.0.0.1 -P3307 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do
    67              echo "wait mysql"
    68              sleep 1
    69            done
    70  
    71            echo "reset master;" | mysql -uroot -h127.0.0.1 -P3306 -p123456
    72            echo "reset master;" | mysql -uroot -h127.0.0.1 -P3307 -p123456
    73            docker-compose -f ./dm/tests/binlog_999999/docker-compose.yml down
    74  
    75            sudo mv /tmp/mysql1-data/mysql-bin.000001 /tmp/mysql1-data/mysql-bin.999998
    76            sudo bash -c "echo './mysql-bin.999998' > /tmp/mysql1-data/mysql-bin.index"
    77            sudo mv /tmp/mysql2-data/mysql-bin.000001 /tmp/mysql2-data/mysql-bin.999998
    78            sudo bash -c "echo './mysql-bin.999998' > /tmp/mysql2-data/mysql-bin.index"
    79            docker-compose -f ./dm/tests/binlog_999999/docker-compose.yml up -d
    80  
    81            while ! mysqladmin -h127.0.0.1 -P3306 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do
    82              echo "wait mysql"
    83              sleep 1
    84            done
    85            while ! mysqladmin -h127.0.0.1 -P3307 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do
    86              echo "wait mysql"
    87              sleep 1
    88            done
    89  
    90        - name: Run test cases
    91          run: |
    92            RESET_MASTER=false make dm_integration_test CASE=incremental_mode
    93            echo "show binary logs;" | mysql -uroot -h127.0.0.1 -P3306 -p123456 | grep -q "mysql-bin.1000000"
    94            echo "show binary logs;" | mysql -uroot -h127.0.0.1 -P3307 -p123456 | grep -q "mysql-bin.1000000"
    95  
    96        - name: Copy logs to hack permission
    97          if: ${{ always() }}
    98          run: |
    99            mkdir ./logs
   100            sudo cp -r -L /tmp/dm_test/incremental_mode/master/log ./logs/master
   101            sudo cp -r -L /tmp/dm_test/incremental_mode/worker1/log ./logs/worker1
   102            sudo cp -r -L /tmp/dm_test/incremental_mode/worker2/log ./logs/worker2
   103            sudo chown -R runner ./logs
   104  
   105        # Update logs as artifact seems not stable, so we set `continue-on-error: true` here.
   106        - name: Upload logs
   107          continue-on-error: true
   108          uses: actions/upload-artifact@v2
   109          if: ${{ always() }}
   110          with:
   111            name: test-binlog-999999
   112            path: |
   113              ./logs
   114  
   115        # send Slack notify if failed.
   116        # NOTE: With the exception of `GITHUB_TOKEN`, secrets are not passed to the runner when a workflow is triggered from a forked repository.
   117        - name: Slack notification
   118          if: ${{ failure() }}
   119          env:
   120            SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFY }}
   121          uses: Ilshidur/action-slack@2.1.0
   122          with:
   123            args: "binlog 999999 failed, see https://github.com/pingcap/tiflow/actions/runs/{{ GITHUB_RUN_ID }}"