Setup CI to run linting / typechecking / unit testing with Github Actions

This commit is contained in:
Hammad Jutt
2020-07-26 10:50:06 -06:00
parent 4adabe29b8
commit c7f74aa211
4 changed files with 39 additions and 11 deletions

38
.github/workflows/PR-CI.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: TheGame CI
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.4.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install packages
run: yarn --frozen-lockfile
- name: Linting
run: yarn lint
- name: Typechecking
run: yarn typecheck
- name: Testing
run: yarn test
env:
CI: true

View File

@@ -21,6 +21,7 @@
"hasura:migrate:init": "npm run hasura migrate create \"init\" -- --from-server",
"hasura:migrate:apply": "npm run hasura migrate apply",
"test": "lerna run test --parallel",
"test:full": "yarn lint && yarn typecheck && yarn test",
"clean": "lerna clean",
"format": "prettier --ignore-path .gitignore --write \"{*,**/*}.{ts,tsx,js,jsx,json,yml,yaml,md}\"",
"lint": "eslint --ignore-path .gitignore \"./packages/**/*.{ts,tsx,js,jsx}\"",

View File

@@ -6,7 +6,6 @@
"start": "react-scripts start",
"build": "react-scripts build",
"dev": "yarn start",
"test": "react-scripts test",
"eject": "react-scripts eject",
"typecheck": "tsc --noEmit",
"precommit": "yarn lint-staged"

View File

@@ -1,10 +0,0 @@
import { render } from '@testing-library/react';
import React from 'react';
import { App } from './App';
test('renders learn react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});