|
| 1 | +name: reusable_testing |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + artifact_name: |
| 7 | + description: The name of the tarantool build artifact |
| 8 | + default: ubuntu-focal |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + |
| 12 | +jobs: |
| 13 | + run_tests: |
| 14 | + runs-on: ubuntu-20.04 |
| 15 | + steps: |
| 16 | + - name: Clone the go-tarantool connector |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + repository: ${{ github.repository_owner }}/go-tarantool |
| 20 | + |
| 21 | + - name: Download the tarantool build artifact |
| 22 | + uses: actions/download-artifact@v2 |
| 23 | + with: |
| 24 | + name: ${{ inputs.artifact_name }} |
| 25 | + |
| 26 | + - name: Install tarantool |
| 27 | + # Now we're lucky: all dependencies are already installed. Check package |
| 28 | + # dependencies when migrating to other OS version. |
| 29 | + run: sudo dpkg -i tarantool*.deb |
| 30 | + |
| 31 | + - name: Get the tarantool version |
| 32 | + run: | |
| 33 | + TNT_VERSION=$(tarantool --version | grep -e '^Tarantool') |
| 34 | + echo "TNT_VERSION=$TNT_VERSION" >> $GITHUB_ENV |
| 35 | +
|
| 36 | + - name: Setup golang for connector and tests |
| 37 | + uses: actions/setup-go@v2 |
| 38 | + with: |
| 39 | + go-version: 1.13 |
| 40 | + |
| 41 | + - name: Run base tests |
| 42 | + run: | |
| 43 | + mkdir snap xlog |
| 44 | + TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!) |
| 45 | + go clean -testcache && go test -v |
| 46 | + kill $TNT_PID |
| 47 | +
|
| 48 | +# TODO(ylobankov): Uncomment this when tarantool/go-tarantool#115 is resolved. |
| 49 | +# - name: Run queue tests |
| 50 | +# working-directory: ./queue |
| 51 | +# run: | |
| 52 | +# mkdir snap xlog |
| 53 | +# tarantoolctl rocks install queue 1.1.0 |
| 54 | +# TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!) |
| 55 | +# go clean -testcache && go test -v |
| 56 | +# kill $TNT_PID |
| 57 | + |
| 58 | + - name: Run uuid tests |
| 59 | + working-directory: ./uuid |
| 60 | + run: | |
| 61 | + mkdir snap xlog |
| 62 | + TNT_PID=$(tarantool ./config.lua > tarantool.log 2>&1 & echo $!) |
| 63 | + go clean -testcache && go test -v |
| 64 | + kill $TNT_PID |
| 65 | + if: ${{ !startsWith(env.TNT_VERSION, 'Tarantool 1.10') }} |
| 66 | + |
| 67 | + - name: Run multi tests |
| 68 | + working-directory: ./multi |
| 69 | + run: | |
| 70 | + mkdir -p m1/{snap,xlog} m2/{snap,xlog} |
| 71 | + TNT_PID_1=$(tarantool ./config_m1.lua > tarantool_m1.log 2>&1 & echo $!) |
| 72 | + TNT_PID_2=$(tarantool ./config_m2.lua > tarantool_m2.log 2>&1 & echo $!) |
| 73 | + go clean -testcache && go test -v |
| 74 | + kill $TNT_PID_1 $TNT_PID_2 |
0 commit comments