THRIFT-4547: Swift crosstests (#2670)

Co-authored-by: Jiayu Liu <Jimexist@users.noreply.github.com>
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 99c92aa..2187776 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -183,6 +183,66 @@
             lib/kotlin/cross-test-server/build/install/TestServer/
           retention-days: 3
 
+  lib-swift:
+    needs: compiler
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v3
+      
+      - name: Run bootstrap
+        run: ./bootstrap.sh
+
+      - name: Run configure
+        run: |
+          ./configure \
+            --disable-debug \
+            --disable-tests \
+            --disable-dependency-tracking \
+            --without-cpp \
+            --without-c_glib \
+            --without-java \
+            --without-kotlin \
+            --without-python \
+            --without-py3 \
+            --without-ruby \
+            --without-haxe \
+            --without-netstd \
+            --without-perl \
+            --without-php \
+            --without-php_extension \
+            --without-dart \
+            --without-erlang \
+            --without-go \
+            --without-d \
+            --without-nodejs \
+            --without-nodets \
+            --without-lua \
+            --without-rs \
+            --with-swift
+            
+      - uses: actions/download-artifact@v3
+        with:
+          name: thrift-compiler
+          path: compiler/cpp
+
+      - name: Run thrift-compiler
+        run: |
+          chmod a+x compiler/cpp/thrift
+          compiler/cpp/thrift -version
+          
+      - name: Run make precross for swift
+        run: make -C test/swift precross
+
+      - name: Upload swift precross artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: swift-precross
+          if-no-files-found: error
+          path: |
+            test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer
+            test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient
+          retention-days: 3
+
   lib-rust:
     needs: compiler
     runs-on: ubuntu-20.04
@@ -275,6 +335,7 @@
   cross-test:
     needs:
       - lib-java-kotlin
+      - lib-swift
       - lib-rust
     runs-on: ubuntu-20.04
     steps:
@@ -301,6 +362,12 @@
           name: kotlin-precross
           path: lib/kotlin
 
+      - name: Download swift precross artifacts
+        uses: actions/download-artifact@v3
+        with:
+          name: swift-precross
+          path: test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug
+
       - name: Download rust precross artifacts
         uses: actions/download-artifact@v3
         with:
@@ -313,12 +380,13 @@
             lib/java/build/run* \
             lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
             lib/kotlin/cross-test-server/build/install/TestServer/bin/* \
+            test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/* \
             test/rs/bin/*
 
       - name: Run cross test
         env:
           THRIFT_CROSSTEST_CONCURRENCY: 4
-          PRECROSS_LANGS: java,kotlin,rs
+          PRECROSS_LANGS: java,kotlin,rs,swift
         run: |
           python test/test.py \
             --retry-count 5 \