# Migrating a JS project from Travis to GitHub Actions

DevFeed: [Migrating a JS project from Travis to GitHub Actions](<https://devfeed.tech/articles/migrating-a-js-project-from-travis-to-github-actions-19083.md>)

Original publisher: [Read original article](<https://httptoolkit.com/blog/migrating-javascript-from-travis-to-github-actions/>)

Author: HTTP Toolkit; Tim Perry

Published: 2020-10-27T11:45:00Z

Content type: tutorial

Language: en

Sources: [HTTP Toolkit](<https://devfeed.tech/sources/http-toolkit.md>)

Topics: [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Chrome](<https://devfeed.tech/topics/chrome.md>), [Puppeteer](<https://devfeed.tech/topics/puppeteer.md>), [npm](<https://devfeed.tech/topics/npm.md>), [chmod](<https://devfeed.tech/topics/chmod.md>)

Tags: [chmod](<https://devfeed.tech/tags/chmod.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [ci](<https://devfeed.tech/tags/ci.md>), [cli](<https://devfeed.tech/tags/cli.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [js](<https://devfeed.tech/tags/js.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [testing](<https://devfeed.tech/tags/testing.md>), [travis](<https://devfeed.tech/tags/travis.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

This tutorial explains how to migrate a JavaScript/TypeScript project from Travis to GitHub Actions. It uses an HTTP Toolkit UI repository as an example, covering Node.js version selection, Chrome and XVFB setup for Puppeteer and Karma tests, dependency installation with npm ci, and test execution with npm test. It also discusses reproducing the cloud CI environment locally to debug environment-specific failures.

## Source excerpt

Travis has been the most popular place to build open-source code for a long time, but the world is moving on. GitHub Actions is modern, tightly integrated with the most popular code hosting platform in the world, flexible, fast, and free (for public repos). Travis has been popular for years though, there's still a lot of projects being built there, including many of HTTP Toolkit's own repos. Last week, I decided to bite the bullet, and start migrating. Travis was having a particularly bad build backlog day, and HTTP Toolkit is entirely open source on GitHub already, so it's super convenient. I've been looking longingly at GitHub Actions builds on other projects for a little while, and I'd already seen lots of useful extensions in the marketplace of drop-in action steps that'd make my life much easier. Unfortunately, I knew very little about GitHub actions, and I already had some Travis configuration that worked. In this post, I want to share how I converted my JavaScript (well, TypeScript) build from Travis to GitHub, so you can do the same. The Goal I decided to start with the simplest Travis setup I had: the HTTP Toolkit UI repo. Here's the previous travis.yml file: dist: xenial sudo: required language: node_js node_js: - '14' install: - npm ci services: - xvfb before_script: - sudo chown root /opt/google/chrome/chrome-sandbox - sudo chmod 4755 /opt/google/chrome/chrome-sandbox script: - npm test addons: chrome: stable There's a few notable things here: I want to build with a specific node version. I need Chrome & XVFB installed for testing with Puppeteer & Karma. There's some existing workarounds (before_script) for Travis.yml in here. The build itself is just npm ci to install dependencies and then npm test. Although not shown here, some of the npm dependencies include native node extensions, and need a working native build environment. One other feature I'd really like, and which I'd strongly recommend for everybody, is the option to run an equivalent CI enviro