2020-02-05 05:34:19 +00:00
|
|
|
name: 'Test'
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths-ignore:
|
|
|
|
- '*.md'
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- '*.md'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
skipci:
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
steps:
|
2020-03-31 12:26:20 +00:00
|
|
|
- run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
2020-02-05 05:34:19 +00:00
|
|
|
|
|
|
|
test:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- 'ubuntu-18.04'
|
2020-04-30 14:36:53 +00:00
|
|
|
- 'ubuntu-16.04'
|
2020-02-05 05:34:19 +00:00
|
|
|
- 'macos-latest'
|
|
|
|
- 'windows-latest'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2020-03-31 12:26:20 +00:00
|
|
|
- name: Dump GitHub context
|
|
|
|
env:
|
|
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
|
|
run: echo "${GITHUB_CONTEXT}"
|
|
|
|
|
2020-02-05 05:34:19 +00:00
|
|
|
- name: Read .nvmrc
|
|
|
|
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
|
|
|
id: nvm
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
|
|
|
|
2020-03-06 17:54:14 +00:00
|
|
|
- run: npm i -g npm
|
|
|
|
|
|
|
|
- name: Dump version
|
|
|
|
run: |
|
|
|
|
node -v
|
|
|
|
npm --version
|
|
|
|
git --version
|
|
|
|
|
2020-02-05 05:34:19 +00:00
|
|
|
- run: npm ci
|
|
|
|
|
|
|
|
- name: Run prettier
|
2020-04-30 14:36:53 +00:00
|
|
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
2020-02-05 05:34:19 +00:00
|
|
|
run: npm run format:check
|
|
|
|
|
|
|
|
- name: Run eslint
|
2020-04-30 14:36:53 +00:00
|
|
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
2020-02-05 05:34:19 +00:00
|
|
|
run: npm run lint
|
|
|
|
|
|
|
|
- run: npm test
|
|
|
|
|
|
|
|
- name: Upload test coverage as artifact
|
2020-04-30 14:36:53 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
2020-02-05 05:34:19 +00:00
|
|
|
with:
|
2020-04-30 14:36:53 +00:00
|
|
|
name: coverage-${{ matrix.os }}
|
2020-02-05 05:34:19 +00:00
|
|
|
path: coverage
|
2020-02-24 09:49:55 +00:00
|
|
|
|
|
|
|
- uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2020-03-31 12:26:20 +00:00
|
|
|
|
|
|
|
- name: Run ncc
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- name: Remove lint-staged husky
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
run: |
|
|
|
|
npm uninstall lint-staged husky
|
|
|
|
git checkout package-lock.json package.json
|
|
|
|
|
|
|
|
- name: Setup mdBook
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
uses: peaceiris/actions-mdbook@v1
|
|
|
|
with:
|
2020-05-01 06:10:19 +00:00
|
|
|
mdbook-version: '0.3.7'
|
2020-03-31 12:26:20 +00:00
|
|
|
|
|
|
|
- name: Build site
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
working-directory: ./test_projects/mdbook
|
|
|
|
run: mdbook build
|
|
|
|
|
|
|
|
- name: Deploy
|
|
|
|
if: |
|
2020-04-30 14:36:53 +00:00
|
|
|
startsWith(matrix.os, 'ubuntu-18.04') &&
|
2020-03-31 12:26:20 +00:00
|
|
|
github.ref == 'refs/heads/master'
|
|
|
|
uses: ./
|
|
|
|
with:
|
2020-05-04 02:55:40 +00:00
|
|
|
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2020-03-31 12:26:20 +00:00
|
|
|
# publish_branch: gh-pages
|
|
|
|
publish_dir: ./test_projects/mdbook/book
|
|
|
|
# external_repository: ''
|
|
|
|
allow_empty_commit: true
|
|
|
|
# keep_files: true
|
|
|
|
# force_orphan: true
|
|
|
|
user_name: 'github-actions[bot]'
|
|
|
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
# commit_message: ${{ github.event.head_commit.message }}
|
2020-04-02 10:34:58 +00:00
|
|
|
cname: 'actions-gh-pages.peaceiris.com'
|
2020-03-31 12:26:20 +00:00
|
|
|
|
2020-04-30 14:36:53 +00:00
|
|
|
- name: Deploy
|
|
|
|
if: |
|
|
|
|
startsWith(matrix.os, 'ubuntu-16.04') &&
|
|
|
|
github.ref == 'refs/heads/master'
|
|
|
|
uses: ./
|
|
|
|
with:
|
2020-05-04 02:55:40 +00:00
|
|
|
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
|
|
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
2020-04-30 14:36:53 +00:00
|
|
|
publish_branch: gh-pages-ubuntu-16.04
|
|
|
|
publish_dir: ./test_projects/mdbook/book
|
|
|
|
# external_repository: ''
|
|
|
|
allow_empty_commit: true
|
|
|
|
keep_files: true
|
|
|
|
force_orphan: true
|
|
|
|
user_name: 'github-actions[bot]'
|
|
|
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
2020-05-04 00:50:38 +00:00
|
|
|
full_commit_message: ${{ github.event.head_commit.message }}
|
2020-04-30 14:36:53 +00:00
|
|
|
|
2020-03-31 12:26:20 +00:00
|
|
|
- name: Deploy
|
|
|
|
if: |
|
|
|
|
startsWith(matrix.os, 'macos') &&
|
|
|
|
github.ref == 'refs/heads/master'
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
|
|
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# personal_token: ${{ secrets.PERSONAL_TOKEN }}
|
|
|
|
publish_branch: gh-pages-macos
|
|
|
|
publish_dir: ./test_projects/mdbook/book
|
|
|
|
# external_repository: ''
|
|
|
|
allow_empty_commit: true
|
|
|
|
# keep_files: true
|
|
|
|
# force_orphan: true
|
|
|
|
user_name: 'github-actions[bot]'
|
|
|
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
# commit_message: ${{ github.event.head_commit.message }}
|
|
|
|
|
|
|
|
- name: Deploy
|
|
|
|
if: |
|
|
|
|
startsWith(matrix.os, 'windows') &&
|
|
|
|
github.ref == 'refs/heads/master'
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# personal_token: ${{ secrets.PERSONAL_TOKEN }}
|
|
|
|
publish_branch: gh-pages-windows
|
|
|
|
publish_dir: ./test_projects/mdbook/book
|
|
|
|
# external_repository: ''
|
|
|
|
allow_empty_commit: true
|
|
|
|
# keep_files: true
|
|
|
|
# force_orphan: true
|
|
|
|
user_name: 'github-actions[bot]'
|
|
|
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
# commit_message: ${{ github.event.head_commit.message }}
|
2020-05-01 06:10:19 +00:00
|
|
|
|
|
|
|
test-ubuntu-2004:
|
|
|
|
runs-on: 'ubuntu-18.04'
|
|
|
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
|
|
container:
|
|
|
|
image: 'ubuntu:20.04'
|
|
|
|
steps:
|
|
|
|
- name: Install deps
|
|
|
|
run: |
|
|
|
|
apt update
|
|
|
|
apt install -y software-properties-common
|
|
|
|
add-apt-repository ppa:git-core/ppa
|
|
|
|
apt update
|
|
|
|
apt install -y \
|
|
|
|
git \
|
|
|
|
ssh
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Dump GitHub context
|
|
|
|
env:
|
|
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
|
|
run: echo "${GITHUB_CONTEXT}"
|
|
|
|
|
|
|
|
- name: Read .nvmrc
|
|
|
|
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
|
|
|
id: nvm
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
|
|
|
|
|
|
|
- run: npm i -g npm
|
|
|
|
|
|
|
|
- name: Dump version
|
|
|
|
run: |
|
|
|
|
node -v
|
|
|
|
npm --version
|
|
|
|
git --version
|
|
|
|
|
|
|
|
- run: npm ci
|
|
|
|
- run: npm test
|
|
|
|
|
|
|
|
- name: Run ncc
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- name: Remove lint-staged husky
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
run: |
|
|
|
|
npm uninstall lint-staged husky
|
|
|
|
git checkout package-lock.json package.json
|
|
|
|
|
|
|
|
- name: Setup mdBook
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
uses: peaceiris/actions-mdbook@v1
|
|
|
|
with:
|
|
|
|
mdbook-version: '0.3.7'
|
|
|
|
|
|
|
|
- name: Build site
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
working-directory: ./test_projects/mdbook
|
|
|
|
run: mdbook build
|
|
|
|
|
|
|
|
- name: Deploy
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_branch: gh-pages-ubuntu-20.04
|
|
|
|
publish_dir: ./test_projects/mdbook/book
|
|
|
|
# external_repository: ''
|
|
|
|
allow_empty_commit: true
|
|
|
|
# keep_files: true
|
|
|
|
# force_orphan: true
|
|
|
|
user_name: 'github-actions[bot]'
|
|
|
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
# commit_message: ${{ github.event.head_commit.message }}
|