-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 293c817
Showing
6 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: brew pr-pull | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- labeled | ||
|
||
jobs: | ||
pr-pull: | ||
if: contains(github.event.pull_request.labels.*.name, 'pr-pull') | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
steps: | ||
- name: Set up Homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
|
||
- name: Set up git | ||
uses: Homebrew/actions/git-user-config@master | ||
|
||
- name: Pull bottles | ||
env: | ||
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} | ||
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }} | ||
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.repository_owner }} | ||
PULL_REQUEST: ${{ github.event.pull_request.number }} | ||
run: brew pr-pull --debug --tap="$GITHUB_REPOSITORY" "$PULL_REQUEST" | ||
|
||
- name: Push commits | ||
uses: Homebrew/actions/git-try-push@master | ||
with: | ||
token: ${{ github.token }} | ||
branch: main | ||
|
||
- name: Delete branch | ||
if: github.event.pull_request.head.repo.fork == false | ||
env: | ||
BRANCH: ${{ github.event.pull_request.head.ref }} | ||
run: git push --delete origin "$BRANCH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: brew test-bot | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test-bot: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, macos-13, macos-15] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
|
||
- name: Cache Homebrew Bundler RubyGems | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.set-up-homebrew.outputs.gems-path }} | ||
key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} | ||
restore-keys: ${{ matrix.os }}-rubygems- | ||
|
||
- run: brew test-bot --only-cleanup-before | ||
|
||
- run: brew test-bot --only-setup | ||
|
||
- run: brew test-bot --only-tap-syntax | ||
|
||
- run: brew test-bot --only-formulae --root-url='https://ghcr.io/v2/dunglas/frankenphp' | ||
if: github.event_name == 'pull_request' | ||
|
||
- name: Upload bottles as artifact | ||
if: always() && github.event_name == 'pull_request' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bottles_${{ matrix.os }} | ||
path: '*.bottle.*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
class Frankenphp < Formula | ||
desc "Modern PHP app server" | ||
homepage "https://frankenphp.dev" | ||
url "https://github.com/dunglas/frankenphp/archive/refs/tags/v1.3.3.tar.gz" | ||
sha256 "3be985c5340bec15a60b9c75ee5c2af0a6450dc02b4c31098922f935dce3d51e" | ||
license "MIT" | ||
head "https://github.com/dunglas/frankenphp.git", branch: "main" | ||
|
||
depends_on "go" => :build | ||
|
||
depends_on "brotli" | ||
depends_on "shivammathur/php/php-zts" | ||
depends_on "watcher" | ||
|
||
def install | ||
php_config = "#{Formula["shivammathur/php/php-zts"].opt_bin}/php-config" | ||
lib_path = OS.mac? ? " -L#{MacOS.sdk_path_if_needed}/usr/lib" : "" | ||
|
||
ENV["CGO_CFLAGS"] = `#{php_config} --includes` | ||
ENV["CGO_LDFLAGS"] = `#{php_config} --ldflags`.strip! + " " + `#{php_config} --libs`.strip! + lib_path | ||
|
||
ldflags = %W[ | ||
-s -w | ||
-X "github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP #{version} (Homebrew) PHP #{Formula["shivammathur/php/php-zts"].version} Caddy" | ||
] | ||
|
||
cd "caddy/frankenphp" do | ||
system "go", "build", \ | ||
*std_go_args(ldflags:, output: bin/"frankenphp"), "-tags", "nobadger,nomysql,nopgx", "main.go" | ||
end | ||
end | ||
|
||
def caveats | ||
<<~EOS | ||
When running the provided service, frankenphp's data dir will be set as | ||
`#{HOMEBREW_PREFIX}/var/lib` | ||
instead of the default location found at https://caddyserver.com/docs/conventions#data-directory | ||
EOS | ||
end | ||
|
||
service do | ||
run [opt_bin/"frankenphp", "run", "--config", etc/"Caddyfile"] | ||
keep_alive true | ||
environment_variables XDG_DATA_HOME: "#{HOMEBREW_PREFIX}/var/lib" | ||
end | ||
|
||
test do | ||
port1 = free_port | ||
port2 = free_port | ||
|
||
(testpath/"Caddyfile").write <<~EOS | ||
{ | ||
admin 127.0.0.1:#{port1} | ||
} | ||
http://127.0.0.1:#{port2} { | ||
respond "Hello, FrankenPHP!" | ||
} | ||
EOS | ||
|
||
fork do | ||
exec bin/"frankenphp", "run", "--config", testpath/"Caddyfile" | ||
end | ||
sleep 2 | ||
|
||
assert_match "\":#{port2}\"", | ||
shell_output("curl -s http://127.0.0.1:#{port1}/config/apps/http/servers/srv0/listen/0") | ||
assert_match "Hello, FrankenPHP!", shell_output("curl -s http://127.0.0.1:#{port2}") | ||
|
||
assert_match version.to_s, shell_output("#{bin}/frankenphp version") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT license | ||
|
||
Copyright (c) 2024-present Kévin Dunglas | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Homebrew FrankenPHP | ||
|
||
<h1 align="center"><a href="https://frankenphp.dev"><img src="logo.png" alt="Homebrew FrankenPHP" width="600"></a></h1> | ||
|
||
[Homebrew Formula](https://brew.sh) for [FrankenPHP](https://frankenphp.dev) (macOS and Linux). | ||
|
||
Automatically installs a PHP version compatible with FrankenPHP using the [`shivammathur/php`](https://github.com/shivammathur/homebrew-php) tap. | ||
|
||
## Install | ||
|
||
Be sure to have Homebrew installed then run: | ||
|
||
```console | ||
brew install dunglas/frankenphp/frankenphp | ||
``` | ||
|
||
Alternatively, you can tap the repository and install the formula: | ||
|
||
```console | ||
brew tap dunglas/frankenphp | ||
brew install frankenphp | ||
``` | ||
|
||
[`brew bundle`](https://github.com/Homebrew/homebrew-bundle) `Brewfile` are also supported: | ||
|
||
```ruby | ||
tap "dunglas/frankenphp" | ||
brew "frankenphp" | ||
``` | ||
|
||
## Credits | ||
|
||
Created by [Kévin Dunglas](https://dunglas.dev) and sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop). |