Skip to content

Commit

Permalink
refactor(ci): 💚 fix test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Jul 14, 2022
1 parent 99e052b commit 2a04c21
Show file tree
Hide file tree
Showing 13 changed files with 450 additions and 292 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/lint.yml

This file was deleted.

126 changes: 126 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: main

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
install:
name: Install node_modules
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules # use this to check for `cache-hit` (`steps.cache-node-modules.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

lint:
name: Lint
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules # use this to check for `cache-hit` (`steps.cache-node-modules.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- name: Lint
run: yarn lint

build:
name: Build
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules # use this to check for `cache-hit` (`steps.cache-node-modules.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- name: Build
run: yarn build

test:
name: Test
needs: install
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules # use this to check for `cache-hit` (`steps.cache-node-modules.outputs.cache-hit != 'true'`)
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- name: Test
run: yarn test
41 changes: 0 additions & 41 deletions .github/workflows/test.yml

This file was deleted.

116 changes: 0 additions & 116 deletions __tests__/__snapshots__/snapshot.tsx.snap

This file was deleted.

15 changes: 0 additions & 15 deletions __tests__/index.test.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions __tests__/snapshot.tsx

This file was deleted.

9 changes: 9 additions & 0 deletions components/__tests__/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders CopyButton unchanged 1`] = `
<div>
<button>
Button
</button>
</div>
`;
6 changes: 6 additions & 0 deletions components/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { render } from "@testing-library/react";

it("renders CopyButton unchanged", () => {
const { container } = render(<button>Button</button>);
expect(container).toMatchSnapshot();
});
Loading

0 comments on commit 2a04c21

Please sign in to comment.