travis-ci / beta-features

The perfect place to leave feedback and comments on newly released Beta Features.
56 stars 68 forks source link

Use of Build Stages, Extra Python Job #41

Closed gmr closed 6 years ago

gmr commented 6 years ago

When using Build Stages, given the following config:

sudo: false
language: python
python:
 - 2.7
 - 3.4
 - 3.5
 - 3.6
 - pypy
 - pypy3
install:
 - pip install awscli
 - pip install -r requires/testing.txt
 - python setup.py develop
stages:
 - test
 - name: upload_coverage
   if: branch = master
 - name: deploy
   if: tag IS present
script: nosetests
jobs:
  include:
   - stage: test
     services:
     - postgres
     script: nosetests

For the test stage there are 2 jobs created for Python 2.7. So for stage "Test" I will see:

You can see this in two different projects:

gmr commented 6 years ago

Another example:

duplicated 2 6

gmr commented 6 years ago

From what I can tell this relates to #42.

It appears that all jobs but the last one in the list are run in the high-level "test" job/stage. The last entry is run in the "jobs > includes" definition as they don't seem to allow a list of python versions to use and default to the first one if no version is specified.

To get this to work as I would expect I ended up with this short-hand version of the .travis.yml:

language: python
stages:
- test
- coverage
- name: deploy
  if: tag IS present
script: nosetests
jobs:
  include:
   - python: 2.7
   - python: 3.4
   - python: 3.5
   - python: 3.6
   - stage: coverage
     python: 3.6
     install:
     - pip install awscli coverage codecov
     script:
     - Do my coverage stuff here
     after_success: codecov
   - stage: deploy
     python: 3.6
     script: true
     deploy:
       distributions: sdist bdist_wheel
joshk commented 6 years ago

As Stages is now released and GA, I'm going to close this issue.

If you have any feedback on improvements we should consider, please feel free to add a discussion in our new Community forum: https://travis-ci.community/c/product

Happy building

Josh

gwthm-in commented 5 years ago
language: go

go: 1.11.5

env:
  global:
    - ETCD_VER=v3.3.0 
    - GO111MODULE=on
    - DOCKER_LATEST=latest

setup_etcd: &setup_etcd
  before_script:
    - curl -L https://github.com/coreos/etcd/releases/download/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
    - mkdir -p /tmp/etcd
    - tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd --strip-components=1
    - /tmp/etcd/etcd --advertise-client-urls http://127.0.0.1:12379 --listen-client-urls http://127.0.0.1:12379 > /dev/null &

services:
  - docker

stages:
  - test
  - name: deploy
    if: (repo == gojektech/weaver) AND (branch == master) AND (tag IS present)

# travis is stupid to do its own custom install and script things
# This is the only way to skip them from running
install: echo "Skip global installing..."
script: echo "Skip global script..."

jobs:
  include:
    - stage: test
    - name: "Make Spec"
      <<: *setup_etcd
      script: make test
    - name: "Docker Spec"
      script: make docker-spec
      after_script: make docker-clean

    - stage: deploy
    - name: "Release Builds"
      script: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist --skip-validate
    - name: "Docker Builds"
      before_script:
        - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
        - docker build . -t gojektech/weaver:$TRAVIS_TAG
        - docker tag gojektech/weaver:$TRAVIS_TAG gojektech/weaver:$DOCKER_LATEST
        - docker images
      script: docker push gojektech/weaver:$TRAVIS_TAG && docker push gojektech/weaver:$DOCKER_LATEST

notifications:
  email: false

Can someone help me to understand why this is creating 3 jobs? Couldn't understand why the very first job is created and how to avoid this?

screenshot 2019-02-20 at 12 42 37 pm