[Feat]: Add options to createSnapshotContext #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull request validation | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
package-name: [react-snapshot-context] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm clean-install | |
- name: Run ESLint | |
run: npm run precommit | |
- run: npm run build --if-present | |
- name: Run npm pack | |
run: | | |
cd packages/${{ matrix.package-name }} | |
npm pack | |
- name: Upload tarball artifact | |
uses: actions/[email protected] | |
with: | |
name: tarball | |
path: packages/${{ matrix.package-name }}/*.tgz | |
- name: Build pages | |
run: | | |
cd packages/pages | |
npm install | |
npm run build | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: packages/pages/public | |
- name: Run unit tests | |
run: | | |
cd packages/${{ matrix.package-name }} | |
npm test | |
sanity-check: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package-name: [react-snapshot-context] | |
steps: | |
- name: Download tarball artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: tarball | |
- name: Extract tarball to root | |
run: tar -xvf ${{ matrix.package-name }}-*.tgz --strip-components=1 | |
- name: 'Sanity check: has LICENSE' | |
run: compgen -G LICENSE | |
- name: 'Sanity check: has README.md' | |
run: compgen -G README.md | |
- name: 'Sanity check: main exists' | |
run: cat package.json | jq -r '.main' | xargs -L1 test -f $1 | |
- name: 'Sanity check: typings exists' | |
run: cat package.json | jq -r '.types // .typings' | xargs -L1 test -f $1 | |
- name: 'Sanity check: all exports exists' | |
run: cat package.json | jq '.exports | map(flatten) | flatten | .[]' | xargs -L1 test -f $1 | |
- name: 'Sanity check: has source maps' | |
run: compgen -G lib/**/*.js.map | |
- name: 'Sanity check: no lib/**/*.spec.*' | |
run: '! compgen -G lib/**/*.spec.*' | |
- name: 'Sanity check: no lib/**/*.test.*' | |
run: '! compgen -G lib/**/*.test.*' | |
- name: 'Sanity check: no dependencies are pre-release' | |
run: cat package.json | jq '.dependencies | to_entries | map(.value | select(contains("-"))) | if length > 0 then halt_error(1) else empty end' | |
# integration-test: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# node-version: [16.x] | |
# package-name: [react-snapshot-context] | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Use Node.js ${{ matrix.node-version }} | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# cache: 'npm' | |
# - name: Download tarball artifact | |
# uses: actions/[email protected] | |
# with: | |
# name: tarball | |
# path: packages/${{ matrix.package-name }} | |
# - name: Run npm install | |
# run: | | |
# cd packages/integration-test | |
# npm install | |
# - name: Run integration tests | |
# run: | | |
# cd packages/integration-test | |
# npm test |