waldyrious / Atom-CI

Script for setting up Atom projects on continuous integration servers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atom CI

This is a script for setting up continuous integration with an Atom project.

They're collapsible, baby.

Usage

Add the following line to your project's .travis.yml file:

script: "curl -sL https://git.io/fji1w | sh"

Features

It's fundamentally the same as atom/ci, with the following differences:

  1. GitHub's release pages are consulted directly for downloads.
    This is a tad bit slower than downloading from atom.io, but it means sudden changes to their infrastructure won't break your build.

  2. Arbitrary release channels (dev, nightly) are unsupported.
    Only stable and beta releases of Atom can be tested against. However, users can set $ATOM_RELEASE in their environment to build against an arbitrary Atom version:

    env:
      - ATOM_CHANNEL=stable   # Latest stable release (default)
      - ATOM_RELEASE=v1.34.0  # Override ATOM_CHANNEL and test specific version
  3. Only TravisCI is supported for now.

  4. lint or test scripts defined in package.json are used, if possible.
    If your package manifest defines a lint or test script, the CI script will call those instead. For example:

    {
    	"scripts": {
    		"lint": "npx eslint --ext mjs,js ./lib/ ./tools",
    		"test": "atom -t ./specs"
    	}
    }

    If you don't specify a script, the usual defaults assumed by atom/ci are attempted instead:

    # Linting
    DIRS="./lib ./src ./spec ./test"
    npx coffeelint $DIRS
    npx eslint $DIRS
    npx tslint $DIRS
    
    # Testing
    DIRS="./spec ./specs ./test ./tests"
    atom --test $DIRS

    Note that only linters listed in devDependencies will be run, and missing directories will be skipped. However, at least one test directory must be included, or else the build will fail.

Testing on Ubuntu

If you're running builds on Ubuntu, be forewarned that Atom's beta channel may give dpkg an archive it can't unpack due to a bug with older versions of dpkg. The solution is to run builds on Xenial instead of Trusty, which requires that you include libgconf2-4 as a dependency:

@@ .travis.yml @@
 addons:
   apt:
     packages:
     - build-essential
     - fakeroot
     - git
+    - libgconf2-4
     - libsecret-1-dev

To-do list

  • Support the atom-mocha executable, once it can be run globally

  • Learn PowerShell and write a version of this for AppVeyor
    Not a huge priority at the moment, as the AppVeyor integration provided by atom/ci is currently working fine.

Background

On July 6th 2019 AEST, Atom's CI script suddenly broke. The culprit was botched handling of a curl(1) request which included an Accept header:

$ curl -L "https://atom.io/download/mac?channel=${ATOM_CHANNEL}" \
	-H 'Accept: application/octet-stream' \
	-o "atom.zip"
######################################################################## 100.0%
curl: (22) The requested URL returned error: 406 Not Acceptable

Following the URL simply lead to Atom's releases page on GitHub. I was unsure what the link usually pointed to, but having this break the builds of each of my projects was certainly not the intended outcome.

Since I'm blocked from the @atom org on GitHub, I was unable to report this or submit a pull-request. So, as usual, I took things into my own hands.

About

Script for setting up Atom projects on continuous integration servers.

License:ISC License


Languages

Language:Shell 83.0%Language:sed 12.2%Language:Makefile 4.9%