Skip to content

Commit afffffe

Browse files
authored
Migrated CI/CD from Travis to GitHub Actions (#626)
* Removed references to Travis * Checked for linting in CI/CD * Tested app in CI/CD * Cached node_modules under test-apps/new-addon * Updated code style * Tested compatibility in CI/CD * Deployed app in CI/CD * Added badge * Tested addon with floating dependencies Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
1 parent efe359a commit afffffe

File tree

7 files changed

+221
-134
lines changed

7 files changed

+221
-134
lines changed

.github/workflows/ci-cd.yml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
env:
10+
NODE_VERSION: 10
11+
12+
jobs:
13+
lint:
14+
name: Lint files
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 7
17+
steps:
18+
- name: Check out a copy of the repo
19+
uses: actions/checkout@v2
20+
21+
- name: Use Node.js ${{ env.NODE_VERSION }}
22+
uses: actions/setup-node@v2-beta
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
26+
- name: Get Yarn cache path
27+
id: yarn-cache-dir-path
28+
run: echo "::set-output name=dir::$(yarn cache dir)"
29+
30+
- name: Cache Yarn cache and node_modules
31+
id: cache-dependencies
32+
uses: actions/cache@v2
33+
with:
34+
path: |
35+
${{ steps.yarn-cache-dir-path.outputs.dir }}
36+
node_modules
37+
test-apps/new-addon/node_modules
38+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
39+
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
40+
41+
- name: Install dependencies
42+
run: yarn install --frozen-lockfile
43+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
44+
45+
- name: Lint
46+
run: yarn lint
47+
48+
49+
test-addon-floating:
50+
name: Test addon (floating dependencies)
51+
runs-on: ubuntu-latest
52+
strategy:
53+
fail-fast: true
54+
matrix:
55+
script-name:
56+
- 'ember'
57+
- 'node'
58+
- 'test-apps'
59+
timeout-minutes: 7
60+
steps:
61+
- name: Check out a copy of the repo
62+
uses: actions/checkout@v2
63+
64+
- name: Use Node.js ${{ env.NODE_VERSION }}
65+
uses: actions/setup-node@v2-beta
66+
with:
67+
node-version: ${{ env.NODE_VERSION }}
68+
69+
- name: Install dependencies
70+
run: yarn install --no-lockfile --non-interactive
71+
72+
- name: Test
73+
run: yarn test:${{ matrix.script-name }}
74+
75+
76+
test-addon-locked:
77+
name: Test addon (locked dependencies)
78+
runs-on: ubuntu-latest
79+
strategy:
80+
fail-fast: true
81+
matrix:
82+
script-name:
83+
- 'ember'
84+
- 'node'
85+
- 'test-apps'
86+
timeout-minutes: 7
87+
steps:
88+
- name: Check out a copy of the repo
89+
uses: actions/checkout@v2
90+
91+
- name: Use Node.js ${{ env.NODE_VERSION }}
92+
uses: actions/setup-node@v2-beta
93+
with:
94+
node-version: ${{ env.NODE_VERSION }}
95+
96+
- name: Get Yarn cache path
97+
id: yarn-cache-dir-path
98+
run: echo "::set-output name=dir::$(yarn cache dir)"
99+
100+
- name: Cache Yarn cache and node_modules
101+
id: cache-dependencies
102+
uses: actions/cache@v2
103+
with:
104+
path: |
105+
${{ steps.yarn-cache-dir-path.outputs.dir }}
106+
node_modules
107+
test-apps/new-addon/node_modules
108+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
109+
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
110+
111+
- name: Install dependencies
112+
run: yarn install --frozen-lockfile
113+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
114+
115+
- name: Test
116+
run: yarn test:${{ matrix.script-name }}
117+
118+
119+
test-compatibility:
120+
name: Test compatibility
121+
runs-on: ubuntu-latest
122+
strategy:
123+
fail-fast: true
124+
matrix:
125+
scenario:
126+
- 'ember-lts-3.16'
127+
- 'ember-lts-3.20'
128+
- 'ember-release'
129+
- 'ember-beta'
130+
- 'ember-canary'
131+
- 'ember-default-with-jquery'
132+
- 'ember-classic'
133+
- 'ember-concurrency-1.x'
134+
- 'ember-concurrency-2.x'
135+
timeout-minutes: 7
136+
steps:
137+
- name: Check out a copy of the repo
138+
uses: actions/checkout@v2
139+
140+
- name: Use Node.js ${{ env.NODE_VERSION }}
141+
uses: actions/setup-node@v2-beta
142+
with:
143+
node-version: ${{ env.NODE_VERSION }}
144+
145+
- name: Get Yarn cache path
146+
id: yarn-cache-dir-path
147+
run: echo "::set-output name=dir::$(yarn cache dir)"
148+
149+
- name: Cache Yarn cache and node_modules
150+
id: cache-dependencies
151+
uses: actions/cache@v2
152+
with:
153+
path: |
154+
${{ steps.yarn-cache-dir-path.outputs.dir }}
155+
node_modules
156+
test-apps/new-addon/node_modules
157+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ matrix.scenario }}-${{ hashFiles('**/yarn.lock') }}
158+
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ matrix.scenario }}-
159+
160+
- name: Install dependencies
161+
run: yarn install --frozen-lockfile
162+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
163+
164+
- name: Test
165+
run: yarn test:ember-compatibility ${{ matrix.scenario }}
166+
167+
168+
deploy-app:
169+
name: Deploy app
170+
needs: [lint, test-addon-floating, test-addon-locked, test-compatibility]
171+
runs-on: ubuntu-latest
172+
timeout-minutes: 7
173+
# Only run on pushes to the default branch
174+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
175+
steps:
176+
- name: Check out a copy of the repo
177+
uses: actions/checkout@v2
178+
179+
- name: Set up Git user
180+
run: |
181+
# Set up a Git user for committing
182+
git config --global user.name "GitHub Actions"
183+
git config --global user.email "actions@users.noreply.github.com"
184+
185+
# Copy the Git Auth from the local config
186+
git config --global "http.https://github.com/.extraheader" \
187+
"$(git config --local --get http.https://github.com/.extraheader)"
188+
189+
- name: Use Node.js ${{ env.NODE_VERSION }}
190+
uses: actions/setup-node@v2-beta
191+
with:
192+
node-version: ${{ env.NODE_VERSION }}
193+
194+
- name: Get Yarn cache path
195+
id: yarn-cache-dir-path
196+
run: echo "::set-output name=dir::$(yarn cache dir)"
197+
198+
- name: Cache Yarn cache and node_modules
199+
id: cache-dependencies
200+
uses: actions/cache@v2
201+
with:
202+
path: |
203+
${{ steps.yarn-cache-dir-path.outputs.dir }}
204+
node_modules
205+
test-apps/new-addon/node_modules
206+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
207+
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
208+
209+
- name: Install dependencies
210+
run: yarn install --frozen-lockfile
211+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
212+
213+
- name: Deploy
214+
run: yarn deploy

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
/.git/
1616
/.gitignore
1717
/.template-lintrc.js
18-
/.travis.yml
1918
/.watchmanconfig
2019
/bower.json
2120
/config/ember-try.js

