Skip to content

Commit

Permalink
🔀 Merge dev into backend (#4449)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan authored Jun 22, 2023
2 parents 7cb9c68 + 1d992f5 commit 090e26e
Show file tree
Hide file tree
Showing 203 changed files with 14,838 additions and 8,425 deletions.
7 changes: 2 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@
]
],
"pathGroups": [
{
"pattern": "@/**",
"group": "external",
"position": "after"
}
{ "pattern": "@test/**", "position": "after", "group": "builtin" },
{ "pattern": "@/**", "position": "after", "group": "external" }
],
"pathGroupsExcludedImportTypes": [
"builtin"
Expand Down
187 changes: 172 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,165 @@
name: CI

on:
push:
branches:
- main
push: { branches: [dev, main] }
pull_request:

jobs:
test:
install:
timeout-minutes: 10
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}
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
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
run: yarn --immutable

- name: Verify formatting
run: yarn lint

ui-unit-tests:
needs: install
timeout-minutes: 60
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}
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 Pioneer
working-directory: packages/ui
run: yarn build

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

interaction-tests:
needs: install
timeout-minutes: 60
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}
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: Install Playwright
run: npx playwright install --with-deps

- name: Get the Storybook preview deployment url
run: |
if [ "$PREFIX" == 'git-fork' ]; then
BRANCH=$(echo -n '${{ env.LABEL }}' | sed 's/:/-/')
else
BRANCH=$(echo -n '${{ env.LABEL }}' | cut -d ':' -f2-)
fi
URL_BRANCH=$(echo -n "$BRANCH" | tr -d '#' | tr -c '[:alnum:]' '-' | tr '[:upper:]' '[:lower:]')
SUBDOMAIN="${{ env.PROJECT }}-${{ env.PREFIX }}-$URL_BRANCH-joystream"
if [ ${#SUBDOMAIN} -gt 63 ]; then
HASH=$(echo -n "${{ env.PREFIX }}-${BRANCH}${{ env.PROJECT }}" | sha256sum | head -c 6)
SUBDOMAIN="$(echo -n "$SUBDOMAIN" | head -c 46)-$HASH-joystream"
fi
echo "VERCEL_DEPLOYMENT_URL=$SUBDOMAIN.vercel.app" >> "$GITHUB_ENV"
env:
PROJECT: pioneer-2-storybook
PREFIX: ${{ github.event.pull_request.head.repo.fork && 'git-fork' || 'git' }}
LABEL: ${{ github.event.pull_request.head.label || github.ref_name }}

- name: Wait for the deployment to complete
run: |
while true; do
RES=$(curl -L 'https://api.vercel.com/v13/deployments/${{ env.VERCEL_DEPLOYMENT_URL }}')
STATUS=$(echo -n "$RES" | jq -r '.status')
SHA=$(echo -n "$RES" | jq -r '.meta.githubCommitSha')
if [ "$SHA" == 'null' ] || [ "$STATUS" == 'null' ]; then
echo -e "\nError the JSON response is missing expected fields:\n\n$RES\n" >&2
exit 5
fi
if [ "$SHA" == '${{ env.COMMIT_SHA }}' ] && [ "$STATUS" == 'READY' ]; then
exit 0
fi
echo -e '\nWait for the Storybook deployment...\n\n'
sleep 20
done
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Run Storybook tests
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: ["14.x"]
os: [ubuntu-latest]
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}

services:
Expand All @@ -28,25 +175,35 @@ jobs:
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

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

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

- name: Verify formatting
run: yarn lint
- 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
run: yarn ci-build
working-directory: packages/server
run: yarn build
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres

- name: Run tests
run: yarn ci-test --silent
working-directory: packages/server
run: yarn test --silent
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
37 changes: 0 additions & 37 deletions .github/workflows/gh-pages.yml

This file was deleted.

22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.4.0 Ephesus][1.4.0] - 2023-04-12
## [1.5.0] - 2023-06-06

### Added
- Support for wallet metadata update.
- Emoji selection in the text editor.
- Visual representation of membership verified status.
- Link in the side bar to the Calamar explorer.

### Fixed
- Forum false 404 and empty categories during query node outage.
- Text visibility in the forum.
- Way too large margins on forum threads.
- Initial deciding stage view of multiple voting rounds proposal.
- Fix Apps working group's opening links with ids from the query node.

## [1.4.0 (Ephesus)][1.4.0] - 2023-04-12

### Added
- Update Channel Payouts Proposal.
Expand Down Expand Up @@ -113,7 +128,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Proposal view crashing due to high amounts of JOY

## [1.0.0 Mainnet][1.0.0] - 2022-12-16
## [1.0.0 (Mainnet)][1.0.0] - 2022-12-16

