Skip to content

Commit

Permalink
chore: migrate to GitHub Actions (#124)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
sy-records and jamesgeorge007 authored Nov 3, 2020
1 parent d427411 commit 57578e4
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 20 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/docsify-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: docsify-cli

on:
push:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
node-version: [ 12.x, 14.x ]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Build docsify-cli
run: npm run build

- name: Run e2e tests
run: npm run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/
yarn.lock
bin/
test_docs/
.idea
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<p align="center">
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/docsify/backers/badge.svg?style=flat-square"></a>
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/docsify/sponsors/badge.svg?style=flat-square"></a>
<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>
<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>
<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>
<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>
<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>
<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>
Expand Down
3 changes: 3 additions & 0 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
files: ['e2e/**/*.test.js']
}
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# docsify-cli

[![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)
[![Build Status master branch](https://github.com/docsifyjs/docsify-cli/workflows/docsify-cli/badge.svg)](https://github.com/docsifyjs/docsify-cli/actions)
[![License](https://img.shields.io/github/license/docsifyjs/docsify-cli.svg?style=flat-square)](https://github.com/docsifyjs/docsify-cli/blob/master/LICENSE)
[![Github tag](https://img.shields.io/github/tag/docsifyjs/docsify-cli.svg?style=flat-square)](https://github.com/docsifyjs/docsify-cli/tags)
[![npm version](https://img.shields.io/npm/v/docsify-cli.svg?style=flat-square)](https://www.npmjs.com/package/docsify-cli)
Expand Down
17 changes: 12 additions & 5 deletions e2e/commands/init.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
const test = require('ava')
const fs = require('fs')
const path = require('path')
const {ENTER} = require('cli-prompts-test')

const {run, runPromptWithAnswers} = require('../helpers/test-utils.js')

const genPath = `${__dirname}/init-cmd`
const docsPath = `${__dirname}/init-cmd/docs`
const genPath = path.join(__dirname, 'init-cmd')
const docsPath = path.join(genPath, 'docs')

test.before('create temp directory', () => {
// Cleanup if the directory already exists
if (fs.existsSync(genPath)) {
fs.rmdirSync(genPath, {recursive: true})
}

fs.mkdirSync(genPath)
})

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

test('force generates docs directory with --local flag', async t => {
await runPromptWithAnswers(['init', 'docs', '--local'], ['y', ENTER], genPath)
t.true(fs.existsSync(`${docsPath}/vendor`))
t.true(fs.existsSync(path.join(docsPath, 'vendor')))
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"pretest": "npm run lint",
"test": "ava e2e/*.test.js e2e/commands/*.test.js",
"test": "ava",
"prebuild": "rimraf bin",
"build": "rollup -c",
"prerelease": "npm run build",
Expand Down

0 comments on commit 57578e4

Please sign in to comment.