Software Engineer · Teacher · Author · Vegan

Setting Up GitHub Actions for an Ember CLI Project

Last reviewed on January 20, 2020

  1. Go to your repository on GitHub and click on the “Actions” tab.
  2. Click on the “New workflow” button on the left.
  3. Click on the “Set up a workflow yourself” button on the right.
  4. Copy and paste the following YAML configuration into the editor which will create the file .github/workflows/main.yml. Then click on the green “Start commit” button.
name: Ember

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x]

    steps:
      - uses: actions/[email protected]
      - name: Use Node.js $
        uses: actions/[email protected]
        with:
          node-version: $
      - name: Install Dependencies
        run: npm ci
      - name: JavaScript Linting
        run: npm run lint:js
      - name: Template Linting
        run: npm run lint:hbs
      - name: npm test
        run: npm test
        env:
          CI: true

The CI: true line will set an environment variable called CI for the npm test step, which will be used if your testem.js file contains the following line:

process.env.CI ? '--no-sandbox' : null

The default testem.js file has this line.

Disclaimer: Any viewpoints and opinions expressed in this article are those of David Tang and do not reflect those of my employer or any of my colleagues.