在Travis CI上不使用Matrix时“未设置环境变量”

时间:2019-10-20 12:30:49

标签: travis-ci

我们正在削减对测试ARM64 on Travis CI的支持。我们也停止使用标准矩阵,而改用排他的include:来减少不必要的工作。避免使用matrix:并使用include:可以节省25到50个不需要的作业。

更改的测试结果可用here。大约8个作业在配置中失败,错误为“未设置环境变量”

enter image description here

我们认为工作来自osx_image: xcode10.1中的.travis.yml。似乎不需要的作业是osx_image应用于{Linux,OS X} x {GCC,Clang} x {amd64,arm64}的结果。

我们不知道如何停止工作或如何解决这些问题。

我们如何解决“未设置环境变量” 失败的作业?


这是.travis.yml的相关部分。

language: cpp

arch:
  - amd64
  - arm64

os:
  - linux
  - osx

osx_image:
  - xcode10.1

dist: xenial
sudo: required

git:
  depth: 5

compiler:
  - clang
  - gcc

env:
  global:
    - BUILD_JOBS=2
    - ANDROID_HOME="$HOME/android-sdk"
    - ANDROID_SDK="$HOME/android-sdk"
    - ANDROID_NDK="$HOME/android-ndk"

jobs:
  include:
    - os: linux
      name: Linux with GCC (all)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=all
    - os: linux
      name: Linux with GCC (native)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=native
    - os: linux
      name: Linux with GCC (no-asm)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=no-asm
    - os: linux
      name: Linux with GCC (debug)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=debug
    - os: linux
      name: Linux with GCC (asan)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=asan
    - os: linux
      name: Linux with GCC (ubsan)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=ubsan
    - os: linux
      name: Linux with GCC (pem)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=pem
    - os: linux
      name: Linux with GCC (autotools)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=autotools
    - os: linux
      name: Linux with GCC (cmake)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=cmake
    - os: linux
      name: Linux with Clang (all)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=all
    - os: linux
      name: Linux with Clang (native)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=native
    - os: linux
      name: Linux with Clang (no-asm)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=no-asm
    - os: linux
      name: Linux with Clang (debug)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=debug
    - os: linux
      name: Linux with Clang (asan)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=asan
    - os: linux
      name: Linux with Clang (ubsan)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=ubsan
    - os: linux
      name: Linux with Clang (pem)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=pem
    - os: linux
      name: Linux with Clang (autotools)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=autotools
    - os: linux
      name: Linux with Clang (cmake)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=cmake
    - os: osx
      name: OS X with Clang (all)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=all
    - os: osx
      name: OS X with Clang (native)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=native
    - os: osx
      name: OS X with Clang (no-asm)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=no-asm
    - os: osx
      name: OS X with Clang (debug)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=debug
    - os: osx
      name: OS X with Clang (asan)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=asan
    - os: osx
      name: OS X with Clang (ubsan)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ubsan
    - os: osx
      name: OS X with Clang (pem)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=pem
    - os: osx
      name: OS X with Clang (autotools)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=autotools
    - os: osx
      name: OS X with Clang (cmake)
      arch: amd64
      compiler: clang
      env:
        - BUILD_OS=osx
        - BUILD_MODE=cmake
    - os: linux
      name: Linux with GCC (all)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=all
    - os: linux
      name: Linux with GCC (native)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=native
    - os: linux
      name: Linux with GCC (no-asm)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=no-asm
    - os: linux
      name: Linux with GCC (debug)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=debug
    - os: linux
      name: Linux with GCC (asan)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=asan
    - os: linux
      name: Linux with GCC (ubsan)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=ubsan
    - os: linux
      name: Linux with GCC (pem)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=pem
    - os: linux
      name: Linux with GCC (autotools)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=autotools
    - os: linux
      name: Linux with GCC (cmake)
      arch: arm64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=cmake
    - os: linux
      name: Linux with Clang (all)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=all
    - os: linux
      name: Linux with Clang (native)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=native
    - os: linux
      name: Linux with Clang (no-asm)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=no-asm
    - os: linux
      name: Linux with Clang (debug)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=debug
    - os: linux
      name: Linux with Clang (asan)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=asan
    - os: linux
      name: Linux with Clang (ubsan)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=ubsan
    - os: linux
      name: Linux with Clang (pem)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=pem
    - os: linux
      name: Linux with Clang (autotools)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=autotools
    - os: linux
      name: Linux with Clang (cmake)
      arch: arm64
      compiler: clang
      env:
        - BUILD_OS=linux
        - BUILD_MODE=cmake
    - os: linux
      name: Android on Linux (armeabi-v7a)
      arch: amd64
      env:
        - BUILD_OS=linux
        - BUILD_MODE=android
        - PLATFORM=armeabi-v7a
    - os: linux
      name: Android on Linux (aarch64)
      arch: amd64
      env:
        - BUILD_OS=linux
        - BUILD_MODE=android
        - PLATFORM=aarch64
    - os: linux
      name: Android on Linux (x86)
      arch: amd64
      env:
        - BUILD_OS=linux
        - BUILD_MODE=android
        - PLATFORM=x86
    - os: linux
      name: Android on Linux (x86_64)
      arch: amd64
      env:
        - BUILD_OS=linux
        - BUILD_MODE=android
        - PLATFORM=x86_64
    - os: osx
      name: iOS on OS X (iPhoneOS)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=iPhoneOS
    - os: osx
      name: iOS on OS X (Arm64)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=Arm64
    - os: osx
      name: iOS on OS X (WatchOS)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=WatchOS
    - os: osx
      name: iOS on OS X (AppleTVOS)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=AppleTVOS
    - os: osx
      name: iOS on OS X (iPhoneSimulator)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=iPhoneSimulator
    - os: osx
      name: iOS on OS X (WatchSimulator)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=WatchSimulator
    - os: osx
      name: iOS on OS X (AppleTVSimulator)
      arch: amd64
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=AppleTVSimulator

  allow_failures:
    - os: osx
      name: iOS on OS X (WatchOS)
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=WatchOS
    - os: osx
      name: iOS on OS X (iPhoneSimulator)
      env:
        - BUILD_OS=osx
        - BUILD_MODE=ios
        - PLATFORM=iPhoneSimulator

