Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI - Reuse organisation's workflows to lint, test, tag and publish #160

Merged
merged 6 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 9 additions & 206 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,214 +1,17 @@
# This file was autogenerated by create-github-actions-setup-for-ember-addons.
#
# You can upgrade the GitHub Actions workflow to the latest blueprints used
# by Create GitHub Actions setup for Ember Addons by running it again:
#
# - `yarn create github-actions-setup-for-ember-addons` if using yarn and
# - `npm init github-actions-setup-for-ember-addons` if using NPM.
#
# See https://github.com/jelhan/create-github-actions-setup-for-ember-addon for
# details.
#
# The following lines contain the configuration used in the last run. Please do
# not change them. Doing so could break upgrade flow.
#
#$ browsers:
#$ - Chrome
#$ emberTryScenarios:
#$ - scenario: ember-lts-3.20
#$ - scenario: ember-lts-3.24
#$ - scenario: ember-release
#$ - scenario: ember-default-with-jquery
#$ - scenario: ember-classic
#$ nodeVersion: '12'
#$ packageManager: yarn
#
# GitHub Actions documentation:
# https://docs.github.com/en/actions

name: CI

on:
push:
branches:
- master
pull_request:
branches: master
pull_request: {}

env:
NODE_VERSION: '12'
concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
Comment on lines +11 to +13
Copy link
Member Author

@MrChocolatine MrChocolatine Oct 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part cannot be moved in the reusable workflow (not supported yet), otherwise we get the error:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1399155003

The workflow is not valid. peopledoc/ember-feature-controls/.github/workflows/org-ci.yml@ci-revamp-gh-actions (Line: 17, Col: 1): Concurrency is not yet supported at the root of a called workflow file

It must be declared in the caller workflow.


But it will be possible very soon, once this feature moves out of beta!

https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#limitations

The following limitations will be removed when workflow reuse moves out of beta:
You can't set the concurrency of a called workflow from the caller workflow.


jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-

- name: Install Dependencies
run: yarn install --frozen-lockfile
if: |
steps.cache-dependencies.outputs.cache-hit != 'true'

- name: Lint
run: yarn lint


test:
name: Tests
runs-on: ${{ matrix.os }}
needs: lint

strategy:
matrix:
os: [ubuntu-latest]
browser: [Chrome]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-

- name: Install Dependencies
run: yarn install --frozen-lockfile
if: |
steps.cache-dependencies.outputs.cache-hit != 'true'

- name: Test
run: yarn test:ember --launch ${{ matrix.browser }}


floating-dependencies:
name: Floating Dependencies
runs-on: ${{ matrix.os }}
needs: lint

strategy:
matrix:
os: [ubuntu-latest]
browser: [Chrome]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-floating-deps
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-

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

- name: Test
run: yarn test:ember --launch ${{ matrix.browser }}


try-scenarios:
name: Tests - ${{ matrix.ember-try-scenario }}
runs-on: ubuntu-latest
continue-on-error: true
needs: test

strategy:
fail-fast: true
matrix:
ember-try-scenario: [
ember-lts-3.20,
ember-lts-3.24,
ember-release,
ember-default-with-jquery,
ember-classic
]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE_VERSION }}'

- name: Get package manager's global cache path
id: global-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache package manager's global cache and node_modules
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
${{ steps.global-cache-dir-path.outputs.dir }}
node_modules
key: ${{ runner.os }}-${{ matrix.node-version }}-${{
hashFiles('**/yarn.lock'
) }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-

- name: Install Dependencies
run: yarn install --frozen-lockfile
if: |
steps.cache-dependencies.outputs.cache-hit != 'true'

- name: Test
env:
EMBER_TRY_SCENARIO: ${{ matrix.ember-try-scenario }}
run: node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
org:
uses: peopledoc/.github/.github/workflows/js--emberjs-addons-ci.yml@main
21 changes: 21 additions & 0 deletions .github/workflows/tag-release-publish.yml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GitHub Actions documentation:
# https://docs.github.com/en/actions

name: Create new `git tag`, create new GitHub release and publish to NPM

on:
workflow_run:
workflows: CI
branches: master
types: completed

concurrency:
group: tag-release-publish-${{ github.ref }}
cancel-in-progress: true

jobs:
org:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: peopledoc/.github/.github/workflows/js--tag-release-publish.yml@main
secrets:
npm_automation_token: ${{ secrets.NPM_AUTOMATION_TOKEN }}
3 changes: 3 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ module.exports = async function () {
}),
},
npm: {
devDependencies: {
'ember-source': '~3.28.0',
},
ember: {
edition: 'classic',
},
Expand Down
15 changes: 14 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
const { maybeEmbroider } = require('@embroider/test-setup')

module.exports = function (defaults) {
let app = new EmberAddon(defaults, {
Expand All @@ -15,12 +16,24 @@ module.exports = function (defaults) {
*/
app.import('node_modules/milligram/dist/milligram.css')

const { maybeEmbroider } = require('@embroider/test-setup')
return maybeEmbroider(app, {
skipBabel: [
{
package: 'qunit',
},
],

/**
* See:
* - https://github.com/embroider-build/embroider/issues/823
* - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
* - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
*
* TODO: to remove once the following PR is released:
* https://github.com/mansona/ember-get-config/pull/29
*/
compatAdapters: new Map([
[ 'ember-get-config', null ] // eslint-disable-line prettier/prettier
]),
})
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.4.2",
"@embroider/test-setup": "^0.47.0",
"@embroider/test-setup": "^0.47.1",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"babel-eslint": "^10.1.0",
Expand Down
18 changes: 5 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1087,10 +1087,10 @@
semver "^7.3.2"
typescript-memoize "^1.0.0-alpha.3"

"@embroider/test-setup@^0.47.0":
version "0.47.0"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-0.47.0.tgz#ea307583efaac227b71c5ad348fecac362637e0c"
integrity sha512-KadqpSno0qyhVW2VtXTU7i9OQHNT1tpcrQ+06sTaFmX275yGxHUTcSr//CV1ErtzejcVPvkGnRQIUKPRXZsNVA==
"@embroider/test-setup@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-0.47.1.tgz#01f6921612b292cb721b2102b3f40dbc89131039"
integrity sha512-PKV+UBixVmkrXo/9AdrtvBccmTbTG9zgJUA/hvoHIGaUISW5cepWyLU0dqW3gE2ECJjrvc4+KtBUMOC1rEZ2Ng==
dependencies:
lodash "^4.17.21"
resolve "^1.20.0"
Expand Down Expand Up @@ -1400,22 +1400,14 @@
"@types/eslint" "*"
"@types/estree" "*"

"@types/eslint@*":
"@types/eslint@*", "@types/eslint@^7.2.13":
version "7.28.1"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.28.1.tgz#50b07747f1f84c2ba8cd394cf0fe0ba07afce320"
integrity sha512-XhZKznR3i/W5dXqUhgU9fFdJekufbeBd5DALmkuXoeFcjbQcPk+2cL+WLHf6Q81HWAnM2vrslIHpGVyCAviRwg==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"

"@types/eslint@^7.2.13":
version "7.28.0"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.28.0.tgz#7e41f2481d301c68e14f483fe10b017753ce8d5a"
integrity sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"

"@types/estree@*", "@types/estree@^0.0.50":
version "0.0.50"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83"
Expand Down