Skip to content

Commit 57578e4

Browse files
chore: migrate to GitHub Actions (#124)
* use GitHub Actions instead of Travis * fix typo * fix typo * fix * fix * fix * update * Update README * Update .github/workflows/docsify-cli.yml Co-authored-by: James George <[email protected]> * windows test path error * fix: ci * chore: update ci config Co-authored-by: James George <[email protected]>
1 parent d427411 commit 57578e4

File tree

8 files changed

+51
-20
lines changed

8 files changed

+51
-20
lines changed

.github/workflows/docsify-cli.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: docsify-cli
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- master
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: "${{ matrix.os }}"
13+
strategy:
14+
matrix:
15+
os: [ macos-latest, ubuntu-latest, windows-latest ]
16+
node-version: [ 12.x, 14.x ]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build docsify-cli
29+
run: npm run build
30+
31+
- name: Run e2e tests
32+
run: npm run test

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules/
55
yarn.lock
66
bin/
77
test_docs/
8+
.idea

.travis.yml

-12
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<p align="center">
1212
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/docsify/backers/badge.svg?style=flat-square"></a>
1313
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/docsify/sponsors/badge.svg?style=flat-square"></a>
14-
<a href="https://travis-ci.org/docsifyjs/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/docsifyjs/docsify-cli/master.svg?style=flat-square"></a>
1514
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify-cli.svg?style=flat-square"></a>
15+
<a href="https://github.com/docsifyjs/docsify-cli/actions"><img alt="Github Actions Status" src="https://github.com/docsifyjs/docsify-cli/workflows/docsify-cli/badge.svg"></a>
1616
<a href="https://discord.gg/3NwKFyR"><img alt="Join Discord community and chat about Docsify" src="https://img.shields.io/discord/713647066802421792.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&cacheSeconds=60"></a>
1717
<a href="https://github.com/docsifyjs/docsify-cli/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/github/license/docsifyjs/docsify-cli.svg?style=flat-square"></a>
1818
<a href="https://www.npmjs.com/package/docsify-cli"><img alt="npm-total-download" src="https://img.shields.io/npm/dt/docsify-cli.svg?style=flat-square"></a>

ava.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
files: ['e2e/**/*.test.js']
3+
}

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# docsify-cli
22

3-
[![Build Status master branch](https://img.shields.io/travis/docsifyjs/docsify-cli/master.svg?style=flat-square)](https://travis-ci.org/github/docsifyjs/docsify-cli)
3+
[![Build Status master branch](https://github.com/docsifyjs/docsify-cli/workflows/docsify-cli/badge.svg)](https://github.com/docsifyjs/docsify-cli/actions)
44
[![License](https://img.shields.io/github/license/docsifyjs/docsify-cli.svg?style=flat-square)](https://github.com/docsifyjs/docsify-cli/blob/master/LICENSE)
55
[![Github tag](https://img.shields.io/github/tag/docsifyjs/docsify-cli.svg?style=flat-square)](https://github.com/docsifyjs/docsify-cli/tags)
66
[![npm version](https://img.shields.io/npm/v/docsify-cli.svg?style=flat-square)](https://www.npmjs.com/package/docsify-cli)

e2e/commands/init.test.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
const test = require('ava')
22
const fs = require('fs')
3+
const path = require('path')
34
const {ENTER} = require('cli-prompts-test')
5+
46
const {run, runPromptWithAnswers} = require('../helpers/test-utils.js')
57

6-
const genPath = `${__dirname}/init-cmd`
7-
const docsPath = `${__dirname}/init-cmd/docs`
8+
const genPath = path.join(__dirname, 'init-cmd')
9+
const docsPath = path.join(genPath, 'docs')
810

911
test.before('create temp directory', () => {
12+
// Cleanup if the directory already exists
13+
if (fs.existsSync(genPath)) {
14+
fs.rmdirSync(genPath, {recursive: true})
15+
}
16+
1017
fs.mkdirSync(genPath)
1118
})
1219

@@ -17,11 +24,11 @@ test.after('cleanup', () => {
1724
test('generates docs directory', t => {
1825
run(['init', 'docs'], {cwd: genPath})
1926
// Check for existence
20-
t.true(fs.existsSync(`${docsPath}/README.md`))
21-
t.true(fs.existsSync(`${docsPath}/index.html`))
27+
t.true(fs.existsSync(path.join(docsPath, 'README.md')))
28+
t.true(fs.existsSync(path.join(docsPath, 'index.html')))
2229
})
2330

2431
test('force generates docs directory with --local flag', async t => {
2532
await runPromptWithAnswers(['init', 'docs', '--local'], ['y', ENTER], genPath)
26-
t.true(fs.existsSync(`${docsPath}/vendor`))
33+
t.true(fs.existsSync(path.join(docsPath, 'vendor')))
2734
})

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"lint": "eslint .",
2626
"lint:fix": "eslint . --fix",
2727
"pretest": "npm run lint",
28-
"test": "ava e2e/*.test.js e2e/commands/*.test.js",
28+
"test": "ava",
2929
"prebuild": "rimraf bin",
3030
"build": "rollup -c",
3131
"prerelease": "npm run build",

0 commit comments

Comments
 (0)