Skip to content
Merged
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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

257 changes: 251 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,56 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Read Node version from mise.toml
id: node
run: echo "version=$(grep -E '^node\s*=' mise.toml | sed -E 's/.*"([^"]+)".*/\1/')" >> "$GITHUB_OUTPUT"

- name: Install package manager (from package.json)
run: |
corepack enable
corepack install

- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn
- run: yarn lint
- run: yarn test
- run: yarn build || { echo "build command should always succeed" ; exit 61; }
# - run: yarn build --quiet && git diff --quiet action || { echo "ERROR - index.js is different from repository version. Forgot to run `yarn build`?" ; exit 62; }
node-version: ${{ steps.node.outputs.version }}

- name: Resolve yarn cache folder
id: yarn-config
run: echo "cacheFolder=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"

- name: Restore yarn install cache (node_modules + cacheFolder + install-state)
uses: actions/cache@v4
with:
path: |
node_modules
${{ steps.yarn-config.outputs.cacheFolder }}
.yarn/install-state.gz
key: yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-

- name: Install deps
env:
YARN_ENABLE_HARDENED_MODE: 'false'
run: |
case "$(yarn --version)" in 1.*) echo 'expected up-to-date yarn version'; exit 1 ;; esac
yarn install --immutable

- name: Format
run: yarn format:check

- name: Lint
run: yarn lint

- name: Typecheck
run: yarn typecheck

- name: Test
run: yarn test

- name: Build
run: yarn build || { echo 'build command should always succeed'; exit 61; }

testAllModesLikeInTheReadme:
name: Test in ${{ matrix.testMode }} of version ${{ matrix.unityVersion }} on ${{ matrix.baseRunner }}
Expand Down Expand Up @@ -64,6 +106,35 @@ jobs:
key: Library-${{ matrix.baseRunner }}-${{ matrix.projectPath }}
restore-keys: |
Library-${{ matrix.baseRunner }}
###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

- uses: ./
id: tests
with:
Expand Down Expand Up @@ -111,6 +182,35 @@ jobs:
restore-keys: |
Library-${{ matrix.baseRunner }}

###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

# Configure test runner
- name: Run tests
id: allTests
Expand Down Expand Up @@ -174,6 +274,35 @@ jobs:
restore-keys: |
Library-${{ matrix.baseRunner }}

###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

# Configure test runner
- name: Run tests
id: editMode
Expand Down Expand Up @@ -234,6 +363,35 @@ jobs:
restore-keys: |
Library-${{ matrix.baseRunner }}

###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

# Configure test runner
- name: Run tests
id: playMode
Expand Down Expand Up @@ -293,6 +451,35 @@ jobs:
restore-keys: |
Library-${{ matrix.baseRunner }}-

###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

# Configure test runner
- name: Run tests
id: standalone
Expand Down Expand Up @@ -344,6 +531,35 @@ jobs:
restore-keys: |
Library-${{ matrix.baseRunner }}-

###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

# Set scripting backend to IL2CPP
- name: Rewrite ProjectSettings
run: |
Expand Down Expand Up @@ -403,6 +619,35 @@ jobs:
restore-keys: |
Library-${{ matrix.baseRunner }}-

###########################
# Docker Readiness #
###########################
- name: Ensure Docker daemon is ready (Windows runners only)
if: runner.os == 'Windows'
timeout-minutes: 2
shell: powershell
run: |
$maxRetries = 10
$retryDelay = 6
for ($i = 0; $i -lt $maxRetries; $i++) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -eq 'Running') {
docker version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker is ready."
exit 0
}
}
if ($svc -and $svc.Status -eq 'Stopped') {
Write-Host "Docker service stopped, attempting to start..."
Start-Service docker -ErrorAction SilentlyContinue
}
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
Start-Sleep -Seconds $retryDelay
}
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
exit 1

# Configure first test runner
- name: Tests in editmode 📝
uses: ./
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@
node_modules
coverage/
lib/

# Yarn 4 (Berry)
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

16 changes: 5 additions & 11 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

if [ -t 1 ]; then
exec < /dev/tty
fi

#!/usr/bin/env sh
yarn lint-staged
yarn lint
yarn test
yarn typecheck

yarn build
git add dist
if command -v gitleaks >/dev/null 2>&1; then
gitleaks protect --staged --no-banner --redact
fi
Comment on lines +1 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing set -e — lint failures can silently pass pre-commit

Without set -e, if yarn lint-staged exits non-zero the shell continues to yarn typecheck. If that succeeds (exit 0) the hook exits 0 and git allows the commit — defeating the purpose of the hook.

Add set -e immediately after the shebang so any failing step aborts the script:

🐛 Proposed fix
 #!/usr/bin/env sh
+set -e
 yarn lint-staged
 yarn typecheck
 
 if command -v gitleaks >/dev/null 2>&1; then
   gitleaks protect --staged --no-banner --redact
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#!/usr/bin/env sh
yarn lint-staged
yarn lint
yarn test
yarn typecheck
yarn build
git add dist
if command -v gitleaks >/dev/null 2>&1; then
gitleaks protect --staged --no-banner --redact
fi
#!/usr/bin/env sh
set -e
yarn lint-staged
yarn typecheck
if command -v gitleaks >/dev/null 2>&1; then
gitleaks protect --staged --no-banner --redact
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.husky/pre-commit around lines 1 - 7, Add "set -e" immediately after the
shebang in the pre-commit shell script so the script aborts on any failing
command; modify the top of the script that currently runs "yarn lint-staged" and
"yarn typecheck" (and later calls "gitleaks protect --staged") to include set -e
right after "#!/usr/bin/env sh" to ensure any non-zero exit from yarn
lint-staged, yarn typecheck, or gitleaks causes the hook to fail.

17 changes: 17 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"proseWrap": "preserve",
"sortPackageJson": false,
"ignorePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/coverage/**",
"**/.yarn/**",
"default-build-script/**",
"test-runner/**",
"platforms/**"
]
}
Loading
Loading