Migrating from Travis CI to Semaphore#

In this document, you will find an overview of the main differences between Travis CI and Semaphore, as well as an overview of how to migrate from Travis CI to Semaphore.

Why migrate from Travis CI to Semaphore?#

Both Semaphore and Travis CI are modern CI/CD tools available in the cloud or on-premise. Here're the main reasons why companies choose Semaphore over Travis CI:

  1. Unprecedented speed and reliability. Building on Semaphore is 2x times faster than on Travis CI.
  2. Ease of setup and maintenance. Users can choose whether to build workflows using Semaphore's intuitive Visual Workflow Builder or make use of the YAML configuration.
  3. Advanced deployment dashboards. In Semaphore, users can create custom screens that show deployment activity across multiple projects.
  4. Easy-to-read test reports. Semaphore collects XML reports and displays them as convenient test reports. With the help of these reports, users can clearly see which tests are failing and which ones are the slowest in one's test suite, identify flaky tests and see how much time it takes to run each test.

Key concepts#

Using Docker containers#

Semaphore provides a series of convenience Docker images that are hosted on the Semaphore Container Registry. Using these images results in much faster downloads since the images will be pulled from the Semaphore Container Registry. And you’re not limited to the images in the registry, you can use any image from any provider.

To see how to work with a Docker environment, refer to Custom CI/CD Environment with Docker. To see all available convenience images, refer to Semaphore Registry Images.

Travis CI doesn't support running your build inside a Docker container nor it provides a Docker Registry.

Using variables and secrets#

Both Travis CI and Semaphore support adding environment variables to the builds by configuring the pipeline file.

Travis CI and Semaphore also support creating secrets via the UI. Additionally, Semaphore allows for creating and editing secrets using the sem CLI.

To see how to add environment variables to the jobs, refer to Environment variables. To see how to create encrypted secrets, refer to Using Secrets.

Caching#

Both Travis CI and Semaphore support manually caching files. However, Travis CI doesn't allow for cache versioning because it's not possible to establish individual names for cache packages. Semaphore keeps the cache within its own infrastructure which makes for faster cache operation times. An example from each platform is shown below:

Travis CI Semaphore
language: ruby
cache: bundler
    
- name: Cache gems
  commands:
    - cache store bundle-gems-$(checksum Gemfile.lock) vendor/bundle
      

Additionally, Semaphore provides a method to automatically store or restore dependencies into or from default paths. This feature works with various languages and dependency managers.

To see how to use the cache mechanism, refer to Caching.

Artifacts#

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

An example from each platform is shown below:

Travis CI Semaphore
addons:
  artifacts:
    # ⋮
    paths:
    - $HOME/project/test.log
    
- name: Make
  commands:
    - artifact push job test.log
    

Additionally, Semaphore allows the creation of Artifacts at the job, workflow and project level.

To see more details about this feature, refer to Artifacts.

Specifying language versions#

Both Travis CI and Semaphore allow you to use specific language versions. Github Actions uses the rvm keyword while Semaphore incorporates sem-version in its toolbox.

Examples from each platform are shown below:

Travis CI Semaphore
language: ruby
rvm:
  - 3.1
    
jobs:
  - name: Using sem-version
      commands:
        - sem-version ruby 3.1
    

To see more details about the sem-version tool, refer to Selecting language versions.

Using databases#

Both Travis CI and Semaphore support starting a database and other services. Travis CI uses services while Semaphore incorporates sem-service in its toolbox.

Examples from each platform are shown below:

Travis CI Semaphore
services:
  - redis-server
    
 jobs:
 - name: Redis
     commands:
       - sem-service start redis
    

To see how to use sem-service and all the supported databases and other services, refer to sem-service: Managing Databases and Services on Linux.

Complete example#

Travis CI Semaphore
language: ruby
rvm:
  - 3.1
cache:
  - bundler
  - yarn
services:
  - postgresql
before_install:
  - nvm install --lts
before_script:
  - bundle install --jobs=3 --retry=3
  - yarn
  - bundle exec rake db:create
  - bundle exec rake db:schema:load
script:
  - bundle exec rake test
  - bundle exec rake test:system
    
version: v1.0
name: Example pipeline
agent:
  machine:
    type: e1-standard-2
    os_image: ubuntu1804
blocks:
  - name: Setup
    task:     
      prologue:
        commands:
          - checkout
          - cache restore
          - sem-version ruby 3.1
          - sem-service start postgres
          - nvm install --lts
      jobs:
        - name: Bundle
          commands:
            - bundle install --path vendor/bundle
            - yarn
            - bundle exec rake db:create
            - bundle exec rake db:schema:load
            - bundle exec rake test
            - bundle exec rake test:system
            - cache store