maxGraph/.github/workflows/build.yml

76 lines
2.1 KiB
YAML
Raw Normal View History

name: Build
on:
push:
branches:
- development
paths:
- '.github/workflows/build.yml'
2023-11-16 13:39:08 +00:00
- '.nvmrc'
- 'packages/**/*'
- '!packages/**/*.md'
- '!packages/docs/*'
- 'scripts/**/*'
- 'babel.config.js'
- 'package.json'
- 'webpack.config.js'
pull_request:
branches:
- development
paths:
- '.github/workflows/build.yml'
- 'packages/**/*'
- '!packages/**/*.md'
- '!packages/docs/*'
- 'scripts/**/*'
- 'babel.config.js'
- 'package.json'
- 'webpack.config.js'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# we want to run the full build on all os: don't cancel running jobs even if one fails
fail-fast: false
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
chore: improve the configuration to build the npm package (#87) Root and all package.json files - Fix license, version and authors - Remove the non-relevant .npmignore file at the project. It was designed for mxgraph, the whole directory structure changed, and we don't plan to publish the root package `core` package - Generate type definition and javascript files for ESM output - dedicated folder for `esm` and `types` in the `dist` folder to clearly separate concerns - exported in the package.json - Add npm script for `npm pack` configuration - Drop the `postinstall` npm script that built the `core` bundle. It would have been run when the package is installed in dependent projects at dependencies install. And it would have failed as it tries to build the project from TypeScript sources that are not available in the npm package. fix: ConstraintHandler now loads image as everywhere else in the code using `Client.imageBasePath` Using import doesn't work as the image is not available in the npm package. It generated error like this in ViteJS project: Failed to resolve import "../../../images/point.gif" from "../core/dist/esm/view/handler/ConstraintHandler.js". Does the file exist? This gif import had been introduced to make `Anchors.stories.js` retrieve the gif file. Configuring `imageBasePath` as already done in other stories fixes the issue. Don't export EditorCodec and StylesheetCodec as they generate errors. This is a temporary solution to avoid error in dependent project (at least, with ViteJS projects).
2022-07-05 06:08:25 +00:00
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm install
chore: improve the configuration to build the npm package (#87) Root and all package.json files - Fix license, version and authors - Remove the non-relevant .npmignore file at the project. It was designed for mxgraph, the whole directory structure changed, and we don't plan to publish the root package `core` package - Generate type definition and javascript files for ESM output - dedicated folder for `esm` and `types` in the `dist` folder to clearly separate concerns - exported in the package.json - Add npm script for `npm pack` configuration - Drop the `postinstall` npm script that built the `core` bundle. It would have been run when the package is installed in dependent projects at dependencies install. And it would have failed as it tries to build the project from TypeScript sources that are not available in the npm package. fix: ConstraintHandler now loads image as everywhere else in the code using `Client.imageBasePath` Using import doesn't work as the image is not available in the npm package. It generated error like this in ViteJS project: Failed to resolve import "../../../images/point.gif" from "../core/dist/esm/view/handler/ConstraintHandler.js". Does the file exist? This gif import had been introduced to make `Anchors.stories.js` retrieve the gif file. Configuring `imageBasePath` as already done in other stories fixes the issue. Don't export EditorCodec and StylesheetCodec as they generate errors. This is a temporary solution to avoid error in dependent project (at least, with ViteJS projects).
2022-07-05 06:08:25 +00:00
- name: Build @maxgraph/core - umd
working-directory: packages/core
run: npm run build
- name: Build @maxgraph/core - esm
working-directory: packages/core
run: npm run generate-esm
- name: Generate @maxgraph/core types
working-directory: packages/core
run: npm run generate-types
- name: Test @maxgraph/core
working-directory: packages/core
run: npm test
- name: Test TypeScript support
working-directory: packages/ts-support
run: npm test
chore: improve the configuration to build the npm package (#87) Root and all package.json files - Fix license, version and authors - Remove the non-relevant .npmignore file at the project. It was designed for mxgraph, the whole directory structure changed, and we don't plan to publish the root package `core` package - Generate type definition and javascript files for ESM output - dedicated folder for `esm` and `types` in the `dist` folder to clearly separate concerns - exported in the package.json - Add npm script for `npm pack` configuration - Drop the `postinstall` npm script that built the `core` bundle. It would have been run when the package is installed in dependent projects at dependencies install. And it would have failed as it tries to build the project from TypeScript sources that are not available in the npm package. fix: ConstraintHandler now loads image as everywhere else in the code using `Client.imageBasePath` Using import doesn't work as the image is not available in the npm package. It generated error like this in ViteJS project: Failed to resolve import "../../../images/point.gif" from "../core/dist/esm/view/handler/ConstraintHandler.js". Does the file exist? This gif import had been introduced to make `Anchors.stories.js` retrieve the gif file. Configuring `imageBasePath` as already done in other stories fixes the issue. Don't export EditorCodec and StylesheetCodec as they generate errors. This is a temporary solution to avoid error in dependent project (at least, with ViteJS projects).
2022-07-05 06:08:25 +00:00
- name: Build ts-example
working-directory: packages/ts-example
run: npm run build
- name: Build Storybook mini-site
working-directory: packages/html
run: npm run build
- name: Upload all examples as artifact
uses: actions/upload-artifact@v3
with:
name: bundles-test-results-${{github.sha}}
path: |
packages/html/dist/
packages/ts-example/dist/
- name: Ensure no lint errors
run: npm run lint