Parcourir la source

Add wasm ci (#1293)

* add wasm

* improve wasm ci

* improve wasm ci

* improve wasm ci

* improve tests

* improve ci
ruki il y a 3 ans
Parent
commit
e56cd20641
3 fichiers modifiés avec 42 ajouts et 2 suppressions
  1. 40 0
      .github/workflows/wasm_ubuntu.yml
  2. 1 1
      scripts/packages.lua
  3. 1 1
      scripts/test.lua

+ 40 - 0
.github/workflows/wasm_ubuntu.yml

@@ -0,0 +1,40 @@
+name: Wasm (Ubuntu)
+
+on:
+  pull_request:
+    branches:
+      - dev
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        kind: [static, shared]
+
+    runs-on: ${{ matrix.os }}
+
+    concurrency:
+        group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-MingW-Ubuntu-${{ matrix.kind }}
+        cancel-in-progress: true
+    steps:
+      - uses: actions/checkout@v1
+      - uses: xmake-io/github-action-setup-xmake@v1
+        with:
+          xmake-version: branch@dev
+
+      - name: Prepare
+        uses: mymindstorm/setup-emsdk@v11
+        with:
+          # Make sure to set a version number!
+          version: 1.38.40
+          # This is the name of the cache folder.
+          # The cache folder will be placed in the build directory,
+          #  so make sure it doesn't conflict with anything!
+          actions-cache-folder: emsdk-cache-${{ matrix.kind }}
+
+      - name: Tests
+        run: |
+          emcc -v
+          xmake l ./scripts/test.lua -D -p wasm -k ${{ matrix.kind }} zlib
+

+ 1 - 1
scripts/packages.lua

@@ -71,7 +71,7 @@ function main(opt)
             instance._BASE = package.load_from_repository(basename, nil, basedir, basefile)
         end
         if instance then
-            for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys", "bsd", "cross"}) do
+            for _, plat in ipairs({"windows", "linux", "macosx", "iphoneos", "android", "mingw", "msys", "bsd", "wasm", "cross"}) do
                 local archs = platform.archs(plat)
                 if archs then
                     local package_archs = {}

+ 1 - 1
scripts/test.lua

@@ -123,7 +123,7 @@ function _package_is_supported(argv, packagename)
             if package and packagename:split("%s+")[1] == package.name then
                 local arch = argv.arch
                 if not arch and plat ~= os.subhost() then
-                    arch = platform.archs(plat)[1]
+                    arch = table.wrap(platform.archs(plat))[1]
                 end
                 if not arch then
                     arch = os.subarch()