if: tag IS present OR type = pull_request OR (branch = master AND type = push)   # we only CI the master, tags and PRs
language: python

python:
  - "2.7"
  - "3.4"
  - "3.5"
  - "3.6"
  - "3.7"

addons:
  apt:
    packages:
      - graphviz

install:
  - pip install -U pip setuptools
  - python setup.py sdist
  - pip install dist/pydot-*.tar.gz
  - pip install -r requirements.txt

script:
  - cd test/
  - python pydot_unittest.py

# after_success:
#   - coveralls

if: tag IS present OR type = pull_request OR (branch = master AND type = push)   # we only CI the master, tags and PRs
language: python

# Main test jobs: The lowest and highest current Python versions.
python:
  - 3.6
  - 3.9

# List additional test configurations individually, instead of using
# matrix expansion, to prevent an exponential growth of test jobs.
matrix:
  include:
    # Python versions that are EOL, but we still support.
    # PY2.7 here should bring out any PY3.5 incompatibilities as well.
    - python: 2.7
      arch: amd64
    # pydot itself should be architecture-independent. Still, some
    # limited testing on other architectures to catch corner cases.
    - python: 2.7
      arch: ppc64le
    - python: 3.9
      arch: ppc64le

addons:
  apt:
    packages:
      - graphviz

install:
  - pip install -U pip setuptools
  - python setup.py sdist
  - pip install dist/pydot-*.tar.gz
  - pip install -r requirements.txt

script:
  - cd test/
  - python pydot_unittest.py

# after_success:
#   - coveralls

Add ppc64le and bump Python versions in Travis CI
Add ppc64le and bump Python versions in Travis CI

Considering that:

- IBM, through its supplier Datamatics, requested many Python projects
  to [add the `ppc64le` (Power) architecture][1] to their Travis CI
  test matrices. Related links:
  - ibm.com: [Build your open source projects on IBM Power Systems with
    Travis CI][2].
  - youtube.com: [OpenPOWER Summit NA 2019: Developing Applications
    using Acceleration Hardware on Power][3].
  - Gerrit Huizenga of IBM (@gerrith3 on GitHub) provided more details
    on the [motives and open source contributions of IBM][4] in answer
    to questions from Ludovic Fernandez (@ldez) of nrdcg/goinwx.
- The request to add `ppc64` testing was also made to pydot in PR
  [pydot/pydot#243][5] by @asellappen of Datamatics. The proposed
  implementation extended the test job configuration by [matrix
  expansion][6].
- [Matrix expansion][7] means adding a new dimension to the build
  configuration (e.g. `arch`, `os`, `env`), after which the number of
  test jobs is automatically multiplied by the number of choices given
  in the newly added dimension. In this case, it would add a dimension
  of two architectures, expanding the matrix of test jobs by a factor
  of 2: 5 Python versions (at that time) * 2 architectures = 10 test
  runs of 2 to 3 minutes each.
- Gerrit Huizenga of IBM said he thinks the adding of `ppc64le` test
  jobs to Travis will not lead to additional billing from Travis CI to
  the OSS community, because [he provides Travis CI with the Power
  hardware][8].
- The [Travis CI documentation on CPU architectures][9] currently says
  IBM architecture support is in beta stage and only available for Open
  Source repositories.
- There are many abstraction layers between pydot and the hardware
  architecture, including other libraries, Python and the operating
  system. Pydot itself does not need to be compiled for a specific
  architecture. In a perfect world, pydot is architecture-independent
  and testing pydot on a single architecture should be sufficient.
- However, the world is not perfect and [abstraction layers can be
  leaky][10]. According to Gerrit Huizenga of IBM, [corner cases do
  come up][11], which is why they do so much testing up front and
  provide free access to testing.
- Still, even if an automated testing service is provided for free, it
  has an [environmental footprint][12], so there are limits to how much
  we should make use of that as well.
- Travis CI also requests open-source users to remember that Travis CI
  provides its service free of charge to the community and only specify
  the matrix we [actually need][13].
- Even if we ever find an architecture-specific bug in pydot, it seems
  highly likely that it will come out on several Python versions for
  that architecture.
- All of this was further discussed between pydot maintainers Sebastian
  Kalinowski (@prmtl) and Peter Nowee (@peternowee) and Gerrit Huizenga
  of IBM in PR [pydot/pydot#245][14].

The following was decided:

- Baseline testing is kept at `amd64`, with testing of the lowest and
  the highest Python versions supported by the Python community, as
  well as the lowest end-of-life (EOL) Python version that we still
  choose to support pydot on. Currently, that means Python 3.6, 3.9 and
  2.7 respectively.
- For other architectures, such as `ppc64le`, we do limited testing to
  catch reasonably expectable corner cases and validate architecture
  independence in a resource conserving way. For now, we start with
  Python 2.7 and 3.9.

We can always reconsider this policy depending on actual findings.

[1]: https://github.com/pulls?q=author%3Aasellappen+ppc64le+travis
[2]: https://developer.ibm.com/tutorials/travis-ci-on-power/
[3]: https://www.youtube.com/watch?v=qPZtf3hoMSs
[4]: https://github.com/nrdcg/goinwx/pull/5
[5]: https://github.com/pydot/pydot/pull/243
[6]: https://docs.travis-ci.com/user/build-matrix/#matrix-expansion
[7]: https://config.travis-ci.com/matrix_expansion
[8]: https://github.com/nrdcg/goinwx/pull/5#issuecomment-721422838
[9]: https://docs.travis-ci.com/user/multi-cpu-architectures/
[10]: https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/
[11]: https://github.com/nrdcg/goinwx/pull/5#issuecomment-719084047
[12]: https://en.wikipedia.org/wiki/Data_center#Energy_use
[13]: https://docs.travis-ci.com/user/build-matrix/#listing-individual-jobs
[14]: https://github.com/pydot/pydot/pull/245
