travis-ci/travis-tests:.travis.yml@fbb40e4
language: ruby
# rvm:
#  - 2.6.6
env:
  - TEST_FLAG=TRUE
  - TEST_FLAG=FALSE
# separate test scenarios to separate yml files please and use build config import: https://docs.travis-ci.com/user/build-config-imports + https://blog.travis-ci.com/2019-11-11-build-config-imports
import:
- .sbom.yml

jobs:
  include:
  - name: Bionic Ruby 2.6.6 at jobs.include[1].rvm level
    os: linux
    dist: bionic
    language: ruby
    rvm: 2.6.6
    script:
      - ruby ./source/ruby_hello.rb
  - name: Bionic Ruby 2.7.5 at jobs.include[1].rvm level
    os: linux
    dist: bionic
    language: ruby
    rvm: 2.7.5
    script:
      - ruby ./source/ruby_hello.rb
  # testing basic conditionals
  - name: Bionic Ruby 2.6.6 TRUE
    os: linux
    dist: bionic
    language: ruby
    #rvm: 2.6.6
    if: (env(TEST_FLAG) = TRUE)
    script:
      - ruby ./source/ruby_hello.rb
      - echo Test flag is ${TEST_FLAG}
  - name: Bionic Ruby 2.6.6 FALSE
    os: linux
    dist: bionic
    language: ruby
    #rvm: 2.6.6
    if: (env(TEST_FLAG) = FALSE)
    script:
      - ruby ./source/ruby_hello.rb
      - echo Test flag is ${TEST_FLAG}
travis-ci/travis-tests:.sbom.yml@fbb40e4
# SBOM generation examples below
jobs:
  include:
  - name: SBOM Ruby
    os: linux
    language: ruby
    script:
      - gem build ./sbom/ruby/hello_world.gemspec
    addons:
      sbom:
        on:
          branch: 'sbom'
        run_phase: 'after_success'
        output_format: 'cyclonedx-json'
        input_dir: '/sbom/ruby'
        output_dir: '/sbom/ruby'
      deploy:
        - provider: releases
          edge: true
          file_glob: true
          file: sbom/ruby/**/*
          skip_cleanup: true
          on:
            branch: sbom
        - provider: s3
          edge: true
          bucket: "sbom-test"
          skip_cleanup: true
          local_dir: sbom/ruby
          on:
            branch: sbom
  - name: SBOM Python
    os: linux
    language: python
    script:
      - cd sbom/python
      - pip install -r requirements.txt
    addons:
      sbom:
        on:
          branch: 'sbom'
        run_phase: 'after_success'
        output_format: 'cyclonedx-json'
        input_dir: '/sbom/python'
        output_dir: '/sbom/python'
      deploy:
        - provider: releases
          edge: true
          file_glob: true
          file: sbom/python/**/*
          skip_cleanup: true
          on:
            branch: sbom
        - provider: s3
          edge: true
          bucket: "sbom-test"
          skip_cleanup: true
          local_dir: sbom/python
          on:
            branch: sbom
  - name: SBOM Go
    os: linux
    language: go
    script:
      - cd sbom/go
      - go build
    addons:
      sbom:
        on:
          branch: 'sbom'
        run_phase: 'after_success'
        output_format: 'cyclonedx-json'
        input_dir: '/sbom/go'
        output_dir: '/sbom/go'
      deploy:
        - provider: releases
          edge: true
          file_glob: true
          file: sbom/go/**/*
          skip_cleanup: true
          on:
            branch: sbom
        - provider: s3
          edge: true
          bucket: "sbom-test"
          skip_cleanup: true
          local_dir: sbom/go
          on:
            branch: sbom
  - name: SBOM Node
    os: linux
    language: node_js
    script:
      - cd sbom/node
      - npm install
    addons:
      sbom:
        on:
          branch: 'sbom'
        run_phase: 'after_success'
        output_format: 'cyclonedx-json'
        input_dir: '/sbom/node'
        output_dir: '/sbom/node'
      deploy:
        - provider: releases
          edge: true
          file_glob: true
          file: sbom/node/**/*
          skip_cleanup: true
          on:
            branch: sbom
        - provider: s3
          edge: true
          bucket: "sbom-test"
          skip_cleanup: true
          local_dir: sbom/node
          on:
            branch: sbom