### Added
- Mainnet network in the setting.
Expand Down Expand Up @@ -146,7 +161,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.4.0...HEAD
[unreleased]: https://github.com/Joystream/pioneer/compare/v1.5.0...HEAD
[1.5.0]: https://github.com/Joystream/pioneer/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/Joystream/pioneer/compare/v1.3.2...v1.4.0
[1.3.2]: https://github.com/Joystream/pioneer/compare/v1.3.1...v1.3.2
[1.3.1]: https://github.com/Joystream/pioneer/compare/v1.3.0...v1.3.1
Expand Down
9 changes: 4 additions & 5 deletions docs/mocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,26 @@ To test most of the extrinsics requires existing on-chain data. To create some o

Available commands:

- `yarn workspace @joystream/pioneer node-mocks council:elect [-d BLOCK_TIMEÂą] [--to ELECTION_STAGE]` - Run an election until the specified stage: VOTE, REVEAL, or IDLE (default)
- `yarn workspace @joystream/pioneer node-mocks council:announce` - Announce enough candidacies to start the voting stage when the announcing stage ends
- `yarn workspace @joystream/pioneer node-mocks council:vote` - Vote for the announced by the previous command candidate to start the revealing stage next
- `yarn workspace @joystream/pioneer node-mocks council:reveal` - Reveal the votes casted by the previous command to start elect a new council and start the idle stage next
- `yarn workspace @joystream/pioneer node-mocks members:create` - generate memberships using query-node mocks data
- `yarn workspace @joystream/pioneer node-mocks set-budget` - Set membership Working Group budget
- `yarn workspace @joystream/pioneer node-mocks opening:create` - Create an opening
- `yarn workspace @joystream/pioneer node-mocks opening:create [-d BLOCK_TIMEÂą]` - Create an opening
- `yarn workspace @joystream/pioneer node-mocks opening:fill` - Fill existing opening
- `yarn workspace @joystream/pioneer node-mocks upcoming-opening:create` - Create an upcoming opening
- `yarn workspace @joystream/pioneer node-mocks forumCategory:create` - Create a forum category
- `yarn workspace @joystream/pioneer node-mocks transfer` - Transfer tokens between accounts

**(Âą)** `BLOCK_TIME` is the time between each block. It is 6000ms by default but on testing chain it is 1000ms. Therefore when running some of the scripts on these testing chain `-d 1000` should be added for the command to succeed.

To show help:

```shell
yarn node-mocks --help
```

Shortcuts:
- `yarn workspace @joystream/pioneer node-mocks:announce-vote` - Announce candidacies, wait, then vote on them
- `yarn workspace @joystream/pioneer node-mocks:announce-vote-reveal` - Announce candidacies, wait, vote on them, wait, then reveal these votes

#### Chain spec

Another way to influence the on-chain state for testing purpose, is to provide a customize `chain-spec.json` file when running a Joystream node:
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
"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 --exclude-missing -c test",
"ci-build": "wsrun --fast-exit -x @joystream/markdown-editor -c build",
"ci-test": "NODE_OPTIONS=--max_old_space_size=7000 wsrun --fast-exit ---exclude-missing -c test",
"start": "wsrun --package @joystream/pioneer -c start",
"prepare": "husky install"
},
Expand All @@ -32,6 +30,12 @@
"lint-staged": ">=10"
},
"resolutions": {
"@babel/core": "~7.21.0",
"@babel/preset-env": "~7.21.0",
"@babel/generator": "~7.21.0",
"@babel/parser": "~7.21.0",
"@babel/traverse": "~7.21.0",
"@babel/types": "~7.21.0",
"@polkadot/api": "8.9.1",
"@polkadot/api-contract": "8.9.1",
"@polkadot/api-derive": "8.9.1",
Expand All @@ -45,8 +49,7 @@
"@polkadot/util": "9.5.1",
"@polkadot/util-crypto": "9.5.1",
"bn.js": "^4.11.9",
"@joystream/js@1.2.0": "patch:@joystream/js@npm%3A1.2.0#./.yarn/patches/@joystream-js-npm-1.2.0-a8795e7496.patch",
"@joystream/types": "./packages/joystream-types-v0.20.6.tgz"
"@joystream/js@1.2.0": "patch:@joystream/js@npm%3A1.2.0#./.yarn/patches/@joystream-js-npm-1.2.0-a8795e7496.patch"
},
"engines": {
"node": ">=14.18.0",
Expand Down
Binary file removed packages/joystream-types-v0.20.6.tgz
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/markdown-editor/dist/ckeditor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/markdown-editor/dist/ckeditor.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/markdown-editor/dist/translations/ar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 090e26e

Please sign in to comment.