Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
heorhi-deriv committed Dec 10, 2024
1 parent f3a6c4a commit e6f9031
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 92 deletions.
12 changes: 11 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ inputs:
description: 'Node environment'
required: false
default: 'test'
STRICT_BUILD:
description: 'When true, runs `build:all` script without cache skipping for account, bot-web-ui and trader packages,
when false, runs `build:all-cache` script with cache skipping for all packages, except components package'
required: false
default: true
DATADOG_CLIENT_TOKEN:
description: 'Datadog client token'
required: false
Expand Down Expand Up @@ -77,5 +82,10 @@ runs:
REF_NAME: ${{ inputs.REF_NAME }}
REMOTE_CONFIG_URL: ${{ inputs.REMOTE_CONFIG_URL }}
TRUSTPILOT_API_KEY: ${{ inputs.TRUSTPILOT_API_KEY }}
run: npm run build:all
run: |
if [ "${{ inputs.STRICT_BUILD }}" = "true" ]; then
npm run build:all
else
npm run build:all-cache
fi
shell: bash
81 changes: 0 additions & 81 deletions .github/actions/build_affected/action.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
finish:
name: Coveralls Finished
needs: [test]
runs-on: Runner_16cores_Deriv-app
runs-on: Runner_8cores_Deriv-app
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,27 @@ jobs:
uses: "./.github/actions/setup_node"
- name: Check imports
run: npm run check-imports
- name: Install dependencies
- name: Restore npm cache
uses: actions/cache/restore@v4
id: cache-npm
with:
path: |
node_modules
packages/*/node_modules
key: node_modules-cache-${{ hashFiles('package-lock.json', 'packages/*/package.json') }}
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: Install dependencies
uses: "./.github/actions/npm_install_from_cache"
# - name: Invalidate NPM Cache
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# uses: "./.github/actions/invalidate_npm_cache"
- name: Cache Nx Build Cache
- name: Restore NX cache
uses: actions/cache/restore@v4
id: cache-nx
uses: actions/cache@v4
with:
path: .nx
key: nx-cache-${{ hashFiles('nx.json', 'package-lock.json', 'packages/*/package.json') }}
- name: Build
uses: "./.github/actions/build_affected"
uses: "./.github/actions/build"
with:
STRICT_BUILD: false
- name: Check TypeScript for @deriv/api
run: npx tsc --project packages/api/tsconfig.json -noEmit
- name: Check TypeScript for @deriv/api-v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_npm_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
build_cache:
name: Build cache
runs-on: Runner_16cores_Deriv-app
runs-on: Runner_8cores_Deriv-app
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/update_nx_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Update NX cache

on:
push:
branches:
- master

jobs:
build_cache:
name: Build cache
runs-on: Runner_8cores_Deriv-app
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Node
uses: './.github/actions/setup_node'
- name: Cache NX cache
id: cache-nx
uses: actions/cache@v4
with:
path: .nx
key: nx-cache-${{ hashFiles('nx.json', 'package-lock.json', 'packages/*/package.json') }}
- if: ${{ steps.cache-nx.outputs.cache-hit != 'true' }}
name: Install dependencies
uses: "./.github/actions/npm_install_from_cache"
- name: Build
uses: "./.github/actions/build"


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"analyze:build": "nx run-many --target=analyze:build",
"analyze:stats": "nx run-many --target=analyze:stats",
"build:all": "nx build @deriv/components --skip-nx-cache && nx build @deriv/account --skip-nx-cache && nx build @deriv/bot-web-ui --skip-nx-cache && nx build @deriv/trader --skip-nx-cache && nx run-many --target=build",
"build:nx_cache": "nx build @deriv/components --skip-nx-cache && nx run-many --target=build --parallel",
"build:all-cache": "nx build @deriv/components --skip-nx-cache && nx run-many --target=build --parallel",
"build:one": "f () { nx build @deriv/$1 $2 ;}; f",
"build:since": "nx affected --target=build",
"test:eslint-all": "nx run-many --target=test:eslint",
Expand Down

0 comments on commit e6f9031

Please sign in to comment.