diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..28251d340d --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 + with: + node-version: ${{ 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: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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 275057702c..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: node_js - -jobs: - fast_finish: true - allow_failures: - - stage: security scan 🔐 - - include: - - stage: unit tests 👩🏽‍💻 - script: npm run test:unit - node_js: lts/* - - - stage: spec tests 👩🏽‍💻 - script: npm run test:specs - node_js: lts/* - - node_js: node - - - stage: lint ✨ - script: npm run test:lint - node_js: lts/* - - - stage: build 🗜️ - script: | - npm run build - if ! git diff --quiet; then - git config --global user.email "<>" - git config --global user.name "MarkedJS bot" - git config credential.helper "store --file=.git/credentials" - echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials - git commit -am '🗜️ build [skip ci]' - git push origin HEAD:${TRAVIS_BRANCH} - fi - node_js: lts/* - if: branch = master AND type = push - - # - stage: security scan 🔐 - # script: npm run test:redos - # node_js: lts/* - -cache: - directories: - - node_modules - -git: - depth: 3 diff --git a/README.md b/README.md index e93504ca93..7f6f0bd9e1 100644 --- a/README.md +++ b/README.md @@ -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