From 64856c08534fc0010ba7b3b4b1a01d53452c5a3f Mon Sep 17 00:00:00 2001 From: Alessio Date: Mon, 18 May 2026 20:50:04 +0200 Subject: [PATCH 1/3] Reduce Composer package size --- .gitattributes | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3a67686 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +# Make the PHP package lighter by "export-ignore" what's not necessary +/.github export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore +/phpstan.neon.dist export-ignore +/docs export-ignore +/tests export-ignore +/include export-ignore +/rust export-ignore +/CHANGELOG.md export-ignore +/CONTRIBUTING.md export-ignore \ No newline at end of file From 8ca5732944f8aa370ab9d1dc470362bf0ac3a5b3 Mon Sep 17 00:00:00 2001 From: Alessio Date: Mon, 18 May 2026 21:03:12 +0200 Subject: [PATCH 2/3] Experiment adding pre-built binaries to tags --- .github/workflows/build-libs.yml | 88 ++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/build-libs.yml diff --git a/.github/workflows/build-libs.yml b/.github/workflows/build-libs.yml new file mode 100644 index 0000000..d3d7eaa --- /dev/null +++ b/.github/workflows/build-libs.yml @@ -0,0 +1,88 @@ +name: Build Libraries + +on: + push: + tags: + - 'v*' + + + +jobs: + build: + name: Build for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + lib_src: rust/target/release/libtakumi_php.so + lib_dst: lib/libtakumi_php.so + artifact: libtakumi_php-linux + - os: macos-latest + lib_src: rust/target/release/libtakumi_php.dylib + lib_dst: lib/libtakumi_php.dylib + artifact: libtakumi_php-macos + - os: windows-latest + lib_src: rust/target/release/takumi_php.dll + lib_dst: lib/takumi_php.dll + artifact: libtakumi_php-windows + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache Rust dependencies + uses: actions/cache@v5 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + rust/target + key: ${{ runner.os }}-cargo-release-${{ hashFiles('rust/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-release + + - name: Build Rust library (release) + working-directory: rust + run: cargo build --release + + - name: Stage library + shell: bash + run: cp ${{ matrix.lib_src }} ${{ matrix.lib_dst }} + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: ${{ matrix.artifact }} + path: ${{ matrix.lib_dst }} + + commit-libs: + name: Commit libraries to repo + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + ref: ${{ github.ref_name }} + + - name: Download all artifacts + uses: actions/download-artifact@v8 + with: + merge-multiple: true + + - name: Commit and push libraries + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add lib/ + git diff --staged --quiet || git commit -m "chore: update prebuilt libraries for ${{ github.ref_name }}" + git tag -f ${{ github.ref_name }} + git push origin ${{ github.ref_name }} --force From 411d554399000b8bc801dedf27b955d8c6d462c8 Mon Sep 17 00:00:00 2001 From: Alessio Date: Mon, 18 May 2026 21:12:09 +0200 Subject: [PATCH 3/3] Attempt number 2 --- .github/workflows/build-libs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-libs.yml b/.github/workflows/build-libs.yml index d3d7eaa..8c7c55f 100644 --- a/.github/workflows/build-libs.yml +++ b/.github/workflows/build-libs.yml @@ -82,7 +82,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add lib/ + git add --force lib/ git diff --staged --quiet || git commit -m "chore: update prebuilt libraries for ${{ github.ref_name }}" git tag -f ${{ github.ref_name }} git push origin ${{ github.ref_name }} --force