THRIFT-5564: [CI] use GitHub workflow matrix to parallel cross tests (#2801)

* use github to parallel cross tests

* fix syntax

* correct syntax

* split more

* update fail-fast

* fix swift'
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 911b3b5..c3d98b0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -418,6 +418,12 @@
       - lib-go
       - lib-python
     runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        server_lang: ['java', 'kotlin', 'go', 'rs', 'swift']
+        # we always use comma join as many client langs as possible, to reduce the number of jobs
+        client_lang: ['java,kotlin', 'go,rs', 'swift']
+      fail-fast: false
     steps:
       - uses: actions/checkout@v3
 
@@ -480,13 +486,12 @@
       - name: Run cross test
         env:
           THRIFT_CROSSTEST_CONCURRENCY: 4
-          PRECROSS_LANGS: java,kotlin,go,rs,swift
         run: |
           python test/test.py \
             --retry-count 5 \
             --skip-known-failures \
-            --server $PRECROSS_LANGS \
-            --client $PRECROSS_LANGS
+            --server ${{ matrix.server_lang }} \
+            --client ${{ matrix.client_lang }}
 
       - name: Upload log files from failed cross test runs
         uses: actions/upload-artifact@v3