diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index dbbdd16..0000000 --- a/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -platforms/darwin-arm64/*.dylib binary -platforms/darwin-x64/*.dylib binary -platforms/linux-arm64-gnu/*.so binary -platforms/linux-x64-gnu/*.so binary -platforms/win32-x64-msvc/*.dll binary diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index afbe7af..f1f8c3e 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -239,7 +239,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{ matrix.platform }} - path: platforms/${{ matrix.platform }}/ + path: | + platforms/${{ matrix.platform }}/*.dylib + platforms/${{ matrix.platform }}/*.so + platforms/${{ matrix.platform }}/*.dll run-php-tests: name: Run PHP Tests @@ -386,16 +389,87 @@ jobs: id: source-commit run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - name: Download all native libraries + - name: Download libraries uses: actions/download-artifact@v4 with: path: platforms/ - - name: Commit all native libraries - uses: getsentry/action-github-commit@v2.0.0 + - name: Commit libraries + uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} - message: | - build(platforms): update all native libraries - - Source: ${{ steps.source-commit.outputs.sha }} + script: | + const fs = require('fs'); + const path = require('path'); + + const findLibraryFiles = (dir) => { + const extensions = ['.dylib', '.so', '.dll']; + const files = []; + + if (!fs.existsSync(dir)) return files; + + const traverse = (currentDir) => { + const items = fs.readdirSync(currentDir, { withFileTypes: true }); + for (const item of items) { + const fullPath = path.join(currentDir, item.name); + if (item.isDirectory()) { + traverse(fullPath); + } else if (extensions.some(ext => item.name.endsWith(ext))) { + files.push(fullPath); + } + } + }; + + traverse(dir); + + return files; + }; + + const files = findLibraryFiles('platforms'); + + if (files.length === 0) return; + + const { data: ref } = await github.rest.git.getRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `heads/${{ github.head_ref }}` + }); + + const tree = []; + + for (const filePath of files) { + const { data: blob } = await github.rest.git.createBlob({ + owner: context.repo.owner, + repo: context.repo.repo, + content: fs.readFileSync(filePath).toString('base64'), + encoding: 'base64' + }); + tree.push({ + path: filePath, + mode: '100644', + type: 'blob', + sha: blob.sha + }); + } + + const { data: newTree } = await github.rest.git.createTree({ + owner: context.repo.owner, + repo: context.repo.repo, + base_tree: ref.object.sha, + tree: tree + }); + + const { data: commit } = await github.rest.git.createCommit({ + owner: context.repo.owner, + repo: context.repo.repo, + message: `build(platforms): update all native libraries\n\nSource: ${{ steps.source-commit.outputs.sha }}`, + tree: newTree.sha, + parents: [ref.object.sha] + }); + + await github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `heads/${{ github.head_ref }}`, + sha: commit.sha + }); diff --git a/crates/protect-ffi/Cargo.toml b/crates/protect-ffi/Cargo.toml index 4c03782..ba18112 100644 --- a/crates/protect-ffi/Cargo.toml +++ b/crates/protect-ffi/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" license = "ISC" edition = "2021" rust-version = "1.83.0" -exclude = ["*.so", "*.dll", "*.dylib"] [lib] crate-type = ["cdylib"] diff --git a/platforms/darwin-arm64/libprotect_ffi.dylib b/platforms/darwin-arm64/libprotect_ffi.dylib index 4f531af..bc23012 100644 Binary files a/platforms/darwin-arm64/libprotect_ffi.dylib and b/platforms/darwin-arm64/libprotect_ffi.dylib differ diff --git a/platforms/darwin-x64/libprotect_ffi.dylib b/platforms/darwin-x64/libprotect_ffi.dylib index fe2b5fd..af26d15 100644 Binary files a/platforms/darwin-x64/libprotect_ffi.dylib and b/platforms/darwin-x64/libprotect_ffi.dylib differ diff --git a/platforms/linux-arm64-gnu/libprotect_ffi.so b/platforms/linux-arm64-gnu/libprotect_ffi.so index ce677b8..527a1c3 100644 Binary files a/platforms/linux-arm64-gnu/libprotect_ffi.so and b/platforms/linux-arm64-gnu/libprotect_ffi.so differ diff --git a/platforms/linux-x64-gnu/libprotect_ffi.so b/platforms/linux-x64-gnu/libprotect_ffi.so index 0837f2f..e38893a 100644 Binary files a/platforms/linux-x64-gnu/libprotect_ffi.so and b/platforms/linux-x64-gnu/libprotect_ffi.so differ diff --git a/platforms/win32-x64-msvc/protect_ffi.dll b/platforms/win32-x64-msvc/protect_ffi.dll index 9dfdf9f..7e8ffa4 100644 Binary files a/platforms/win32-x64-msvc/protect_ffi.dll and b/platforms/win32-x64-msvc/protect_ffi.dll differ