Docker
- Update three in static file
This commit is contained in:
76
docker-compose/requirements/nginx/static/three/.github/CODE_OF_CONDUCT.md
vendored
Normal file
76
docker-compose/requirements/nginx/static/three/.github/CODE_OF_CONDUCT.md
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at hello@mrdoob.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
79
docker-compose/requirements/nginx/static/three/.github/CONTRIBUTING.md
vendored
Normal file
79
docker-compose/requirements/nginx/static/three/.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
# Contribution
|
||||
## Introduction
|
||||
|
||||
It is assumed that you know a little about Node.js and Git. If not, [here's some help to get started with Git](https://help.github.com/en/github/using-git) and [here’s some help to get started with Node.js.](https://nodejs.org/en/docs/guides/getting-started-guide/)
|
||||
|
||||
* Install [Node.js](https://nodejs.org/)
|
||||
* Install [Git](https://git-scm.com/)
|
||||
* [Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) three.js
|
||||
* Open your OS’s terminal
|
||||
* Change into the directory you’d like
|
||||
* Clone your forked repo
|
||||
|
||||
git clone https://github.com/[yourgithubname]/three.js.git
|
||||
|
||||
* Go into the three.js directory.
|
||||
|
||||
cd ./three.js
|
||||
|
||||
* Install the dependencies
|
||||
|
||||
npm install
|
||||
|
||||
## Next Steps
|
||||
|
||||
As per the npm standard, ‘start’ is the place to begin the package.
|
||||
|
||||
npm start
|
||||
|
||||
This script will start a local server similar to [threejs.org](https://threejs.org/), but instead will be hosted on your local machine. Browse to https://localhost:8080/ to check it out. It also automatically creates the `build/three.module.js` script anytime there is a change `src` directory.
|
||||
|
||||
Next scripts run all the appropriate testing.
|
||||
|
||||
- `npm run test` - Lint testing and unit testing (individually being `npm run lint` and `npm run test-unit`)
|
||||
- `npm run test-e2e` - E2E testing. This one can take quite a long time and installs ~200 MB Chromium browser - it is primarily intended to be run only by GitHub Actions
|
||||
|
||||
The linting is there to keep a consistent code style across all of the code and the testing is there to help catch bugs and check that the code behaves as expected. It is important that neither of these steps comes up with any errors due to your changes.
|
||||
|
||||
Most linting errors can be fixed automatically by running
|
||||
|
||||
npm run lint-fix
|
||||
|
||||
If you’d like to make a build of the source files (e.g. `build/three.module.js`) run:
|
||||
|
||||
npm run build
|
||||
|
||||
## Making changes
|
||||
|
||||
When you’ve decided to make changes, start with the following:
|
||||
|
||||
* Update your local repo
|
||||
|
||||
git pull https://github.com/mrdoob/three.js.git
|
||||
git push
|
||||
|
||||
* Make a new branch from the dev branch
|
||||
|
||||
git checkout dev
|
||||
git branch [mychangesbranch]
|
||||
git checkout [mychangesbranch]
|
||||
|
||||
* Add your changes to your commit.
|
||||
* Push the changes to your forked repo.
|
||||
* Open a Pull Request (PR)
|
||||
|
||||
## Important notes:
|
||||
|
||||
* Don't include any build files in your commit.
|
||||
* Not all new features will need a new example. Simpler features could be incorporated into an existing example. Bigger features may be asked to add an example demonstrating the feature.
|
||||
* Making changes may require changes to the documentation. To update the docs in other languages, simply copy the English to begin with.
|
||||
* It's good to also add an example and screenshot for it, for showing how it's used and for end-to-end testing.
|
||||
* If you modify existing code, run relevant examples to check they didn't break and there wasn't performance regress.
|
||||
* If you add some assets for the examples (models, textures, sounds, etc), make sure they have a proper license allowing for their use here, less restrictive the better. It is unlikely for large assets to be accepted.
|
||||
* If some issue is relevant to the patch/feature, please mention it with a hash (e.g. #2774) in a commit message to get cross-reference in GitHub.
|
||||
* If the end-to-end test failed and you are sure that all is correct, follow the instructions it outputs.
|
||||
* Once done with a patch/feature do not add more commits to a feature branch.
|
||||
* Create separate branches per patch or feature.
|
||||
* If you make a PR but it is not actually ready to be pulled into the dev branch then please [convert it to a draft PR](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft).
|
||||
|
||||
This project is currently contributed mostly via everyone's spare time. Please keep that in mind as it may take some time for the appropriate feedback to get to you. If you are unsure about adding a new feature, it might be better to ask first to see whether other people think it's a good idea.
|
3
docker-compose/requirements/nginx/static/three/.github/FUNDING.yml
vendored
Normal file
3
docker-compose/requirements/nginx/static/three/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [mrdoob, HumanInteractive, donmccurdy, gkjohnson, WestLangley]
|
86
docker-compose/requirements/nginx/static/three/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
86
docker-compose/requirements/nginx/static/three/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
name: Bug Report
|
||||
description: File a reproducible bug or regression.
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: repro
|
||||
attributes:
|
||||
label: Reproduction steps
|
||||
description: How do you trigger this bug? Please walk us through it step by step.
|
||||
value: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: code
|
||||
attributes:
|
||||
label: Code
|
||||
value: |
|
||||
```js
|
||||
// code goes here
|
||||
```
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: example
|
||||
attributes:
|
||||
label: Live example
|
||||
value: |
|
||||
* [jsfiddle-latest-release](https://jsfiddle.net/g3atw6k5/)
|
||||
* [jsfiddle-dev](https://jsfiddle.net/hjqw94c5/)
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: If applicable, add screenshots to help explain your problem (drag and drop the image).
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: What version of the library are you using?
|
||||
placeholder: r
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: device
|
||||
attributes:
|
||||
label: Device
|
||||
multiple: true
|
||||
options:
|
||||
- Desktop
|
||||
- Mobile
|
||||
- Headset
|
||||
- type: dropdown
|
||||
id: browser
|
||||
attributes:
|
||||
label: Browser
|
||||
multiple: true
|
||||
options:
|
||||
- Chrome
|
||||
- Firefox
|
||||
- Safari
|
||||
- Edge
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: OS
|
||||
multiple: true
|
||||
options:
|
||||
- Windows
|
||||
- MacOS
|
||||
- Linux
|
||||
- ChromeOS
|
||||
- Android
|
||||
- iOS
|
5
docker-compose/requirements/nginx/static/three/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
docker-compose/requirements/nginx/static/three/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Help and Support
|
||||
url: https://discourse.threejs.org/
|
||||
about: Please use the forum if you have questions or need help.
|
34
docker-compose/requirements/nginx/static/three/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
34
docker-compose/requirements/nginx/static/three/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for the project.
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Is your feature request related to a problem? Please describe.
|
||||
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Solution
|
||||
description: Describe the solution you'd like.
|
||||
placeholder: A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives
|
||||
description: Describe alternatives you've considered.
|
||||
placeholder: A clear and concise description of any alternative solutions or features you've considered.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context about the feature request here.
|
||||
validations:
|
||||
required: false
|
7
docker-compose/requirements/nginx/static/three/.github/codeql-config.yml
vendored
Normal file
7
docker-compose/requirements/nginx/static/three/.github/codeql-config.yml
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
paths-ignore:
|
||||
- "docs/prettify/**/*.*"
|
||||
- "editor/js/libs/**/*.*"
|
||||
- "examples/jsm/libs/**/*.*"
|
||||
- "examples/jsm/loaders/ifc/**/*.*"
|
||||
- "build/*.*"
|
||||
- "manual/3rdparty/**/*.*"
|
9
docker-compose/requirements/nginx/static/three/.github/pull_request_template.md
vendored
Normal file
9
docker-compose/requirements/nginx/static/three/.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
Related issue: #XXXX
|
||||
|
||||
**Description**
|
||||
|
||||
A clear and concise description of what the problem was and how this pull request solves it.
|
||||
|
||||
<!-- Remove the line below if is not relevant -->
|
||||
|
||||
*This contribution is funded by [Example](https://example.com)*
|
23
docker-compose/requirements/nginx/static/three/.github/renovate.json
vendored
Normal file
23
docker-compose/requirements/nginx/static/three/.github/renovate.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base",
|
||||
":disableDependencyDashboard",
|
||||
"helpers:pinGitHubActionDigests"
|
||||
],
|
||||
"timezone": "Asia/Tokyo",
|
||||
"schedule": ["after 1am and before 7am every monday"],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchDepTypes": ["devDependencies"],
|
||||
"matchUpdateTypes": ["patch", "minor", "pin", "digest"],
|
||||
"groupName": "devDependencies (non-major)",
|
||||
"automerge": true
|
||||
},
|
||||
{
|
||||
"description": "ESLint v9 requires flat configs, not yet supported by our plugins. See https://github.com/mrdoob/three.js/pull/28354#issuecomment-2106528332",
|
||||
"matchPackageNames": ["eslint"],
|
||||
"matchUpdateTypes": ["major"],
|
||||
"enabled": false
|
||||
}
|
||||
]
|
||||
}
|
114
docker-compose/requirements/nginx/static/three/.github/workflows/ci.yml
vendored
Normal file
114
docker-compose/requirements/nginx/static/three/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'build/**'
|
||||
- 'docs/**'
|
||||
- 'files/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint testing
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: === Lint testing ===
|
||||
run: npm run lint
|
||||
|
||||
unit:
|
||||
name: Unit testing
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: === Unit testing ===
|
||||
run: npm run test-unit
|
||||
|
||||
circular:
|
||||
name: Circular dependencies testing
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: === Circular dependencies testing ===
|
||||
run: npm run test-circular-deps
|
||||
|
||||
e2e:
|
||||
name: E2E testing
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ windows-latest ]
|
||||
CI: [ 0, 1, 2, 3 ]
|
||||
env:
|
||||
CI: ${{ matrix.CI }}
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build
|
||||
run: npm run build-module
|
||||
|
||||
- name: === E2E testing ===
|
||||
run: npm run test-e2e
|
||||
- name: Upload output screenshots
|
||||
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
|
||||
if: always()
|
||||
with:
|
||||
name: Output screenshots-${{ matrix.os }}-${{ matrix.CI }}
|
||||
path: test/e2e/output-screenshots
|
||||
if-no-files-found: ignore
|
||||
|
||||
e2e-cov:
|
||||
name: Examples ready for release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: === Examples ready for release ===
|
||||
run: npm run test-e2e-cov
|
45
docker-compose/requirements/nginx/static/three/.github/workflows/codeql-code-scanning.yml
vendored
Normal file
45
docker-compose/requirements/nginx/static/three/.github/workflows/codeql-code-scanning.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev" ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "dev" ]
|
||||
schedule:
|
||||
- cron: '29 23 * * 0'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@2d790406f505036ef40ecba973cc774a50395aac # v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
config-file: ./.github/codeql-config.yml
|
||||
queries: security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@2d790406f505036ef40ecba973cc774a50395aac # v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@2d790406f505036ef40ecba973cc774a50395aac # v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
52
docker-compose/requirements/nginx/static/three/.github/workflows/read-size.yml
vendored
Normal file
52
docker-compose/requirements/nginx/static/three/.github/workflows/read-size.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
name: Read size
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'package.json'
|
||||
- 'utils/build/**'
|
||||
|
||||
# This workflow runs in a read-only environment. We can safely checkout
|
||||
# the PR code here.
|
||||
# Reference:
|
||||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
read-size:
|
||||
name: Tree-shaking
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: === Test tree-shaking ===
|
||||
run: npm run test-treeshake
|
||||
- name: Read bundle sizes
|
||||
id: read-size
|
||||
run: |
|
||||
FILESIZE=$(stat --format=%s build/three.module.min.js)
|
||||
gzip -k build/three.module.min.js
|
||||
FILESIZE_GZIP=$(stat --format=%s build/three.module.min.js.gz)
|
||||
TREESHAKEN=$(stat --format=%s test/treeshake/index.bundle.min.js)
|
||||
gzip -k test/treeshake/index.bundle.min.js
|
||||
TREESHAKEN_GZIP=$(stat --format=%s test/treeshake/index.bundle.min.js.gz)
|
||||
PR=${{ github.event.pull_request.number }}
|
||||
|
||||
# write the output in a json file to upload it as artifact
|
||||
node -pe "JSON.stringify({ filesize: $FILESIZE, gzip: $FILESIZE_GZIP, treeshaken: $TREESHAKEN, treeshakenGzip: $TREESHAKEN_GZIP, pr: $PR })" > sizes.json
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
|
||||
with:
|
||||
name: sizes
|
||||
path: sizes.json
|
156
docker-compose/requirements/nginx/static/three/.github/workflows/report-size.yml
vendored
Normal file
156
docker-compose/requirements/nginx/static/three/.github/workflows/report-size.yml
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
name: Report size
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Read size"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
# This workflow needs to be run with "pull-requests: write" permissions to
|
||||
# be able to comment on the pull request. We can't checkout the PR code
|
||||
# in this workflow.
|
||||
# Reference:
|
||||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
report-size:
|
||||
name: Comment on PR
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'success'
|
||||
steps:
|
||||
- name: Log GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "$GITHUB_CONTEXT"
|
||||
|
||||
# Using actions/download-artifact doesn't work here
|
||||
# https://github.com/actions/download-artifact/issues/60
|
||||
- name: Download artifact
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
|
||||
id: download-artifact
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const fs = require('fs/promises');
|
||||
|
||||
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.payload.workflow_run.id,
|
||||
});
|
||||
const matchArtifact = artifacts.data.artifacts.find((artifact) => artifact.name === 'sizes');
|
||||
const download = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
|
||||
await fs.writeFile('sizes.zip', Buffer.from(download.data));
|
||||
await exec.exec('unzip sizes.zip');
|
||||
const json = await fs.readFile('sizes.json', 'utf8');
|
||||
return json;
|
||||
|
||||
# This runs on the base branch of the PR, meaning "dev"
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: === Test tree-shaking ===
|
||||
run: npm run test-treeshake
|
||||
- name: Read sizes
|
||||
id: read-size
|
||||
run: |
|
||||
FILESIZE_BASE=$(stat --format=%s build/three.module.min.js)
|
||||
gzip -k build/three.module.min.js
|
||||
FILESIZE_BASE_GZIP=$(stat --format=%s build/three.module.min.js.gz)
|
||||
TREESHAKEN_BASE=$(stat --format=%s test/treeshake/index.bundle.min.js)
|
||||
gzip -k test/treeshake/index.bundle.min.js
|
||||
TREESHAKEN_BASE_GZIP=$(stat --format=%s test/treeshake/index.bundle.min.js.gz)
|
||||
|
||||
# log to console
|
||||
echo "FILESIZE_BASE=$FILESIZE_BASE"
|
||||
echo "FILESIZE_BASE_GZIP=$FILESIZE_BASE_GZIP"
|
||||
echo "TREESHAKEN_BASE=$TREESHAKEN_BASE"
|
||||
echo "TREESHAKEN_BASE_GZIP=$TREESHAKEN_BASE_GZIP"
|
||||
|
||||
echo "FILESIZE_BASE=$FILESIZE_BASE" >> $GITHUB_OUTPUT
|
||||
echo "FILESIZE_BASE_GZIP=$FILESIZE_BASE_GZIP" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN_BASE=$TREESHAKEN_BASE" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN_BASE_GZIP=$TREESHAKEN_BASE_GZIP" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Format sizes
|
||||
id: format
|
||||
# It's important these are passed as env variables.
|
||||
# https://securitylab.github.com/research/github-actions-untrusted-input/
|
||||
env:
|
||||
FILESIZE: ${{ fromJSON(steps.download-artifact.outputs.result).filesize }}
|
||||
FILESIZE_GZIP: ${{ fromJSON(steps.download-artifact.outputs.result).gzip }}
|
||||
FILESIZE_BASE: ${{ steps.read-size.outputs.FILESIZE_BASE }}
|
||||
FILESIZE_BASE_GZIP: ${{ steps.read-size.outputs.FILESIZE_BASE_GZIP }}
|
||||
TREESHAKEN: ${{ fromJSON(steps.download-artifact.outputs.result).treeshaken }}
|
||||
TREESHAKEN_GZIP: ${{ fromJSON(steps.download-artifact.outputs.result).treeshakenGzip }}
|
||||
TREESHAKEN_BASE: ${{ steps.read-size.outputs.TREESHAKEN_BASE }}
|
||||
TREESHAKEN_BASE_GZIP: ${{ steps.read-size.outputs.TREESHAKEN_BASE_GZIP }}
|
||||
run: |
|
||||
FILESIZE_FORM=$(node ./test/treeshake/utils/format-size.js "$FILESIZE")
|
||||
FILESIZE_GZIP_FORM=$(node ./test/treeshake/utils/format-size.js "$FILESIZE_GZIP")
|
||||
FILESIZE_BASE_FORM=$(node ./test/treeshake/utils/format-size.js "$FILESIZE_BASE")
|
||||
FILESIZE_BASE_GZIP_FORM=$(node ./test/treeshake/utils/format-size.js "$FILESIZE_BASE_GZIP")
|
||||
FILESIZE_DIFF=$(node ./test/treeshake/utils/format-diff.js "$FILESIZE" "$FILESIZE_BASE")
|
||||
TREESHAKEN_FORM=$(node ./test/treeshake/utils/format-size.js "$TREESHAKEN")
|
||||
TREESHAKEN_GZIP_FORM=$(node ./test/treeshake/utils/format-size.js "$TREESHAKEN_GZIP")
|
||||
TREESHAKEN_BASE_FORM=$(node ./test/treeshake/utils/format-size.js "$TREESHAKEN_BASE")
|
||||
TREESHAKEN_BASE_GZIP_FORM=$(node ./test/treeshake/utils/format-size.js "$TREESHAKEN_BASE_GZIP")
|
||||
TREESHAKEN_DIFF=$(node ./test/treeshake/utils/format-diff.js "$TREESHAKEN" "$TREESHAKEN_BASE")
|
||||
|
||||
echo "FILESIZE=$FILESIZE_FORM" >> $GITHUB_OUTPUT
|
||||
echo "FILESIZE_GZIP=$FILESIZE_GZIP_FORM" >> $GITHUB_OUTPUT
|
||||
echo "FILESIZE_BASE=$FILESIZE_BASE_FORM" >> $GITHUB_OUTPUT
|
||||
echo "FILESIZE_BASE_GZIP=$FILESIZE_BASE_GZIP_FORM" >> $GITHUB_OUTPUT
|
||||
echo "FILESIZE_DIFF=$FILESIZE_DIFF" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN=$TREESHAKEN_FORM" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN_GZIP=$TREESHAKEN_GZIP_FORM" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN_BASE=$TREESHAKEN_BASE_FORM" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN_BASE_GZIP=$TREESHAKEN_BASE_GZIP_FORM" >> $GITHUB_OUTPUT
|
||||
echo "TREESHAKEN_DIFF=$TREESHAKEN_DIFF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Find existing comment
|
||||
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ fromJSON(steps.download-artifact.outputs.result).pr }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: Bundle size
|
||||
- name: Comment on PR
|
||||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
|
||||
with:
|
||||
issue-number: ${{ fromJSON(steps.download-artifact.outputs.result).pr }}
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
edit-mode: replace
|
||||
body: |
|
||||
### 📦 Bundle size
|
||||
|
||||
_Full ESM build, minified and gzipped._
|
||||
|
||||
| Filesize `${{ github.ref_name }}` | Filesize PR | Diff |
|
||||
|----------|---------|------|
|
||||
| ${{ steps.format.outputs.FILESIZE_BASE }} (${{ steps.format.outputs.FILESIZE_BASE_GZIP }}) | ${{ steps.format.outputs.FILESIZE }} (${{ steps.format.outputs.FILESIZE_GZIP }}) | ${{ steps.format.outputs.FILESIZE_DIFF }} |
|
||||
|
||||
### 🌳 Bundle size after tree-shaking
|
||||
|
||||
_Minimal build including a renderer, camera, empty scene, and dependencies._
|
||||
|
||||
| Filesize `${{ github.ref_name }}` | Filesize PR | Diff |
|
||||
|----------|---------|------|
|
||||
| ${{ steps.format.outputs.TREESHAKEN_BASE }} (${{ steps.format.outputs.TREESHAKEN_BASE_GZIP }}) | ${{ steps.format.outputs.TREESHAKEN }} (${{ steps.format.outputs.TREESHAKEN_GZIP }}) | ${{ steps.format.outputs.TREESHAKEN_DIFF }} |
|
Reference in New Issue
Block a user