有没有办法设置travis-ci来构建不同语言的多个项目?
让我们说我的回购是
AwesomeRepoThatDoestOneThingInDifferentLanguages
-cpp
-csharp
-python2
-python3
-java
-go
-ruby
-lua
-objectivec
现在,我希望将ci应用于此。 如果我只是将.travis.yml文件添加到我的python2项目中,travis-ci会抱怨找不到.travis.yml,因为它在repo的根目录中寻找一个.travis.yml。 那么,有没有办法可以将.travis.yml放在顶部,然后在每个子模块中进一步调用travis.yml?
答案 0 :(得分:2)
我能够找到一种实际执行此操作的方法。这项工作尚未完成,因为某些工作仍然失败,我需要单独修复它们,但总的来说这个想法很好。
我正在使用travis ci的矩阵方式。这是我的.travis.yml
认为如果其他人有相同的问题或情况,这可能会有所帮助。
---
matrix:
include:
-
before_script:
- "cd java"
jdk: oraclejdk8
language: java
script: "mvn clean package"
-
before_script:
- "cd python2"
- "pip install --upgrade setuptools"
- "pip install nose"
- "pip freeze > requirements.txt"
- "pip install -r requirements.txt"
- "cd tests"
cache: pip
language: python
python: 2.7
script: nosetests
-
before_script:
- "cd python3"
- "pip install --upgrade setuptools"
- "pip install nose"
- "pip freeze > requirements.txt"
- "pip install -r requirements.txt"
- "cd tests"
language: python
python: 3.6
script: nosetests
-
before_script:
- "cd objectivec"
language: objective-c
os: osx
osx_image: xcode10
script:
- "xcodebuild clean test -project DiffMatchPatch.xcodeproj -scheme DiffMatchPatch -destination 'platform=OS X,arch=x86_64'"
-
before_script:
- "sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa"
- "sudo apt-get update -qq"
- "sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev"
language: cpp
script:
- "qmake -qt=qt5 -v"
- "qmake -qt=qt5"
- make
-
before_script:
- "cd csharp"
dotnet: "1.1.5"
env: DOTNETCORE=1
language: csharp
mono: latestscript
script:
- "dotnet restore"
solution: solution-name.sln
-
before_script:
- "cd dart"
dart: "1.15.0"
dart_task:
-
test: "--exclude-tags no-xvfb"
-
test: "--tags no-xvfb"
language: dart
with_content_shell: true
-
after_success:
- coveralls -b .. -r .. -i ./lua --dump c.report.json
- luacov-coveralls -j c.report.json -v
before_install:
- "cd lua"
- "pip install --upgrade pip"
- "pip install --upgrade setuptools"
- "pip freeze > requirements.txt"
- "pip install -r requirements.txt"
- "sudo wget https://luarocks.org/releases/luarocks-2.4.4.tar.gz"
- "sudo tar zxpf luarocks-2.4.4.tar.gz"
- "cd luarocks-2.4.4"
- "./configure --prefix=/usr/local/openresty/luajit \
--with-lua=/usr/local/openresty/luajit \
--lua-suffix=jit-2.1.0-beta2 \
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1; sudo make bootstrap"
- "sudo luarocks install luasocket"
- "pip install cpp-coveralls"
- "luarocks install Lua-cURL --server=https://luarocks.org/dev"
- "luarocks install luacov-coveralls --server=https://luarocks.org/dev"
- "luarocks install lunitx"
- "luarocks install luabitop"
language: python
script:
- "lunit.sh tests/diff_match_patch_test.lua"
- "lunit.sh tests/speedtest.lua"
notifications:
email:
-
sudo: required