Skip to content

Instantly share code, notes, and snippets.

@ijlee2
Last active December 8, 2022 18:38
Show Gist options
  • Save ijlee2/25004d700cd008ee08ecc4873c109a5b to your computer and use it in GitHub Desktop.
Save ijlee2/25004d700cd008ee08ecc4873c109a5b to your computer and use it in GitHub Desktop.
GitHub Actions workflow for Ember addons (yarn)
# The workflow template is designed for Ember addons.
#
# It assumes certain dependencies and scripts in package.json. If
# they don't apply to your project, feel free to remove irrelevant
# code in the workflow. These can be inferred from the job name.
#
# {
# "scripts": {
# "build": "ember build --environment=production",
# "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
# "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
# "lint:hbs": "ember-template-lint .",
# "lint:hbs:fix": "ember-template-lint . --fix",
# "lint:js": "eslint . --cache",
# "lint:js:fix": "eslint . --fix",
# "start": "ember serve",
# "test": "ember test",
# "test:ember-compatibility": "./node_modules/.bin/ember try:one"
# },
# "devDependencies": {
# "concurrently" (lint)
# "ember-qunit" (test-app)
# "ember-template-lint" (lint)
# "ember-try" (test-compatibility)
# "eslint" (lint)
# },
# }
#
# For more information, please visit:
#
# - https://crunchingnumbers.live/2020/03/17/ci-with-github-actions-for-ember-apps/
# - https://crunchingnumbers.live/2020/08/31/ci-with-github-actions-for-ember-apps-part-2/
#
# Author: Isaac J. Lee (GitHub: @ijlee2)
# Created at: August 31, 2020
# Updated at: December 8, 2022
#
name: CI
on:
push:
branches:
- main
pull_request:
schedule:
# Run the workflow every Monday at 6 am CST
- cron: '0 11 * * MON'
env:
NODE_VERSION: 16
jobs:
lint:
name: Lint files
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out a copy of the repo
uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
test-app:
name: Test app
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out a copy of the repo
uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test
run: yarn test
test-compatibility:
name: Test compatibility
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
scenario:
- 'ember-lts-3.28'
- 'ember-lts-4.4'
- 'ember-release'
- 'ember-beta'
- 'ember-canary'
- 'embroider-safe'
- 'embroider-optimized'
timeout-minutes: 5
steps:
- name: Check out a copy of the repo
uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test
run: yarn test:ember-compatibility ${{ matrix.scenario }} --- yarn test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment