ci: Merge test workflows (#204)
This commit is contained in:
parent
45a2a58fb0
commit
ed5a99d637
|
@ -1,118 +0,0 @@
|
|||
name: Test Action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
# pull_request:
|
||||
# types:
|
||||
# - opened
|
||||
# - synchronize
|
||||
# paths-ignore:
|
||||
# - '*.md'
|
||||
|
||||
jobs:
|
||||
skipci:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
||||
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
os:
|
||||
- 'ubuntu-18.04'
|
||||
- 'macos-latest'
|
||||
- 'windows-latest'
|
||||
steps:
|
||||
- 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
|
||||
|
||||
- name: Remove lint-staged husky
|
||||
run: |
|
||||
npm uninstall lint-staged husky
|
||||
git checkout package-lock.json package.json
|
||||
|
||||
- run: npm run build
|
||||
|
||||
- name: Setup mdBook
|
||||
uses: peaceiris/actions-mdbook@v1
|
||||
with:
|
||||
mdbook-version: '0.3.6'
|
||||
|
||||
- name: Build
|
||||
working-directory: ./test_projects/mdbook
|
||||
run: mdbook build
|
||||
|
||||
- name: Prepare tag
|
||||
id: prepare_tag
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
TAG_NAME="${GITHUB_REF##refs/tags/}"
|
||||
echo "::set-output name=tag_name::${TAG_NAME}"
|
||||
echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"
|
||||
|
||||
- name: Deploy
|
||||
if: matrix.os != 'windows-latest'
|
||||
uses: ./
|
||||
with:
|
||||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# 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 }}
|
||||
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
|
||||
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
|
||||
|
||||
- name: Deploy
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: ./
|
||||
with:
|
||||
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# personal_token: ${{ secrets.PERSONAL_TOKEN }}
|
||||
# publish_branch: gh-pages
|
||||
publish_dir: ./test_projects/mdbook/book
|
||||
# external_repository: ''
|
||||
allow_empty_commit: true
|
||||
# keep_files: true
|
||||
# force_orphan: true
|
||||
# user_name: iris
|
||||
# user_email: email@peaceiris.com
|
||||
# commit_message: ${{ github.event.head_commit.message }}
|
||||
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
|
||||
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
skipci:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
||||
- run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
||||
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
@ -31,6 +31,11 @@ jobs:
|
|||
steps:
|
||||
- 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
|
||||
|
@ -58,10 +63,6 @@ jobs:
|
|||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: npm run lint
|
||||
|
||||
- name: Run ncc
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: npm run build
|
||||
|
||||
- run: npm test
|
||||
|
||||
- name: Upload test coverage as artifact
|
||||
|
@ -73,3 +74,79 @@ jobs:
|
|||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- 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.6'
|
||||
|
||||
- name: Build site
|
||||
if: github.ref == 'refs/heads/master'
|
||||
working-directory: ./test_projects/mdbook
|
||||
run: mdbook build
|
||||
|
||||
- name: Deploy
|
||||
if: |
|
||||
startsWith(matrix.os, 'ubuntu') &&
|
||||
github.ref == 'refs/heads/master'
|
||||
uses: ./
|
||||
with:
|
||||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# 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 }}
|
||||
|
||||
- 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 }}
|
||||
|
|
Loading…
Reference in New Issue