Skip to main content

Travis CI

This page explains the core concepts and feature mapping you need to migrate from Travis CI to Semaphore.

Overview

Travis CI is a YAML-based syntax to define pipelines and actions. In Semaphore, you can use the visual workflow editor to more easily configure and preview pipelines.

Semaphore cloud machines also provide a 2x speed boost and much better reliability when compared with Travis CI.

Travis CI vs Semaphore

This section describes how to implement common Travis CI functionalities in Semaphore.

Checkout

Checkout clones the repository in the CI environment.

Checkout is implicit in all Travis CI workflows by default.

Artifacts

Both Travis CI and Semaphore support a method to persist data between jobs called Artifacts.

In Travis CI we use the artifacts addon.

The following example uploads and downloads test.log

addons:
artifacts:
paths:
- $HOME/project/test.log

Caching

Both Travis CI and Semaphore support manually caching files. See the comparison below.

Travis CI has a cache keyword to cache files and dependencies.

The following example caches Gems in a Ruby project:

language: ruby
cache: bundler

Language versions

Both Travis CI and Semaphore allow you to use specific language versions.

Travis CI uses a language-specific setup keyword.

The following example sets the Ruby version to 3.3.4

language: ruby
rvm:
- 3.3.4

Database and services

Both Travis CI and Semaphore support starting a databases and services. Semaphore uses Docker containers for this.

Travis CI uses services keyword. The following example starts Redis on default port.

services:
- redis-server

Secrets

Secrets inject sensitive data and credentials into the workflow securely.

In Travis CI we encrypt sensitive data using the Travis CLI. Travis uses asymmetric encryption to put the encrypted values in the YAML pipeline.

to access the values, we use the secure keyword, which tells Travis to decrypt the value on runtime.

env:
global:
- secure: "... long encrypted string ..."

Using encrypted files uses a different system that's a bit more convoluted.

Complete example

The following comparison shows how to build and test a Ruby project on Travis CI and in Semaphore.

On Travis CI, we need several actions to start services, manage Gems, and run the build and test commands.

language: ruby

rvm:
- $(cat .ruby-version)

cache: bundler

addons:
apt:
packages:
- curl
- libjemalloc2
- libvips
- sqlite3

branches:
only:
- main

jobs:
include:
- stage: security_scans
name: "Scan Ruby"
script:
- bin/brakeman --no-pager

- stage: security_scans
name: "Scan JS"
script:
- bin/importmap audit

- stage: lint
script:
- bin/rubocop -f github

- stage: test
before_script:
- cp .sample.env .env
- bundle exec rake db:setup
script:
- bundle exec rake
- bin/rails db:test:prepare test test:system

env:
global:
- RAILS_ENV=test

See also