每个travis-ci作业使用单独的after_success命令

时间:2019-02-17 19:11:56

标签: travis-ci

我有以下构建设置,但是当前它对所有作业使用install,before_install和install脚本。我想为“更新版本”作业定义不同的任务。具体来说,我不需要“更新版本”的安装脚本或before_install脚本,而我需要稍微修改after_success脚本。这可能吗?我还仍然需要使用env矩阵来定义作业。更多变量将在以后添加。

language: c
sudo: false
#Disable caching during development
#cache:
#  directories:
#    - ~/arduino_ide
#    - ~/.arduino15/packages/
git:
  depth: false
  quiet: true

env:
  global:
    #Not used right now
     - ARDUINO_CLI_VERSION="1.8.7"
  matrix:
    - SKETCH="Generic_RGBW_Light"
    - SKETCH="Generic_RGB_Light"

# Install arduino-cli and add to $PATH
before_install:
   - wget https://downloads.arduino.cc/arduino-cli/arduino-cli-latest-linux64.tar.bz2 -O $HOME/arduino-cli.tar.bz2
   - mkdir $HOME/arduino-cli && tar -xf $HOME/arduino-cli.tar.bz2 -C $HOME/arduino-cli && cd ~/arduino-cli && mv * arduino-cli
   - export PATH="$HOME/arduino-cli:$PATH"
   - rm $HOME/arduino-cli.tar.bz2

install:
  # Add ESP8266 url to board manager
  - wget https://raw.githubusercontent.com/cheesemarathon/Lights/master/.cli-config.yml -P $HOME/arduino-cli/
  # Update board manager
  - arduino-cli core update-index
  # Install ESP8266 board files
  - arduino-cli core install esp8266:esp8266
  # Install WiFiManager Library
  - arduino-cli lib install "WiFiManager"

script:
  # Test command: find ${TRAVIS_BUILD_DIR}/Arduino -name '*.ino' | cut -d '/' -f 6
  # Compile the sketch for NodeMCU board
  - arduino-cli compile --fqbn esp8266:esp8266:nodemcu ${TRAVIS_BUILD_DIR}/Arduino/$SKETCH/$SKETCH.ino --output ${TRAVIS_BUILD_DIR}/Arduino/bin/$SKETCH.bin

# Push build files to repo
after_success:
- >
  if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
    cd ${TRAVIS_BUILD_DIR}
    git checkout master
    git add *
    git commit --message "Build $SKETCH #${TRAVIS_BUILD_NUMBER} [skip travis]"
    git remote add origin-travis https://${GH_TOKEN}@github.com/cheesemarathon/Lights.git
    git push origin-travis master
  fi

jobs:
  include:
    - stage: Update versions
      script:
        - echo "Running a script"

travis jobs

0 个答案:

没有答案