diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml index 679afc4..4646518 100644 --- a/.github/workflows/cross-compile.yml +++ b/.github/workflows/cross-compile.yml @@ -134,13 +134,12 @@ jobs: - name: Build (Linux) if: matrix.os == 'ubuntu-latest' - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --release --target ${{ matrix.target }} + run: | + cargo install cross + export CROSS_CONFIG=./Cross_php-${{ matrix.php-versions }}.toml + cross build --release --target ${{ matrix.target }} - - name: Build (MacOS and Windows) + - name: Build Extension if: matrix.os != 'ubuntu-latest' run: cargo build --release --target ${{ matrix.target }} diff --git a/Cross.toml b/Cross_php-8.0.toml similarity index 63% rename from Cross.toml rename to Cross_php-8.0.toml index 6e35237..c618d59 100644 --- a/Cross.toml +++ b/Cross_php-8.0.toml @@ -1,5 +1,5 @@ [target.x86_64-unknown-linux-gnu] -dockerfile = "Dockerfile" +dockerfile = "./docker/php80/Dockerfile" [build] rust-toolchain = "nightly" diff --git a/Cross_php-8.1.toml b/Cross_php-8.1.toml new file mode 100644 index 0000000..62cc7bf --- /dev/null +++ b/Cross_php-8.1.toml @@ -0,0 +1,5 @@ +[target.x86_64-unknown-linux-gnu] +dockerfile = "./docker/php81/Dockerfile" + +[build] +rust-toolchain = "nightly" diff --git a/Cross_php-8.2.toml b/Cross_php-8.2.toml new file mode 100644 index 0000000..703e3b7 --- /dev/null +++ b/Cross_php-8.2.toml @@ -0,0 +1,5 @@ +[target.x86_64-unknown-linux-gnu] +dockerfile = "./docker/php82/Dockerfile" + +[build] +rust-toolchain = "nightly" diff --git a/Cross_php-8.3.toml b/Cross_php-8.3.toml new file mode 100644 index 0000000..39e87fb --- /dev/null +++ b/Cross_php-8.3.toml @@ -0,0 +1,5 @@ +[target.x86_64-unknown-linux-gnu] +dockerfile = "./docker/php83/Dockerfile" + +[build] +rust-toolchain = "nightly" diff --git a/Dockerfile b/docker/php80/Dockerfile similarity index 61% rename from Dockerfile rename to docker/php80/Dockerfile index 7a508ae..3af1688 100644 --- a/Dockerfile +++ b/docker/php80/Dockerfile @@ -1,5 +1,5 @@ # Use the latest version of Ubuntu -FROM ubuntu:20.04 +FROM ubuntu:latest # Avoid prompts from apt ENV DEBIAN_FRONTEND=noninteractive @@ -13,14 +13,12 @@ RUN apt-get update && apt-get install -y \ git \ cmake \ llvm \ - libclang-dev + libclang-dev \ + && add-apt-repository ppa:ondrej/php -y \ + && apt-get update -# Install PHP 8.0, 8.1, 8.2, 8.3 using retry logic -RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update && apt-get install -y \ - php8.0 php8.0-cli php8.0-common php8.0-dev \ - php8.1 php8.1-cli php8.1-common php8.1-dev \ - php8.2 php8.2-cli php8.2-common php8.2-dev \ - php8.3 php8.3-cli php8.3-common php8.3-dev +# Install PHP 8.0 and php8.0-dev +RUN apt-get install -y php8.0 php8.0-cli php8.0-common php8.0-dev # Create a non-root user and switch to it RUN useradd -m dockeruser @@ -34,4 +32,4 @@ RUN cargo install cross # Verify installations RUN php -v -RUN php-config --version \ No newline at end of file +RUN php-config --version diff --git a/docker/php81/Dockerfile b/docker/php81/Dockerfile new file mode 100644 index 0000000..9839e28 --- /dev/null +++ b/docker/php81/Dockerfile @@ -0,0 +1,35 @@ +# Use the latest version of Ubuntu +FROM ubuntu:latest + +# Avoid prompts from apt +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install necessary packages +RUN apt-get update && apt-get install -y \ + software-properties-common \ + curl \ + build-essential \ + pkg-config \ + git \ + cmake \ + llvm \ + libclang-dev \ + && add-apt-repository ppa:ondrej/php -y \ + && apt-get update + +# Install PHP 8.1 and php8.1-dev +RUN apt-get install -y php8.1 php8.1-cli php8.1-common php8.1-dev + +# Create a non-root user and switch to it +RUN useradd -m dockeruser +USER dockeruser + +# Install Rust and cross +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + && /home/dockeruser/.cargo/bin/rustup default nightly +ENV PATH="/home/dockeruser/.cargo/bin:${PATH}" +RUN cargo install cross + +# Verify installations +RUN php -v +RUN php-config --version diff --git a/docker/php82/Dockerfile b/docker/php82/Dockerfile new file mode 100644 index 0000000..abecb73 --- /dev/null +++ b/docker/php82/Dockerfile @@ -0,0 +1,35 @@ +# Use the latest version of Ubuntu +FROM ubuntu:latest + +# Avoid prompts from apt +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install necessary packages +RUN apt-get update && apt-get install -y \ + software-properties-common \ + curl \ + build-essential \ + pkg-config \ + git \ + cmake \ + llvm \ + libclang-dev \ + && add-apt-repository ppa:ondrej/php -y \ + && apt-get update + +# Install PHP 8.2 and php8.2-dev +RUN apt-get install -y php8.2 php8.2-cli php8.2-common php8.2-dev + +# Create a non-root user and switch to it +RUN useradd -m dockeruser +USER dockeruser + +# Install Rust and cross +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + && /home/dockeruser/.cargo/bin/rustup default nightly +ENV PATH="/home/dockeruser/.cargo/bin:${PATH}" +RUN cargo install cross + +# Verify installations +RUN php -v +RUN php-config --version diff --git a/docker/php83/Dockerfile b/docker/php83/Dockerfile new file mode 100644 index 0000000..b67e895 --- /dev/null +++ b/docker/php83/Dockerfile @@ -0,0 +1,35 @@ +# Use the latest version of Ubuntu +FROM ubuntu:latest + +# Avoid prompts from apt +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install necessary packages +RUN apt-get update && apt-get install -y \ + software-properties-common \ + curl \ + build-essential \ + pkg-config \ + git \ + cmake \ + llvm \ + libclang-dev \ + && add-apt-repository ppa:ondrej/php -y \ + && apt-get update + +# Install PHP 8.3 and php8.3-dev +RUN apt-get install -y php8.3 php8.3-cli php8.3-common php8.3-dev + +# Create a non-root user and switch to it +RUN useradd -m dockeruser +USER dockeruser + +# Install Rust and cross +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + && /home/dockeruser/.cargo/bin/rustup default nightly +ENV PATH="/home/dockeruser/.cargo/bin:${PATH}" +RUN cargo install cross + +# Verify installations +RUN php -v +RUN php-config --version