Skip to content

Commit

Permalink
chore(github): enable github actions (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
nellyk authored Jun 18, 2021
1 parent 2cfcd29 commit 00933c1
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 30 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Health Check

on:
schedule:
# At minute 0 past hour 0800 and 2000.
- cron: '0 8,20 * * *'

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '10.x', '12.x', '14.x', '16.x' ]
name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v2
- run: |
git remote set-branches --add origin main
git fetch
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: npm ci
env:
NODE_ENV: development
- name: Run Test Script
run: npm run test
env:
NODE_ENV: production
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches:
- main

jobs:
prepare:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[skip ci]')"
steps:
- run: echo "${{ github.event.head_commit.message }}"
release:
needs: prepare
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Release
env:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
GITHUB_TOKEN: ${{ secrets.PA_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests

on:
pull_request:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '10.x','12.x', '14.x', '16.x' ]
name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v2
- run: |
git remote set-branches --add origin main
git fetch
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: npm ci
env:
NODE_ENV: development
- name: Unit Tests
run: npm run test
env:
NODE_ENV: production
- name: Lockfile Lint Test
run: npm run test:lockfile
env:
NODE_ENV: production
- name: Git History Test
run: npm run test:git-history
env:
NODE_ENV: production
- name: Lint
run: npm run lint
env:
NODE_ENV: production
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<h1 align="center">
<img src='https://github.com/americanexpress/jest-image-snapshot/raw/master/jest-image-snapshot.png' alt="Jest Image Snapshot - One Amex" width='50%'/>
<img src='https://github.com/americanexpress/jest-image-snapshot/raw/main/jest-image-snapshot.png' alt="Jest Image Snapshot - One Amex" width='50%'/>
</h1>

[![npm](https://img.shields.io/npm/v/jest-image-snapshot)](https://www.npmjs.com/package/jest-image-snapshot)
[![Travis (.org) branch](https://img.shields.io/travis/americanexpress/jest-image-snapshot/master)](https://travis-ci.org/americanexpress/jest-image-snapshot)
![Health Check](https://github.com/americanexpress/jest-image-snapshot/workflows/Health%20Check/badge.svg)
[![Mentioned in Awesome Jest](https://awesome.re/mentioned-badge.svg)](https://github.com/jest-community/awesome-jest)

> Jest matcher that performs image comparisons using [pixelmatch](https://github.com/mapbox/pixelmatch) and behaves just like [Jest snapshots](https://facebook.github.io/jest/docs/snapshot-testing.html) do! Very useful for visual regression testing.
Expand Down Expand Up @@ -292,7 +292,7 @@ Please feel free to open pull requests and see [CONTRIBUTING.md](./CONTRIBUTING.
## 🗝️ License

Any contributions made under this project will be governed by the [Apache License
2.0](https://github.com/americanexpress/jest-image-snapshot/blob/master/LICENSE.txt).
2.0](https://github.com/americanexpress/jest-image-snapshot/blob/main/LICENSE.txt).

## 🗣️ Code of Conduct

Expand Down
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint ./ --ignore-path .gitignore --ext .js",
"test": "jest --ci=false",
"test:lockfile": "lockfile-lint -p package-lock.json -t npm -a npm -o https: -c -i",
"test:git-history": "commitlint --from origin/master --to HEAD",
"test:git-history": "commitlint --from origin/main --to HEAD",
"posttest": "npm run lint && npm run test:git-history && npm run test:lockfile"
},
"keywords": [
Expand Down Expand Up @@ -80,14 +80,27 @@
}
},
"release": {
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
],
"branch": "master"
]
}
}

0 comments on commit 00933c1

Please sign in to comment.