Giter Site home page Giter Site logo

cypress-notify's Introduction

Cypress notify

CI Status codecov License: MIT

Inspiration from cypress-slack-video-upload-action and cypress-slack-reporter using gh-actions-template

Table of Contents

Details

Inputs

token

Required Slack app token. See Internal app tokens

  • Create an app
  • Under Bot Token Scopes, add files:write and chat:write permissions
  • Install the app into your workspace
  • Invite the bot to whatever channels you want to send the videos and screenshots to /invite <botname>
  • Grab the Bot User OAuth Token from the OAuth & Permissions page
  • Add that token as a secret to your Github repo's Actions Secrets found under Settings -> Secrets (in the examples below we call it SLACK_TOKEN)

channels

Required Slack channels to upload to

workdir

Optional The folder where Cypress stores screenshots and videos on the build machine.

Default: cypress

(this relative path resolves to /home/runner/work/<REPO_NAME>/<REPO_NAME>/cypress)

If your project uses Cypress from the project root folder, the default value will work for you. But if your project uses Cypress in a subfolder (like most monorepos), you'll need to provide the relative path to that folder (i.e. e2e/cypress). (Don't include a trailing slash on your path!)

Examples

Upload results after every push

on: [push]

jobs:
  test-and-upload-results:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: 'Run tests'
        uses: cypress-io/github-action@v2

      - name: 'Upload screenshots and videos to Slack'
        uses: ngocsangyem/cypress-notify
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          channels: 'engineering-ops'

Only upload when open PRs fail

on: [pull_request]

jobs:
  test-and-upload-results-on-fail:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: 'Run tests'
        uses: cypress-io/github-action@v2

      - name: 'Upload screenshots and videos to Slack'
        uses: ngocsangyem/cypress-notify
        if: failure()
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          channels: 'engineering-ops'

Read more

Setup

yarn

  • yarn setup

npm

  • npm run setup

Workflows

Some workflows are included by default.

ci.yml

CI Workflow

  1. ESLint
  2. Jest
    • Send coverage report to codecov if CODECOV_TOKEN is set.
  3. Release GitHub Actions
    • if tag is added.
  4. Publish package
    • if tag is added and NPM_AUTH_TOKEN is set.
  5. Publish release
    • if 3 and 4 jobs are succeeded.
  6. Notify by slack
    • if workflow is failure

ACCESS_TOKEN is required.

add-version-tag.yml

Add the release tag when pull request is merged.

  1. Get next version from commits histories.
    see Conventional Commits
  2. Add tag.
  3. Create branch for next version.

ACCESS_TOKEN is required.

toc.yml

Create TOC (Table of contents)

ACCESS_TOKEN is required.

issue-opened.yml

  • Assign the issue to project
    default setting:
    Project: Backlog
    Column: To do
    
  • Assign author to issue

pr-opened.yml

  • Assign the PR to project
    default setting:
    Project: Backlog
    Column: In progress
    
    ACCESS_TOKEN is required.
  • Assign author to PR
  • Add labels by branch
    setting

pr-updated.yml

  • Add labels by changed files setting
  • Create PR histories
  • Manage PR by release type
    ACCESS_TOKEN is required.
  • Check version in package.json
    ACCESS_TOKEN is required.
  • Check if it can be published to npm
    if NPM_AUTH_TOKEN is set

project-card-moved.yml

Manage labels by moving project cards

broken-link-check.yml

Check broken link in README

update-dependencies.yml

Update package dependencies

  • schedule
  • PR opened, closed
  • repository dispatch

add-test-tag.yml

Add tag for test release

Secrets

ACCESS_TOKEN

Personal access token with the public_repo or repo scope
(repo is required for private repositories)

SLACK_WEBHOOK_URL

https://api.slack.com/messaging/webhooks

Test release

technote-space/release-github-actions-cli - GitHub

  1. Create .env
    Set Personal access token
    token=1234567890abcdef1234567890abcdef12345678
  2. Run yarn release
    • Dry run: yarn release -n
    • Help: yarn release -h

Then, you can use your GitHub Actions like follows:

on: push
name: Test
jobs:
  toc:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: owner/repo@gh-actions

Helpers

technote-space/github-action-helper - GitHub

technote-space/github-action-test-helper - GitHub

technote-space/filter-github-action - GitHub

Author

GitHub (ngocsangyem)
Blog

cypress-notify's People

Contributors

ngocsangyem avatar sagsagg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.