Skip to content

Commit

Permalink
Fix duplicated source code in built libraries (#324)
Browse files Browse the repository at this point in the history
* Removed duplicate source by moving bundling to only occur in /implementations
* Fix failing tests in /Extras/FrontendTests
* Fix streamer and codec selection options generation
* Restore partial matching of codec specified in a url parameter
* Allow specifying codec in initial settings and matching that to closest available
* Fixing package.json to make the npm run scripts work in react/typescript
* Removed npm link hacks for the repo by using NPM workspaces
* Remove weback from all packages except final bundles
* Update docs about how libraries are built
* Added new GHA to test building packages using only published libraries to mimic user experience
* Fix stresstest to remove NodeJS
* Remove package-lock.json from each workspace as NPM workspace stores a single lock in the repo root
* Add info about NPM workspaces to the readme.md
  • Loading branch information
lukehb authored Nov 22, 2024
1 parent 8c79e84 commit a7e4a3e
Show file tree
Hide file tree
Showing 80 changed files with 21,411 additions and 52,527 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/create-gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ jobs:

- name: Build common library
working-directory: ./Common
run: npm ci && npm run build
run: npm install && npm run build

- name: Build frontend library
working-directory: ./Frontend/library
run: npm ci && npm link ../../Common && npm run build
run: npm install && npm run build

- name: Build frontend ui-library
working-directory: ./Frontend/ui-library
run: npm ci && npm link ../library && npm run build
run: npm install && npm run build

- name: Install implementations/typescript deps
working-directory: ./Frontend/implementations/typescript
run: npm ci && npm link ../../library ../../ui-library && npm run build
run: npm install && npm run build

- name: Move all content into output directory for archiving
run: items=(*) && mkdir PixelStreamingInfrastructure-${{ github.ref_name }}-${{ steps.getversion.outputs.version }} && mv ${items[*]} PixelStreamingInfrastructure-${{ github.ref_name }}-${{ steps.getversion.outputs.version }}/
Expand Down
113 changes: 104 additions & 9 deletions .github/workflows/healthcheck-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:
NODE_VERSION: 18.17.x

jobs:
build:
build-using-local-deps:
if: github.repository == 'EpicGamesExt/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
Expand All @@ -34,28 +34,123 @@ jobs:
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'

- name: Clean build and lint checks on common library
working-directory: Common
run: npm ci && npm run build && npm run lint
run: npm install && npm run build && npm run lint

- name: Clean build and lint checks on signalling library
working-directory: Signalling
run: npm ci && npm link ../Common && npm run build && npm run lint
run: npm install && npm run build && npm run lint

- name: Clean build and lint checks on wilbur
working-directory: SignallingWebServer
run: npm ci && npm link ../Signalling && npm run build && npm run lint
run: npm install && npm run build && npm run lint

- name: Clean build, lint and unit tests on frontend library
working-directory: Frontend/library
run: npm ci && npm link ../../Common && npm run build && npm run lint && npm run test
run: npm install && npm run build && npm run lint && npm run test

- name: Clean build and lint checks on frontend ui library
working-directory: Frontend/ui-library
run: npm ci && npm link ../library && npm run build && npm run lint
run: npm install && npm run build && npm run lint

- name: Clean build of frontend implementation
working-directory: Frontend/implementations/typescript
run: npm ci && npm link ../../library ../../ui-library && npm run build
run: npm install && npm run build

build-signalling-only:
if: github.repository == 'EpicGamesExt/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
sparse-checkout: 'Signalling'
sparse-checkout-cone-mode: false

- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'

- name: Build signalling using published packages only
working-directory: Signalling
run: npm install && npm run build && npm run lint

build-wilbur-only:
if: github.repository == 'EpicGamesExt/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
sparse-checkout: 'SignallingWebServer'
sparse-checkout-cone-mode: false

- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'

- name: Build Wilbur using published packages only
working-directory: SignallingWebServer
run: npm install && npm run build && npm run lint

build-frontend-only:
if: github.repository == 'EpicGamesExt/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
sparse-checkout: 'Frontend/library'
sparse-checkout-cone-mode: false

- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'

- name: Build Frontend/library using published packages only
working-directory: Frontend/library
run: npm install && npm run build && npm run lint && npm run test

build-frontend-ui-only:
if: github.repository == 'EpicGamesExt/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
sparse-checkout: 'Frontend/ui-library'
sparse-checkout-cone-mode: false

- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'

- name: Build Frontend/ui-library using published packages only
working-directory: Frontend/ui-library
run: npm install && npm run build && npm run lint

build-implementation-typescript-only:
if: github.repository == 'EpicGamesExt/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
sparse-checkout: 'Frontend/implementations/typescript'
sparse-checkout-cone-mode: false

- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'

- name: Build Frontend/implementations/typescript using published packages only
working-directory: Frontend/implementations/typescript
run: npm install && npm run build

19 changes: 7 additions & 12 deletions .github/workflows/healthcheck-streaming.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,38 @@ jobs:
- name: Build Common
working-directory: Common
run: |
npm ci
npm install
npm run build
- name: Build Signalling
working-directory: Signalling
run: |
npm ci
npm link ../Common
npm install
npm run build
- name: Build Wilbur
working-directory: SignallingWebServer
run: |
npm ci
npm link ../Signalling
npm install
npm run build
- name: Build Frontend lib
working-directory: Frontend/library
run: |
npm ci
npm link ../../Common
npm install
npm run build
- name: Build Frontend ui lib
working-directory: Frontend/ui-library
run: |
npm ci
npm link ../library
npm install
npm run build
- name: Build Frontend implementation
working-directory: Frontend/implementations/typescript
run: |
$Env:WEBPACK_OUTPUT_PATH='${{ github.workspace }}\www'
npm ci
npm link ../../library ../../ui-library
npm install
npm run build
- name: Run Signalling
Expand All @@ -118,7 +113,7 @@ jobs:
- name: Prepare test
working-directory: Extras\MinimalStreamTester
run: |
npm i
npm install
npx playwright install --with-deps
npx playwright install chrome
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-common-library-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ jobs:
working-directory: Common
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: 'Common'
sparse-checkout-cone-mode: false
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm install
- run: npm run build
- run: npm publish --access public
env:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-library-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ jobs:
working-directory: Frontend/library
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: 'Frontend/library'
sparse-checkout-cone-mode: false
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm install
- run: npm run build
- run: npm publish --access public
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-sfu-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
sparse-checkout: 'SFU'
sparse-checkout-cone-mode: false

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/publish-signalling-library-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ jobs:
working-directory: Signalling
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: 'Signalling'
sparse-checkout-cone-mode: false
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'
- working-directory: Common
run: npm ci && npm run build
- run: npm ci && npm link ../Common && npm run build
- run: npm install && npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 4 additions & 1 deletion .github/workflows/publish-ui-library-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ jobs:
working-directory: Frontend/ui-library
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: 'Frontend/ui-library'
sparse-checkout-cone-mode: false
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm install
- run: npm run build
- run: npm publish --access public
env:
Expand Down
10 changes: 10 additions & 0 deletions Common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,15 @@ For examples of how to implement this library.
- See [lib-pixelstreamingsignalling](/Signalling)
- Also see [Wilbur](/SignallingWebServer) which uses the signalling library to implement a full signalling server.

### Adding it to your project
`npm i @epicgames-ps/lib-pixelstreamingcommon-ue5.5`

## Documentation
The API is documented [here](docs).

### How this library is built
The NPM packages supports:
- ES6 module usage
- CommonJS usage
- Type definitions
- Source maps
Loading

0 comments on commit a7e4a3e

Please sign in to comment.