Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/actions/install-node-modules-and-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Install Node Dependencies
description: Install dependencies using yarn
inputs:
typescript-version:
description: TS version to use
default: 'default'

runs:
using: composite
steps:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

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

- name: Sync yarn cache
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: Sync node_modules cache
id: sync-node-modules-cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ inputs.typescript-version }}-${{ hashFiles('./yarn.lock') }}

- name: Install node_modules
run: if [ '${{ steps.sync-node-modules-cache.outputs.cache-hit }}' != 'true' ]; then yarn install --immutable; fi
shell: bash

- name: Override TS with specified version
run: if [ '${{ inputs.typescript-version }}' != 'default' ] && [ '${{ steps.sync-node-modules-cache.outputs.cache-hit }}' != 'true' ]; then yarn add --dev typescript@${{ inputs.typescript-version }}; fi
shell: bash

- name: Sync packages cache
id: sync-packages-cache
uses: actions/cache@v3
with:
path: |
node_modules/@castore/**/dist
key: ts-${{ inputs.typescript-version }}-${{ hashFiles('./packages/**') }}-${{ hashFiles('./demo/**') }}

- name: Package
run: if [ '${{ steps.sync-packages-cache.outputs.cache-hit }}' != 'true' ]; then yarn package; fi
shell: bash
13 changes: 8 additions & 5 deletions .github/actions/lint-and-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
path:
required: true
description: Path to the directory to lint and test
typescript-version:
description: TS version to use
default: 'default'

runs:
using: composite
steps:
Expand All @@ -12,11 +16,10 @@ runs:
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install node_modules
uses: ./.github/actions/install-node-modules

- name: Package
uses: ./.github/actions/package
- name: Install node_modules & package
uses: ./.github/actions/install-node-modules-and-package
with:
typescript-version: ${{ inputs.typescript-version }}

- name: Run lint
run: |
Expand Down
39 changes: 30 additions & 9 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ jobs:
name: πŸ— Build Project
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
typescript-version:
['default', '~4.6.4', '~4.7.4', '~4.8.3', '~4.9.5', '~5.0.4']
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install node_modules & package
uses: ./.github/actions/install-node-modules-and-package
with:
typescript-version: ${{ matrix.typescript-version }}

get-affected-packages:
name: πŸ”Ž Get affected packages
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
affected-packages: ${{ steps.get-affected-packages-paths.outputs.affected-packages }}
steps:
Expand All @@ -30,11 +49,8 @@ jobs:
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
fetch-depth: 0

- name: Install node_modules
uses: ./.github/actions/install-node-modules

- name: Package
uses: ./.github/actions/package
- name: Install node_modules & package
uses: ./.github/actions/install-node-modules-and-package

- name: Get affected packages paths
id: get-affected-packages-paths
Expand All @@ -43,23 +59,27 @@ jobs:
base-branch: ${{ github.base_ref }}

library-lint-and-tests:
name: 🎯 Run Tests
needs: build
name: 🎯 Run tests
needs: [build, get-affected-packages]
runs-on: ubuntu-latest
if: join(fromJson(needs.build.outputs.affected-packages)) != ''
if: join(fromJson(needs.get-affected-packages.outputs.affected-packages)) != ''
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
AFFECTED_LIB: ${{ fromJson(needs.build.outputs.affected-packages) }}
AFFECTED_LIB: ${{ fromJson(needs.get-affected-packages.outputs.affected-packages) }}
typescript-version:
['default', '~4.6.4', '~4.7.4', '~4.8.3', '~4.9.5', '~5.0.4']
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Run tests
uses: ./.github/actions/lint-and-tests
with:
path: ${{ matrix.AFFECTED_LIB }}
typescript-version: ${{ matrix.typescript-version }}

validate-pr:
name: βœ… Validate the PR
Expand All @@ -73,6 +93,7 @@ jobs:
echo "build failed"
exit 1
fi

- name: Validate tests
run: |
if [[ ${{ needs.library-lint-and-tests.result }} = "failure" ]]; then
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ export type {
EventStoreNotificationMessage,
EventStoreStateCarryingMessage,
} from './messaging';

console.log('youhou');