Skip to content

Commit

Permalink
Add CI checks and resolve initial linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
qrtp committed Oct 19, 2023
1 parent ebbffc8 commit ce964dc
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
project: './tsconfig.json',
},
plugins: ['@typescript-eslint', 'unused-imports', 'promise'],
ignorePatterns: ['.eslintrc.js'],
ignorePatterns: ['.eslintrc.js', 'test/*', '*.js'],
rules: {
// TODO: Rules to review with the team
'@typescript-eslint/default-param-last': 'off',
Expand Down
16 changes: 16 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup
description: Checkout, install, and build
runs:
using: composite
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- run: yarn install --immutable
shell: bash
73 changes: 73 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: PR CI

on:
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.ref }}-${{ github.event_name }}-pr
cancel-in-progress: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
pr_ci:
name: PR CI
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Build Shared
run: yarn shared-build

- name: Typecheck
run: yarn typecheck

- name: Lint
run: yarn lint

- uses: dorny/paths-filter@v2
id: changes
with:
base: ${{ github.base_ref }}
filters: |-
server: [server/**, packages/**]
packages: [packages/**]
- name: Run Tests - UD.me Frontend
if: ${{ steps.changes.outputs.server == 'true' }}
run: yarn test:ci ./server/**
env:
NODE_OPTIONS: --max_old_space_size=3072

- name: Run Tests - Shared Packages
if: ${{ steps.changes.outputs.packages == 'true' }}
run: yarn test:ci ./packages/**
env:
NODE_OPTIONS: --max_old_space_size=3072

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
:tada: All your tests were successful!
We detected changes in the following services:
${{ steps.changes.outputs.server == 'true' && '- UD.me Frontend' || '' }}
${{ steps.changes.outputs.packages == 'true' && '- Shared Packages' || '' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload test results to GitHub
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: ${{ github.sha }}
path: |
coverage/**/lcov.info
coverage/**/coverage-final.json
retention-days: 1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ web_modules/
.yarn-integrity
.yarn/

# Jest
.jest-cache

# dotenv environment variable files
!scripts/**/.env
.env.development.local
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"format": "prettier -w .",
"husky": "[ -z \"${CI:-}\" ] && husky install",
"lint": "eslint --fix .",
"test": "DOTENV_CONFIG_PATH=./.env.test jest"
"test": "DOTENV_CONFIG_PATH=./.env.test jest",
"test:ci": "yarn test --coverage --ci --no-colors --runInBand --forceExit --cacheDirectory .jest-cache",
"typecheck": "yarn workspace server run typecheck"
},
"devDependencies": {
"@swc/cli": "^0.1.57",
Expand Down
1 change: 1 addition & 0 deletions packages/config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import env from './env';

export type {DeepPartial} from './env/types';
export default env;
2 changes: 1 addition & 1 deletion server/components/Badges/BadgePopupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const BadgePopupModal = ({
void router.push(`${config.UD_ME_BASE_URL}/badge/${badgeCode}`);
};

const getSponsorsTooltip = (): React.ReactFragment => {
const getSponsorsTooltip = () => {
return (
<div>
<Typography variant="body1" className={classes.sponsorName}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export const CommunityConversationBubble: React.FC<
<Box>
<Emoji>
{typeof message.messageObj === 'string'
? message.messageObj
: message.messageObj.content}
? (message.messageObj as string)
: (message.messageObj.content as string)}
</Emoji>
</Box>,
);
Expand Down
10 changes: 7 additions & 3 deletions server/components/Image/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ const useStyles = makeStyles()(() => ({
},
}));

type Props = {
type LogoProps = {
className?: string;
inverse?: boolean;
absoluteUrl?: boolean;
};

const Logo: React.FC<Props> = ({className = '', inverse, absoluteUrl}) => {
type HomeLinkProps = {
children: React.ReactNode;
};

const Logo: React.FC<LogoProps> = ({className = '', inverse, absoluteUrl}) => {
const {classes, cx} = useStyles();
const logoIconTheme = inverse ? LogoTheme.White : LogoTheme.Primary;

const HomeLink: React.FC = ({children}) => {
const HomeLink: React.FC<HomeLinkProps> = ({children}) => {
return (
<Link
href={config.UNSTOPPABLE_WEBSITE_URL}
Expand Down
4 changes: 3 additions & 1 deletion server/components/TokenGallery/NftCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ const NftCard = ({nft, domain, placeholder}: Props) => {
<div className={'NFT-container'} data-testid={'nft-card'}>
<div className={'NFT-image-container'}>
{shouldRenderVideo() ? (
<VisibilitySensor onChange={isVis => setIsVisible(isVis)}>
<VisibilitySensor
onChange={(isVis: boolean) => setIsVisible(isVis)}
>
<video
onClick={handleClick}
muted
Expand Down
3 changes: 2 additions & 1 deletion server/lib/i18n/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type {DeepPartial} from 'config/env/types';
import localesConfig from 'locales.json';
import en_us from 'locales/en.json';
import {clone} from 'ramda';

import type {DeepPartial} from '@unstoppabledomains/config';

import type {AvailableLocales} from './types';
import {DEFAULT_LOCALE} from './types';

Expand Down
3 changes: 2 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"dev": "../setenv.sh development next dev -p 3000",
"format": "prettier -w .",
"lint": "next lint",
"start": "next start"
"start": "next start",
"typecheck": "tsc --project tsconfig.json --noEmit"
},
"resolutions": {
"@types/react": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"ignoreDeprecations": "5.0",
"rootDirs": ["./", "../packages"]
"rootDirs": ["./"]
},
"paths": {
"*": ["*"]
Expand Down

0 comments on commit ce964dc

Please sign in to comment.