Browse Source

add travis ci

ruki 6 years ago
parent
commit
13afbeebd2
3 changed files with 42 additions and 0 deletions
  1. 18 0
      .travis.yml
  2. 23 0
      scripts/test.lua
  3. 1 0
      xmake.lua

+ 18 - 0
.travis.yml

@@ -0,0 +1,18 @@
+sudo: false
+language: C
+os:
+  - linux
+  - osx
+compiler:
+  - gcc
+  - clang
+
+install:
+  - git clone --branch=repo https://github.com/xmake-io/xmake.git tboox/xmake --depth 1
+  - cd ./tboox/xmake
+  - ./scripts/get.sh __local__
+  - cd -
+
+script:
+  - xmake l ./scripts/test.lua
+

+ 23 - 0
scripts/test.lua

@@ -0,0 +1,23 @@
+function main(...)
+    local packages = {...}
+    if #packages == 0 then
+        local files = os.iorun("git diff --name-only HEAD^")
+        for _, file in ipairs(files:split('\n'), string.trim) do
+            if file:find("packages", 1, true) and path.filename(file) == "xmake.lua" then
+                local package = path.filename(path.directory(file))
+                table.insert(packages, package)
+            end
+        end
+        table.insert(packages, "tbox")
+    end
+    if #packages > 0 then
+        local workdir = path.join(os.tmpdir(), "xmake-repo")
+        print(packages)
+        os.tryrm(workdir)
+        os.mkdir(workdir)
+        os.cd(workdir)
+        os.exec("xmake create test")
+        os.cd("test")
+        os.exec("xmake require -f -v -y %s", table.concat(packages, " "))
+    end
+end

+ 1 - 0
xmake.lua

@@ -4,3 +4,4 @@ set_xmakever("2.2.3")
 
 -- set repository description
 set_description("The official package repository of xmake")
+