Skip to content

Commit a177a30

Browse files
authored
CI(GA): Add github actions for CI (#296)
* Create nodejs.yml * update for use github actions * add some test * ci(githubactions): add github acctions for CI * refactor(husky): create new script for use start-server-and-test * CI(gh): change script * CI(gh): change script for e2e * CI(gh): add status badge * CI(gh): add status badge * Update sampleBlog.spec.js
1 parent 6dd42a5 commit a177a30

9 files changed

Lines changed: 47 additions & 10 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Node.js CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: [12.x]
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Use Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
- run: npm install
20+
- run: npm run scully:compile:all
21+
- run: node ./dist/scully/scully --tds --host='0.0.0.0'
22+
- run: npm run test
23+
- run: npm run e2e:full
24+
env:
25+
CI: true

.huskyrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"hooks": {
33
"pre-commit": "pretty-quick --staged",
4-
"pre-push": "npm run scully:precommit && start-server-and-test scully:r http://localhost:1668 e2e"
4+
"pre-push": "npm run scully:precommit && npm run e2e:full"
55
}
66
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Gitter](https://img.shields.io/gitter/room/scullyio/community)](https://gitter.im/scullyio/community)
77
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
88
[![CLA assistant](https://cla-assistant.io/readme/badge/scullyio/scully)](https://cla-assistant.io/scullyio/scully)
9+
![Node.js CI](https://github.com/scullyio/scully/workflows/Node.js%20CI/badge.svg)
910

1011
The best way to build the fastest Angular apps. Scully is a static site generator for Angular projects looking to embrace the JAMStack.
1112

cypress/integration/sampleBlog.spec.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ context('check first integration test', () => {
1010
});
1111
});
1212

13-
it('Check the list of users after navigation', () => {
14-
cy.visit('/home');
15-
cy.get('ul>li>a')
16-
.contains('/user')
17-
.click()
18-
.get('a')
19-
.contains('Leanne Graham');
13+
it('Check the list of users', () => {
14+
cy.visit('/user');
15+
cy.get('a').contains('Leanne Graham');
2016
});
2117

2218
it('Check is transferState exist in html', () => {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"test": "jest",
77
"test:watch": "jest --watch",
88
"e2e": "cypress run --spec 'cypress/integration/**/*' --browser chrome",
9+
"e2e:full": "start-server-and-test scully:r http://localhost:1668 e2e",
910
"tsc": "tsc",
1011
"scully:run": "npm run scully:dev:all -- serve",
1112
"scully:run:test": "npm run test && npm run e2e",

scully/scully.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {logError, logWarn, yellow} from './utils/log';
1515
import {startScully} from './utils/startup';
1616
import {waitForServerToBeAvailable} from './utils/waitForServerToBeAvailable';
1717
import {bootServe, isBuildThere, watchMode} from './watchMode';
18-
import {watch, removeStaticDist, openNavigator} from './utils/cli-options';
18+
import {watch, removeStaticDist, openNavigator, hostName} from './utils/cli-options';
1919
const open = require('open');
2020

2121
/** the default of 10 is too shallow for generating pages. */
@@ -30,6 +30,9 @@ if (process.argv.includes('version')) {
3030
(async () => {
3131
/** make sure not to do something before the config is ready */
3232
const scullyConfig = await loadConfig;
33+
if (hostName) {
34+
scullyConfig.hostName = hostName;
35+
}
3336
if (process.argv.includes('killServer')) {
3437
await httpGetJson(`http://${scullyConfig.hostName}:${scullyConfig.appPort}/killMe`, {
3538
suppressErrors: true,

scully/utils/cli-options.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ export const {proxyConfigFile} = yargs
5353
.alias('proxy', 'proxyConfigFile')
5454
.alias('proxy', 'proxyConfig')
5555
.describe('proxy', 'Load proxy config from file').argv;
56+
57+
export const {hostName} = yargs
58+
.string('hostName')
59+
.default('hostName', undefined)
60+
.alias('host', 'hostName')
61+
.describe('host', 'Add hostname for scully').argv;

src/__tests__/transfer-state.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {readFileSync} from 'fs';
22
import {join} from 'path';
3-
import {extractTransferState, replaceIndexNG} from '../test-config.helper';
3+
import {cl, extractTransferState, replaceIndexNG} from '../test-config.helper';
44

55
describe('TransferState', () => {
66
it('should add state to page 1', () => {

src/test-config.helper.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const separateTransferFromHtml = index => {
4040
if (index.indexOf(SCULLY_STATE_START) === -1) {
4141
return [index, null];
4242
}
43+
4344
// Remove transfer state
4445
const [start, remaining] = index.split(SCULLY_STATE_START);
4546
const [transferStateBlob, end] = remaining.split(SCULLY_STATE_END);
@@ -48,3 +49,7 @@ export const separateTransferFromHtml = index => {
4849

4950
return [indexWithoutTransferState, transferState];
5051
};
52+
53+
export const cl = (something: string) => {
54+
console.log(something);
55+
};

0 commit comments

Comments
 (0)