Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 19 additions & 52 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,24 @@
import:
- stages.yml
- ifs.yml
- ifs-with-envs.yml
- secure.yml
- sleep.yml
branches:
only:
- main
- integration-regresion-tests
os: linux
dist: bionic
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
rvm:
- 2.7.5
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
allow_failures:
- 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}
# add to conditionals testing running build from specific branch (+add branch), allow failure (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/)
# building branches - https://docs.travis-ci.com/user/customizing-the-build/#building-specific-branches
# please add cases for build-stages https://docs.travis-ci.com/user/build-stages/
# - sequence of stages
# - named stages
# ==
# using encrypted variables: https://docs.travis-ci.com/user/encryption-keys/
# ==
# create a job that does not puts out enything to cli for first 10 minutes - we expect autocancel on that
# ==
# create a job that runs for more than 50 minutes (an output to cli must be done with intervals < 10 mins) - we expect autocancel at around 50 minutes mark here
# ==
# commit messages: https://docs.travis-ci.com/user/customizing-the-build/#skipping-a-build
# example: do something if commit message has specific value 'docker'
# if: (branch = master and type = push ) OR commit_message =~ /ship:docker/ OR env(SHIP_DOCKER) = true
env:
global:
- secure: J6PkiwYONd/W1PB5FOtJ46i6Ta7MGx05znAVGcW5E5jDDPBMuOL8Ecq/0vlbPsFGPlwHZtnn4FjWtg7X183gWtRZ0eGdY6GE/5hzL1g65aw0XyLXBSRzu5R2IQYlbNDxclXjBhVV7NvH4z63EFSKkbaxVuuUQXDbNXjgEJDMXfAQqSxlz/+0Qh/yJNvsJRnG3soT3c0fHa839k32yqjIGJqO5VJDEp8O5sRaEIbTqF4v6PwkKDY58MAfrNFMWuMxfzUAAQj2bt1S5E9baajv2rllJgS/i9gNFO5XKoVGQN3UbFI1rpR+oGc4nWn6gdHpoLA1j5aMyLVHw3dgKrv5OyysOP+kF0T8sgY0P3WThNJxwK8NKMymUcjCx9mmu+ZHxA9qZHGPBf6lbzVpF9XeOn7BXpwD10dFOlPEYgKqAuiecNVnXHFtr42LJryYZJpL/DjP8BdMaaH24jaNZDpUQw147cpcpZXvHv+LQjUpRQSxQx+iLO2SoEzdg7fHYoIAbGO9tZB1j/uS+4JYTQv7WJKam84iUkM74FF2l3JHU0zjdT5sb0qU91aUAHDUuvV4t997ngE/rMw22scKbVGQtVsDiMYEBbfqX3wnFwCSnlYfn9dJEU/pPjlS/qaxcehvGxII5TJMZtjBFYIgApo5koAn0S6G1jH1CcvMRDH5m9A=
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# travis-tests
Repository for running Travis test jobs on Travis

Repository for running Travis test jobs on Travis.
It is meant to be re-run and reused as part of regression checks for the whole system.
Technically these are falling into 'integration tests' category.


## Contributing

When adding specific set of jobs, testing a particular feature, you must follow this steps:

1. Optionally, create separate branch if the 'suite' is to be focused on a specific parts of Travis CI
2. Create separate `<name>.yml` file
3. Describe purpose/intended scope of the test in the comment
4. Define your jobs in it as a job matrix using `include` mechanism
5. Import new specific file into main `.travis.yml`
6. Once the tests are ok, create a Pull Request to 'main', yet please do not delete the branch if branch-specific builds are defined!

This is meant to keep the scopes of tested areas structurized.
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
task :default do |_t|
end
21 changes: 21 additions & 0 deletions ifs-with-envs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# testing conditionals - travis-yml and later scheduler involved
# ==
# testing conditional actions dependent on environmental variable definition for the build job
# testing on specific branch + job stages thrown in
env:
- MY_ENV=myenv
- ANOTHER_ENV=another_env
jobs:
include:
- stage: "IFS with envs - first"
name: "IFS with envs - first stage"
if: branch = integration-regresion-tests
script: ruby ./source/ruby_hello.rb
- stage: "IFS with envs - two"
name: "IFS with envs - second stage"
env: MY_ENV=myenv
script: ruby ./source/ruby_hello.rb
- stage: "IFS with envs - third - never run"
name: "IFS with envs - third - never run stage"
env: MISSING_ENV=missing_env
script: ruby ./source/ruby_hello.rb
22 changes: 22 additions & 0 deletions ifs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# testing conditionals - travis-yml and later scheduler involved
# ==
# testing running build from specific branch (branch must exist ), allow failure must be
# used in root travis.yml (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/)
# building branches - https://docs.travis-ci.com/user/customizing-the-build/#building-specific-branches
# ==
# commit messages: https://docs.travis-ci.com/user/customizing-the-build/#skipping-a-build
# example: do something if commit message has specific value e.g. 'docker'
jobs:
include:
- stage: "IFS - first"
name: "IFS - first stage"
if: branch = integration-regresion-tests
script: ruby ./source/ruby_hello.rb
- stage: "IFS - on commit"
name: "IFS - on commit stage"
if: commit_message =~ /docker/
script: ruby ./source/ruby_hello.rb
- stage: "IFS with envs - next - never run"
name: "IFS with envs - next - never run stage"
if: branch = not-existant-branch
script: ruby ./source/ruby_hello.rb
8 changes: 8 additions & 0 deletions secure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# using encrypted variables: https://docs.travis-ci.com/user/encryption-keys/
# one must first create encrypted variables using travis-cli
# to run this job properly, one may need to fork the repository or be a collaborator
jobs:
include:
- stage: "Secure stage I"
name: "Secure stage I"
script: echo $MANA_MANA
11 changes: 11 additions & 0 deletions sleep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# testing mechanisms for autocancelling the jobs (travis-hub + worker involved)
jobs:
include:
# a job that does not puts out enything to cli (job log) for first 10 minutes - we expect autocancel on that job to happen
- stage: "Sleep First"
name: "Sleep First stage"
script: ruby ./source/over_ten_minutes.rb
# a job that runs for more than 50 minutes (an output to cli (job log) must be done with intervals < 10 mins) - we expect autocancel at around 50 minutes mark here
- stage: "Sleep Second"
name: "Sleep Second stage"
script: ruby ./source/over_fifty_minutes.rb
1 change: 1 addition & 0 deletions source/fail.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
raise 'ERROR!'
1 change: 1 addition & 0 deletions source/fine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'I feel good.'
4 changes: 4 additions & 0 deletions source/over_fifty_minutes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
20.times do
puts 'Something appears'
sleep 9 * 60
end
2 changes: 2 additions & 0 deletions source/over_ten_minutes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
puts "something"
sleep 11 * 60
16 changes: 16 additions & 0 deletions stages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# cases for build-stages https://docs.travis-ci.com/user/build-stages/
# - sequence of stages
# - named stages
# TODO: add bash output or comment whether expected result of the job is to pass or fail at each job in matrix
jobs:
include:
- stage: "First"
name: "First stage"
script: ruby ./source/ruby_hello.rb
# in 'Second' ruby exception is raised, this specific job should fail in terms of particular build job status
- stage: "Second"
name: "Second stage"
script: ruby ./source/fail.rb
- stage: "Next"
name: "Next stage"
script: ruby ./source/fine.rb
4 changes: 4 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test
test
test
test