Skip to content

Commit

Permalink
🚀 Notifications and RWD release 2.0.0 (#4644)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan authored Nov 23, 2023
2 parents 974f37f + 1b920fe commit 1031792
Show file tree
Hide file tree
Showing 320 changed files with 31,666 additions and 2,749 deletions.
38 changes: 29 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
"plugin:import/warnings",
"plugin:import/typescript"
],
"plugins": ["import", "react-hooks"],
"ignorePatterns": [".eslintrc.js"],
"plugins": [
"import"
],
"ignorePatterns": [
".eslintrc.js",
"index.html"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
Expand Down Expand Up @@ -41,12 +46,22 @@
"import/order": [
"error",
{
"groups": ["builtin", "external", "parent", ["index", "sibling"]],
"groups": [
"builtin",
"external",
"parent",
[
"index",
"sibling"
]
],
"pathGroups": [
{ "pattern": "@test/**", "position": "after", "group": "builtin" },
{ "pattern": "@/**", "position": "after", "group": "external" }
],
"pathGroupsExcludedImportTypes": ["builtin"],
"pathGroupsExcludedImportTypes": [
"builtin"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
Expand All @@ -59,25 +74,30 @@
{
"noUselessIndex": true
}
],
"react-hooks/rules-of-hooks": "error"
]
},
"overrides": [
{
"files": ["test/**/*.{js,ts,tsx}"],
"files": [
"test/**/*.{js,ts,tsx}"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"no-unused-expressions": "off"
}
},
{
"files": ["**/__generated__/**/*.{js,ts,tsx}"],
"files": [
"**/__generated__/**/*.{js,ts,tsx}"
],
"rules": {
"import/order": "off"
}
},
{
"files": ["src/common/logger/*.ts"],
"files": [
"src/common/logger/*.ts"
],
"rules": {
"no-console": "off"
}
Expand Down
69 changes: 61 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ jobs:
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

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

- name: Verify formatting
run: yarn lint

ui-unit-tests:
needs: install
timeout-minutes: 60
Expand Down Expand Up @@ -62,15 +63,13 @@ jobs:
- name: Install dependencies
run: yarn --immutable

- name: Verify linting
run: yarn lint

- name: Build Pioneer
working-directory: packages/ui
run: yarn build

- name: Run tests
run: node --max_old_space_size=7000 --expose-gc $(yarn bin jest) --logHeapUsage --silent
working-directory: packages/ui
run: node --max_old_space_size=7000 --expose-gc $(yarn bin jest) --logHeapUsage --silent

interaction-tests:
needs: install
Expand Down Expand Up @@ -149,6 +148,60 @@ jobs:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Run Storybook tests
run: yarn workspace @joystream/pioneer test-storybook
working-directory: packages/ui
run: yarn test-storybook
env:
TARGET_URL: https://${{ env.VERCEL_DEPLOYMENT_URL }}

backend-integration-tests:
needs: install
timeout-minutes: 60
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}

services:
db:
image: postgres
env: { POSTGRES_PASSWORD: "postgres" }
ports: ["5432:5432"]
# Set health checks to wait until Postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --immutable

- name: Build
working-directory: packages/server
run: yarn build
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres

- name: Run tests
working-directory: packages/server
run: yarn test --silent
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
49 changes: 49 additions & 0 deletions .github/workflows/backend-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Backend Docker

on:
pull_request:
paths:
- packages/server/**

# Docker images will only be pushed when we manually dispatch this workflow
workflow_dispatch:
inputs:
docker_image_tag:
description: 'Tag to use on docker image, eg. "latest", or "next"'
required: true
default: "next"

jobs:
docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: github.event_name == 'workflow_dispatch'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build (production)
uses: docker/build-push-action@v3
with:
# Do not use local dir context to ensure we can build from a commit directly
# context: .
file: backend.Dockerfile
push: ${{ github.event_name == 'workflow_dispatch' }}
tags: joystream/pioneer-backend:${{ github.event.inputs.docker_image_tag || 'next' }}

- name: Build (dev)
uses: docker/build-push-action@v3
with:
# Do not use local dir context to ensure we can build from a commit directly
# context: .
file: backend.dev.Dockerfile
push: ${{ github.event_name == 'workflow_dispatch' }}
tags: joystream/pioneer-backend-dev:${{ github.event.inputs.docker_image_tag || 'next' }}
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0 (Notifications and RWD)][2.0.0] - 2023-11-23

### Added
- Email notifications support for forum and elections events.
- New responsive web design.
- Add account balances in the membership pane.

### Fixed
- Past councils spending amounts.

## [1.9.0] - 2023-11-03

### Added
Expand Down Expand Up @@ -215,7 +225,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.1.1] - 2022-12-02

[unreleased]: https://github.com/Joystream/pioneer/compare/v1.9.0...HEAD
[unreleased]: https://github.com/Joystream/pioneer/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/Joystream/pioneer/compare/v1.9.0...v2.0.0
[1.9.0]: https://github.com/Joystream/pioneer/compare/v1.8.0...v1.9.0
[1.8.0]: https://github.com/Joystream/pioneer/compare/v1.7.0...v1.8.0
[1.7.0]: https://github.com/Joystream/pioneer/compare/v1.6.0...v1.7.0
Expand Down
48 changes: 48 additions & 0 deletions backend.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM node:20 AS base
WORKDIR /app

RUN set -eux; \
apt-get update -y; \
apt-get install -y --no-install-recommends openssl; \
rm -rf /var/lib/apt/list/*

FROM base AS builder

COPY packages/server/package.json ./
COPY packages/server/docker/yarn.lock ./
RUN yarn --immutable

COPY tsconfig.json ./base.tsconfig.json
COPY packages/server/tsconfig.json ./
RUN sed -i 's/"extends":.*/"extends": ".\/base.tsconfig.json",/' tsconfig.json

COPY packages/server/prisma ./
COPY packages/server/codegen.ts ./
COPY packages/server/src ./src
RUN yarn build:local

RUN rm -rf node_modules
ENV NODE_ENV=production
RUN yarn --prod --immutable
RUN yarn prisma generate

FROM base

USER www-data

COPY --from=builder --chown=www-data /app/dist ./dist
COPY --from=builder --chown=www-data /app/node_modules ./node_modules
COPY packages/server/prisma ./prisma
COPY packages/server/docker/prod/entrypoint.sh /entrypoint.sh
COPY packages/server/docker/prod/notify.sh /usr/bin/notify

ENV QUERY_NODE_ENDPOINT "https://query.joystream.org/graphql"
ENV PIONEER_URL "https://pioneerapp.xyz"
ENV STARTING_BLOCK 1
ENV NODE_ENV=production
ENV APP_LOG_LEVEL "verbose"
ENV PORT 3000
EXPOSE 3000/tcp

ENTRYPOINT ["/entrypoint.sh"]
CMD ["api"]
42 changes: 42 additions & 0 deletions backend.dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM node:20-alpine3.18 AS builder
WORKDIR /app

COPY packages/server/package.json ./
COPY packages/server/docker/yarn.lock ./
RUN yarn --immutable

COPY tsconfig.json ./base.tsconfig.json
COPY packages/server/tsconfig.json ./
RUN sed -i 's/"extends":.*/"extends": ".\/base.tsconfig.json",/' tsconfig.json

COPY packages/server/prisma ./
COPY packages/server/codegen.ts ./
COPY packages/server/src ./src
RUN yarn build:local

RUN rm -rf node_modules
ENV NODE_ENV=production
RUN yarn --prod --immutable
RUN yarn prisma generate

FROM postgres:16.0-alpine3.18
WORKDIR /app
RUN apk add --no-cache nodejs

COPY --from=builder --chown=postgres /app/dist ./dist
COPY --from=builder --chown=postgres /app/node_modules ./node_modules
COPY packages/server/prisma ./prisma
COPY packages/server/docker/dev/entrypoint.sh /entrypoint.sh
COPY packages/server/docker/dev/notify.sh /usr/bin/notify
COPY packages/server/docker/dev/env.sh ./
COPY packages/server/docker/dev/prisma-deploy.sh /docker-entrypoint-initdb.d/

ENV QUERY_NODE_ENDPOINT "https://query.joystream.org/graphql"
ENV PIONEER_URL "https://pioneerapp.xyz"
ENV STARTING_BLOCK 1
ENV APP_LOG_LEVEL "verbose"
ENV PORT 3000
EXPOSE 3000/tcp

ENTRYPOINT ["/entrypoint.sh"]
CMD ["api"]
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@
]
},
"scripts": {
"lint": "wsrun --package @joystream/pioneer -c lint",
"lint:fix": "wsrun --package @joystream/pioneer -c lint:fix",
"build": "wsrun --fast-exit --stages -c --exclude @joystream/markdown-editor build",
"build:storybook": "wsrun --fast-exit --stages -c --exclude @joystream/pioneer --exclude-missing build && wsrun --package @joystream/pioneer -c build:storybook",
"lint": "wsrun -x @joystream/markdown-editor -c lint",
"lint:fix": "wsrun -x @joystream/markdown-editor -c lint:fix",
"build": "wsrun --fast-exit --package @joystream/pioneer -c build",
"build:storybook": "wsrun --fast-exit --stages -p @joystream/markdown-editor -c build && wsrun -p @joystream/pioneer -c build:storybook",
"storybook": "wsrun --exclude-missing -c storybook",
"test": "wsrun --fast-exit --package @joystream/pioneer -c test",
"test": "wsrun --fast-exit --exclude-missing -c test",
"test-storybook": "wsrun --package @joystream/pioneer -c test-storybook",
"start": "wsrun --package @joystream/pioneer -c start",
"prepare": "husky install"
},
"dependencies": {
"eslint-plugin-import": "^2.23.4",
"wsrun": "^5.2.4"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"husky": ">=6",
"lint-staged": ">=10"
},
Expand All @@ -52,11 +50,11 @@
"@joystream/[email protected]": "patch:@joystream/js@npm%3A1.2.0#./.yarn/patches/@joystream-js-npm-1.2.0-a8795e7496.patch"
},
"engines": {
"node": ">=14.18.0",
"node": ">=18",
"yarn": "^1.22.0"
},
"lint-staged": {
"packages/ui/src/**/*.{js,ts,tsx,html}": [
"packages/{ui,server}/src/**/*.{js,ts,tsx,html}": [
"eslint --fix",
"prettier --write"
]
Expand Down
Loading

1 comment on commit 1031792

@vercel
Copy link

@vercel vercel bot commented on 1031792 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dao – ./

dao-joystream.vercel.app
dao-git-main-joystream.vercel.app
pioneerapp.xyz
dao.joystream.org

Please sign in to comment.