Build Config
{
  "language": "ruby",
  "os": [
    "linux"
  ],
  "dist": "xenial",
  "env": {
    "jobs": [
      {
        "TEST_FLAG": "TRUE"
      },
      {
        "TEST_FLAG": "FALSE"
      }
    ]
  },
  "jobs": {
    "include": [
      {
        "name": "SBOM Ruby",
        "os": "linux",
        "language": "ruby",
        "script": [
          "gem build ./sbom/ruby/hello_world.gemspec"
        ],
        "addons": {
          "sbom": {
            "on": {
              "branch": "sbom"
            },
            "run_phase": "after_success",
            "output_format": "cyclonedx-json",
            "input_dir": "/sbom/ruby",
            "output_dir": "/sbom/ruby"
          },
          "deploy": [
            {
              "provider": "releases",
              "edge": true,
              "file_glob": true,
              "file": [
                "sbom/ruby/**/*"
              ],
              "skip_cleanup": true,
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            },
            {
              "provider": "s3",
              "edge": true,
              "bucket": "sbom-test",
              "skip_cleanup": true,
              "local_dir": "sbom/ruby",
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            }
          ]
        }
      },
      {
        "name": "SBOM Python",
        "os": "linux",
        "language": "python",
        "script": [
          "cd sbom/python",
          "pip install -r requirements.txt"
        ],
        "addons": {
          "sbom": {
            "on": {
              "branch": "sbom"
            },
            "run_phase": "after_success",
            "output_format": "cyclonedx-json",
            "input_dir": "/sbom/python",
            "output_dir": "/sbom/python"
          },
          "deploy": [
            {
              "provider": "releases",
              "edge": true,
              "file_glob": true,
              "file": [
                "sbom/python/**/*"
              ],
              "skip_cleanup": true,
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            },
            {
              "provider": "s3",
              "edge": true,
              "bucket": "sbom-test",
              "skip_cleanup": true,
              "local_dir": "sbom/python",
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            }
          ]
        }
      },
      {
        "name": "SBOM Go",
        "os": "linux",
        "language": "go",
        "script": [
          "cd sbom/go",
          "go build"
        ],
        "addons": {
          "sbom": {
            "on": {
              "branch": "sbom"
            },
            "run_phase": "after_success",
            "output_format": "cyclonedx-json",
            "input_dir": "/sbom/go",
            "output_dir": "/sbom/go"
          },
          "deploy": [
            {
              "provider": "releases",
              "edge": true,
              "file_glob": true,
              "file": [
                "sbom/go/**/*"
              ],
              "skip_cleanup": true,
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            },
            {
              "provider": "s3",
              "edge": true,
              "bucket": "sbom-test",
              "skip_cleanup": true,
              "local_dir": "sbom/go",
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            }
          ]
        }
      },
      {
        "name": "SBOM Node",
        "os": "linux",
        "language": "node_js",
        "script": [
          "cd sbom/node",
          "npm install"
        ],
        "addons": {
          "sbom": {
            "on": {
              "branch": "sbom"
            },
            "run_phase": "after_success",
            "output_format": "cyclonedx-json",
            "input_dir": "/sbom/node",
            "output_dir": "/sbom/node"
          },
          "deploy": [
            {
              "provider": "releases",
              "edge": true,
              "file_glob": true,
              "file": [
                "sbom/node/**/*"
              ],
              "skip_cleanup": true,
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            },
            {
              "provider": "s3",
              "edge": true,
              "bucket": "sbom-test",
              "skip_cleanup": true,
              "local_dir": "sbom/node",
              "on": {
                "branch": [
                  "sbom"
                ]
              }
            }
          ]
        }
      },
      {
        "name": "Bionic Ruby 2.6.6 at jobs.include[1].rvm level",
        "os": "linux",
        "dist": "bionic",
        "language": "ruby",
        "rvm": "2.6.6",
        "script": [
          "ruby ./source/ruby_hello.rb"
        ]
      },
      {
        "name": "Bionic Ruby 2.7.5 at jobs.include[1].rvm level",
        "os": "linux",
        "dist": "bionic",
        "language": "ruby",
        "rvm": "2.7.5",
        "script": [
          "ruby ./source/ruby_hello.rb"
        ]
      },
      {
        "name": "Bionic Ruby 2.6.6 TRUE",
        "os": "linux",
        "dist": "bionic",
        "language": "ruby",
        "if": "(env(TEST_FLAG) = TRUE)",
        "script": [
          "ruby ./source/ruby_hello.rb",
          "echo Test flag is ${TEST_FLAG}"
        ]
      },
      {
        "name": "Bionic Ruby 2.6.6 FALSE",
        "os": "linux",
        "dist": "bionic",
        "language": "ruby",
        "if": "(env(TEST_FLAG) = FALSE)",
        "script": [
          "ruby ./source/ruby_hello.rb",
          "echo Test flag is ${TEST_FLAG}"
        ]
      }
    ]
  }
}