Skip to content

Commit

Permalink
Rework the CI to include the backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thesan committed Jun 22, 2023
1 parent f13e9dc commit 1d992f5
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
65 changes: 60 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
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 +65,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 +150,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
2 changes: 0 additions & 2 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 Down

0 comments on commit 1d992f5

Please sign in to comment.