inkwell 0.1.0-beta.4

Inkwell aims to help you pen your own programming languages by safely wrapping llvm-sys.
language: rust
sudo: required
cache:
  directories:
    - /home/travis/.cargo

before_cache:
  - cargo install cargo-tarpaulin
  - rm -rf /home/travis/.cargo/registry
include_base: &BASE
  addons:
    apt:
      sources: &BASE_SOURCES
        - ubuntu-toolchain-r-test
      packages: &BASE_PACKAGES
        - libelf-dev
        - lib32z1-dev
        - libedit-dev
        - libdw-dev
        - binutils-dev
        - libiberty-dev
        - libssl-dev
  before_install:
    - export LLVM_VERSION_DASH=${LLVM_VERSION/./-}
    - export PATH=/usr/lib/llvm-${LLVM_VERSION}/bin/:$HOME/.local/bin:$PATH
    - export LLVM_PATH=/usr/share/llvm-${LLVM_VERSION}/cmake/
  script:
    - cargo build --features "target-all,llvm${LLVM_VERSION_DASH}" --color=always
    - cargo test --features "target-all,llvm${LLVM_VERSION_DASH}" --verbose --color=always

matrix:
  fast_finish: true
  include:
    - env:
        - LLVM_VERSION="3.6"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-precise-3.6
          packages:
            - *BASE_PACKAGES
            - llvm-3.6-dev
      rust: 1.52
      dist: trusty
    - env:
        - LLVM_VERSION="3.7"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-precise-3.7
          packages:
            - *BASE_PACKAGES
            - llvm-3.7-dev
      rust: 1.52
      dist: trusty
    - env:
        - LLVM_VERSION="3.8"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-precise-3.8
          packages:
            - *BASE_PACKAGES
            - llvm-3.8-dev
      rust: 1.52
      dist: trusty
    # 3.9 seems to have a linking issue :/
    # - env:
    #     - LLVM_VERSION="3.9"
    #   <<: *BASE
    #   addons:
    #     apt:
    #       sources:
    #         - *BASE_SOURCES
    #         - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main'
    #           key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
    #       packages:
    #         - *BASE_PACKAGES
    #         - llvm-3.9-dev
    #   rust: 1.42.0
    #   dist: xenial
    - env:
        - LLVM_VERSION="4.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-trusty-4.0
          packages:
            - *BASE_PACKAGES
            - llvm-4.0-dev
      rust: 1.52
      dist: trusty
    - env:
        - LLVM_VERSION="5.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-trusty-5.0
          packages:
            - *BASE_PACKAGES
            - llvm-5.0-dev
      rust: 1.52
      dist: trusty
    - env:
        - LLVM_VERSION="6.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-trusty-6.0
          packages:
            - *BASE_PACKAGES
            - llvm-6.0-dev
      rust: 1.52
      dist: trusty
    - env:
        - LLVM_VERSION="7.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-trusty-7
          packages:
            - *BASE_PACKAGES
            - llvm-7-dev
      rust: 1.52
      dist: trusty
    - env:
        - LLVM_VERSION="8.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-trusty-8
          packages:
            - *BASE_PACKAGES
            - llvm-8-dev
      rust: 1.45.2
      dist: trusty
    - env:
        - LLVM_VERSION="9.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-bionic-9
            - sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - *BASE_PACKAGES
            - llvm-9-dev
      rust: 1.52
      dist: bionic
    - env:
        - LLVM_VERSION="10.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-bionic-10
            - sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - *BASE_PACKAGES
            - llvm-10-dev
            - libclang-common-10-dev
      rust: 1.52
      dist: bionic
    - env:
        - LLVM_VERSION="11.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-bionic-11
            - sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - *BASE_PACKAGES
            - llvm-11-dev
            - libclang-common-11-dev
      rust: 1.52
      dist: bionic
    - env:
        - LLVM_VERSION="12.0"
      <<: *BASE
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            - llvm-toolchain-bionic-12
            - sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - *BASE_PACKAGES
            - llvm-12-dev
            - libclang-common-12-dev
      rust: 1.52
      dist: bionic
    - deploy: # Documentation build; Only latest supported LLVM version for now
        provider: pages
        skip-cleanup: true
        github-token: $GITHUB_TOKEN  # Set in travis-ci.org dashboard, marked secure
        keep-history: false
        local-dir: target/doc/
        on:
          branch: master
      before_install:
        - export PATH=/usr/lib/llvm-12/bin/:$HOME/.local/bin:$PATH
        - export LLVM_PATH=/usr/share/llvm-12/cmake/
      script:
        - cargo doc --no-default-features --features "target-all,llvm12-0,nightly" --color=always
        - echo '<meta http-equiv="refresh" content="1; url=inkwell/index.html">' > target/doc/index.html
      rust: nightly
      name: "GitHub IO Documentation Deployment"
      addons:
        apt:
          sources:
            - *BASE_SOURCES
            # - llvm-toolchain-precise-3.6
            # - llvm-toolchain-precise-3.7
            # - llvm-toolchain-precise-3.8
            # - llvm-toolchain-trusty-3.9
            # - llvm-toolchain-trusty-4.0
            # - llvm-toolchain-trusty-5.0
            # - llvm-toolchain-trusty-6.0
            # - llvm-toolchain-trusty-7
            # - llvm-toolchain-trusty-8
            # - llvm-toolchain-bionic-9
            # llvm-toolchain-bionic-10
            # llvm-toolchain-bionic-11
            - llvm-toolchain-bionic-12
            - sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - *BASE_PACKAGES
            # - llvm-3.6-dev
            # - llvm-3.7-dev
            # - llvm-3.8-dev
            # - llvm-3.9-dev
            # - llvm-4.0-dev
            # - llvm-5.0-dev
            # - llvm-6.0-dev
            # - llvm-7-dev
            # - llvm-8-dev
            # - llvm-9-dev
            # - llvm-10-dev
            # - llvm-11-dev
            - llvm-12-dev
            - libclang-common-12-dev
      dist: bionic

env:
  global:
    - RUSTFLAGS="-C link-dead-code -C target-cpu=native -l ffi"

after_success: |
  if [[ "$TRAVIS_RUST_VERSION" == 1.45.2 ]]; then
    cargo tarpaulin --features "llvm${LLVM_VERSION_DASH}" --out Xml
    bash <(curl -s https://codecov.io/bash)
  fi

notifications:
  email: false