add github action
This commit is contained in:
parent
83992f81b5
commit
a8389b2d08
68
.github/workflows/tests.yml
vendored
Normal file
68
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
name: "Tests"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
Test:
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
strategy:
|
||||
matrix:
|
||||
node_version: ['lts/*', 'node']
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Node
|
||||
run: nvm ${{ matrix.node_version }}
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
- name: Run Unit Tests
|
||||
run: npm run test:unit
|
||||
- name: Run Spec Tests
|
||||
run: npm run test:spec
|
||||
|
||||
Lint:
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Node
|
||||
run: nvm lts/*
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
- name: Lint ✨
|
||||
run: npm run test:lint
|
||||
|
||||
Build:
|
||||
needs: [Test, Lint]
|
||||
if: github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install Node
|
||||
run: nvm lts/*
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
- name: Build 🧱
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
npm run build
|
||||
if ! git diff --quiet -- dist ; then
|
||||
git config --global user.email "<>"
|
||||
git config --global user.name "GitHub Actions"
|
||||
git commit -m 'chore(build): 🧱 build [skip ci]' --no-verify -- dist
|
||||
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/markedjs/marked.git" HEAD:master
|
||||
fi
|
||||
|
||||
Skip:
|
||||
if: contains(github.event.head_commit.message, '[skip ci]')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Skip CI 🚫
|
||||
run: echo skip ci
|
Loading…
x
Reference in New Issue
Block a user