before_install:
  - |
    ...

script:
  - |
    ...

branches:
  ...

notifications:
  ...

1 个答案:

答案 0 :(得分:0)

  

我们认为工作来自osx_image:.travis.yml中的xcode10.1

这是不正确的。我们删除了全局密钥osx_image,但问题仍然存在。

但是我们仍然不太了解工作来自何处,除了它是matrix:扩张的副产品之外,我们试图避免这种扩张。


  

我们如何解决“未设置环境变量”故障的作业?

解决方法是摆脱matrix:扩展,但是它不是一时可用的信息。它当然没有在文档中说明。或者我们在文档中找不到它。

为避免matrix:扩展,请删除envarchoscompiler的所有全局键。洞察力在于,全局键会触发矩阵扩展。矩阵扩展 取决于matrix:jobs:键的存在。

Our resulting yml file looks like the following。我们必须手动构建{env} x {arch} x {os} x {compiler}的叉积(我们已经在做)。

language: cpp
dist: xenial
sudo: required

git:
  depth: 5

jobs:
  include:
    - os: linux
      name: Linux with GCC (all)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=all
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (native)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=native
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (no-asm)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=no-asm
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (debug)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=debug
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (asan)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=asan
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (ubsan)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=ubsan
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (pem)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=pem
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (autotools)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=autotools
        - BUILD_JOBS=2
    - os: linux
      name: Linux with GCC (cmake)
      arch: amd64
      compiler: gcc
      env:
        - BUILD_OS=linux
        - BUILD_MODE=cmake
        - BUILD_JOBS=2

    ...

jobs:matrix:的别名,因此使用jobs.include代替matrix.include不会达到预期的效果。另请参见Travis YML Schema