.travis.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ember-cli-addon-docs
22
==============================================================================
33

44
[![npm version](https://img.shields.io/npm/v/ember-cli-addon-docs.svg?style=flat-square)](http://badge.fury.io/js/ember-cli-addon-docs)
5-
[![Build Status](https://img.shields.io/travis/ember-learn/ember-cli-addon-docs.svg?style=flat-square)](https://travis-ci.org/ember-learn/ember-cli-addon-docs)
5+
[![This project uses GitHub Actions for continuous integration and continuous deployment.](https://github.com/ember-learn/ember-cli-addon-docs/workflows/CI/CD/badge.svg)](https://github.com/ember-learn/ember-cli-addon-docs/actions?query=workflow%3ACI%2FCD)
66

77
---
88

config/deploy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-env node */
22

33
module.exports = function(deployTarget) {
4-
var ENV = {
4+
let ENV = {
55
build: {},
66
git: {
7-
repo: 'git@github.com:ember-learn/ember-cli-addon-docs.git'
7+
repo: 'https://github.com/ember-learn/ember-cli-addon-docs.git'
88
}
99
};
1010

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
},
1616
"scripts": {
1717
"build": "ember build --environment=production",
18+
"deploy": "ember deploy production",
1819
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*",
1920
"lint:hbs": "ember-template-lint .",
2021
"lint:js": "eslint .",
2122
"prepare": "./scripts/link-them.sh",
2223
"start": "ember serve",
2324
"test": "npm-run-all lint:* test:*",
24-
"test:browser": "ember test --test-port=0",
25-
"test:ember": "ember test",
26-
"test:ember-compatibility": "ember try:each",
25+
"test:ember": "ember test --test-port=0",
26+
"test:ember-compatibility": "ember try:one",
2727
"test:node": "mocha tests-node --recursive",
2828
"test:test-apps": "cd test-apps/new-addon && yarn test"
2929
},
@@ -114,7 +114,6 @@
114114
"ember-cli-deploy": "^1.0.2",
115115
"ember-cli-deploy-build": "^2.0.0",
116116
"ember-cli-deploy-git": "^1.3.4",
117-
"ember-cli-deploy-git-ci": "^1.0.1",
118117
"ember-cli-inject-live-reload": "^2.0.2",
119118
"ember-cli-mirage": "^1.1.6",
120119
"ember-cli-sri": "^2.1.1",

0 commit comments

Comments
 (0)