Skip to content

Commit

Permalink
create reusable workflow for Ember.js add-ons
Browse files Browse the repository at this point in the history
  • Loading branch information
MrChocolatine committed Oct 29, 2021
1 parent b021d34 commit f47d3f9
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions workflows/emberjs/addons/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI

on:
workflow_call:
inputs:
nodejs_version:
description: Version of Node.js to use.
default: '12'
required: false
type: string
# Currently, Arrays cannot be passed as inputs so the trick is to pass them as string and then
# decode them with `fromJSON()` to rebuild the string as an Array.
# https://colinsalmcorner.com/musings-on-reusable-workflows/#array-hack
ember_try_scenarios:
description: Custom ember-try scenarios to run.
default: "[
'ember-lts-3.16',
'ember-lts-3.20',
'ember-release',
'ember-classic',
'ember-default-with-jquery',
'embroider-safe',
'embroider-optimized',
]"
required: false
type: string

jobs:
lint_tests:
name: Lint and tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
cache: yarn
node-version: ${{ inputs.nodejs_version }}

# https://github.com/lirantal/lockfile-lint
- name: Lint lockfile
run: >
npm_config_yes=true npx lockfile-lint
--path yarn.lock
--allowed-hosts npm yarn
--validate-https
- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Run Lint
run: yarn run lint

- name: Run Tests
run: yarn run test:ember

floating:
name: Floating Dependencies
needs: lint_tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
cache: yarn
node-version: ${{ inputs.nodejs_version }}

- name: Install Dependencies
run: yarn install --no-lockfile --non-interactive

- name: Run Tests
run: yarn run test:ember

ember-try-scenarios:
name: ember-try (${{ matrix.try-scenario }})
needs: lint_tests
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
try-scenario: ${{ fromJSON(inputs.ember_try_scenarios) }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
cache: yarn
node-version: ${{ inputs.nodejs_version }}

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}

0 comments on commit f47d3f9

Please sign in to comment.