Bladeren bron

Merge pull request #1 from langgenius/feat/add-arm64-ci

feat: arm64 tests
Yeuoly 1 jaar geleden
bovenliggende
commit
5ce1bc3314
3 gewijzigde bestanden met toevoegingen van 42 en 34 verwijderingen
  1. 2 2
      .github/workflows/tests.yml
  2. 38 30
      .github/workflows/tests-arm64.yml
  3. 2 2
      cmd/test/fuzz_python_amd64/test.py

+ 2 - 2
.github/workflows/tests.yml

@@ -9,12 +9,12 @@ on:
       - main
 
 concurrency:
-  group: test-tests-${{ github.head_ref || github.run_id }}
+  group: test-amd64-${{ github.head_ref || github.run_id }}
   cancel-in-progress: true
 
 jobs:
   test:
-    name: Test
+    name: Test AMD64
     runs-on: ubuntu-latest
 
     steps:

+ 38 - 30
.github/workflows/tests-arm64.yml

@@ -1,4 +1,4 @@
-name: ARM Linux Simulation
+name: Run GoTest
 
 on:
   pull_request:
@@ -8,35 +8,43 @@ on:
     branches:
       - main
 
+concurrency:
+  group: test-arm64-${{ github.head_ref || github.run_id }}
+  cancel-in-progress: true
+
 jobs:
-  simulate-arm-linux:
-    runs-on: macos-13
+  test:
+    name: Test ARM64
+    runs-on: arm64_runner
 
     steps:
-    - name: Checkout code
-      uses: actions/checkout@v4
-
-    - name: Install Docker
-      run: |
-        brew install --cask docker
-        open --background -a /Applications/Docker.app
-
-    - name: Pull ARM64 Docker image
-      run: |
-        docker pull --platform linux/arm64 ubuntu:20.04
-
-    - name: Run ARM64 Docker container
-      run: |
-        docker run --privileged --rm --platform linux/arm64 -v $(pwd):/workspace -w /workspace ubuntu:20.04 /bin/bash -c "
-          apt-get update &&
-          apt-get install -y qemu-user-static binfmt-support &&
-          # Your ARM-specific commands go here
-          echo 'Running on ARM architecture'
-        "
-
-    - name: Run your tasks in the ARM container
-      run: |
-        docker run --privileged --rm --platform linux/arm64 -v $(pwd):/workspace -w /workspace ubuntu:20.04 /bin/bash -c "
-          # Execute your test commands or build scripts here
-          ./your-script.sh
-        "
+      - name: Checkout code
+        uses: actions/checkout@v4
+
+      - name: Install System Dependencies
+        run: sudo apt-get install -y pkg-config gcc libseccomp-dev
+
+      - name: Set up Go
+        uses: actions/setup-go@v4
+        with:
+          go-version: 1.20.6
+
+      - name: Install dependencies
+        run: go mod tidy
+
+      - name: Compile library
+        run: bash ./build/build_arm64.sh
+
+      - name: Setup Python3.10
+        run: sudo apt-get install -y python3.10 python3-pip
+
+      - name: Install Python dependencies
+        run: pip install httpx requests jinja2
+
+      - name: Link Go
+        run: sudo ln -s "$(which go)" /usr/local/bin/go
+
+      - name: Run Intgeration tests
+        run: sudo go test -v github.com/langgenius/dify-sandbox/tests/integration_tests/...
+        env:
+          PYTHON_PATH: /usr/bin/python3.10

+ 2 - 2
cmd/test/fuzz_python_amd64/test.py

@@ -31,8 +31,8 @@ lib.DifySeccomp(65537, 1001, 1)
 
 # declare main function here
 def main() -> dict:
-    import json
-    print(json.dumps({"hello": "world"}))
+    import requests
+    print(requests.get("https://www.google.com").text)
 
 from json import loads, dumps
 from base64 import b64decode