diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..97fcf1e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: Tests +permissions: read-all +on: + pull_request: + push: + +jobs: + run: + runs-on: ubuntu-latest + name: Compile and install PHP - Test + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: PHPWatch/setup-curl@main + + - name: Display versions and env + run: | + curl --version diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c614a3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 PHP Watch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa563f7 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Compile PHP - GitHub Actions + +This GitHub action downloads the latest Curl release (curl), +configures it to enable all features, compiles it, and installs it. + +## Usage + +```yaml +name: Tests +permissions: read-all +on: + pull_request: + push: + +jobs: + run: + runs-on: ubuntu-latest + name: Compile and install PHP - Test + steps: + - name: Setup PHP + uses: PHPWatch/setup-curl@main + + - name: Display versions and env + run: | + curl --version + +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..1230fd3 --- /dev/null +++ b/action.yml @@ -0,0 +1,125 @@ +name: Compile and install Curl from source +description: Compile and install Curl from source +runs: + using: composite + steps: + - name: Checkout php-src repo + uses: actions/checkout@v4 + with: + repository: curl/curl + path: .curl + fetch-depth: 0 + + - name: Checkout latest release tag + shell: bash + run: | + cd .curl + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + git checkout $LATEST_TAG + + - name: Install dependencies + shell: bash + run: | + set -x + sudo sed -i -- 's/#deb-src/deb-src/g' /etc/apt/sources.list && sudo sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list + sudo apt update + sudo apt build-dep libcurl4-openssl-dev curl -y + + - name: Configure build + shell: bash + run: | + set -x + cd .php-src + ./buildconf --force + ./configure \ + --enable-option-checking=fatal \ + --prefix=/usr \ + --enable-phpdbg \ + --enable-fpm \ + --with-pdo-mysql=mysqlnd \ + --with-mysqli=mysqlnd \ + --with-pgsql \ + --with-pdo-pgsql \ + --with-pdo-sqlite \ + --enable-intl \ + --without-pear \ + --enable-gd \ + --with-jpeg \ + --with-webp \ + --with-avif \ + --with-freetype \ + --with-xpm \ + --enable-exif \ + --with-zip \ + --with-zlib \ + --enable-soap \ + --enable-xmlreader \ + --with-xsl \ + --with-tidy \ + --enable-sysvsem \ + --enable-sysvshm \ + --enable-shmop \ + --enable-pcntl \ + --with-readline \ + --enable-mbstring \ + --with-curl \ + --with-gettext \ + --enable-sockets \ + --with-bz2 \ + --with-openssl \ + --with-gmp \ + --enable-bcmath \ + --enable-calendar \ + --enable-ftp \ + --with-enchant=/usr \ + --enable-sysvmsg \ + --with-ffi \ + --with-ldap \ + --with-ldap-sasl \ + --with-password-argon2 \ + --with-mhash \ + --with-sodium \ + --enable-dba \ + --with-cdb \ + --enable-flatfile \ + --enable-inifile \ + --with-tcadb \ + --with-lmdb \ + --with-qdbm \ + --with-snmp \ + --with-unixODBC \ + --with-pdo-odbc=unixODBC,/usr \ + --with-config-file-path=/etc \ + --with-config-file-scan-dir=/etc/php.d \ + --with-pdo-dblib \ + --enable-werror + cd ../ + + - name: Compile + shell: bash + run: | + cd ./.php-src + make -j$(/usr/bin/nproc) >/dev/null + cd ../ + + - name: Install + shell: bash + run: | + set -x + cd ./.php-src + sudo make install + sudo mkdir -p /etc/php.d + sudo chmod 777 /etc/php.d + cd ../ + + - name: Enable opcache + shell: bash + run: | + echo zend_extension=opcache.so >> /etc/php.d/opcache.ini + echo opcache.enable=1 >> /etc/php.d/opcache.ini + echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + + - name: Cleanup + shell: bash + run: | + rm .php-src -Rf