Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
uses: dcodeIO/setup-node-nvm@master

@styfle styfle Apr 1, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would rather use the official node.js action and run tests on mac and windows as well as linux. Is this only used to reference lts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only used to reference lts?

Yes, there is no way to reference lts or latest with the official node.js action. And updating the version number will be forgotten if we don't automate it.

@UziTech UziTech Apr 1, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and run tests on mac and window

I don't really see how this library can change depending on which os it is on. It has no dependencies and no os dependent code.

If it does run differently on different os's with node that would be a node issue not a marked issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose maybe testing the cli but we don't do that right now anyway.

with:
node-version: ${{ matrix.node_version }}
- name: Install Dependencies
run: npm ci
- name: Run Unit Tests 👩🏽‍💻

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we run lint before unit tests instead of a separate job? If it fails lint then it could fail fast.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to run in parallel. We could turn off the fail-fast so it will always run both tests on node and lts and lint. For that matter we could also run unit tests and spec tests in parallel too if we wanted.

run: npm run test:unit
- name: Run Spec Tests 👩🏽‍💻
run: npm run test:specs

Lint:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- 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; then
git config --global user.email "<>"
git config --global user.name "MarkedJS bot"
git commit -am "🗜️ build [skip ci]"
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
45 changes: 0 additions & 45 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 @@ -10,7 +10,7 @@
[![downloads](https://badgen.net/npm/dt/marked)](https://www.npmjs.com/package/marked)
[![dep](https://badgen.net/david/dep/markedjs/marked?label=deps)](https://david-dm.org/markedjs/marked)
[![dev dep](https://badgen.net/david/dev/markedjs/marked?label=devDeps)](https://david-dm.org/markedjs/marked?type=dev)
[![travis](https://badgen.net/travis/markedjs/marked)](https://travis-ci.org/markedjs/marked)
[![github actions](https://github.com/markedjs/marked/workflows/Tests/badge.svg)](https://github.com/markedjs/marked/actions)
[![snyk](https://snyk.io/test/npm/marked/badge.svg)](https://snyk.io/test/npm/marked)

- ⚡ built for speed
Expand Down