-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from zeabur/pan93412/ZEA-1923
ZEA-1923: Support Laravel Octane (Swoole) for zbpack
- Loading branch information
Showing
7 changed files
with
2,498 additions
and
25 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,7 @@ | ||
package php | ||
|
||
// ConfigLaravelOctaneServer defines what server we should use to run Laravel Octane. | ||
// | ||
// When this config is set, we will use the corresponding server to run the project | ||
// instead of the original Nginx + PHP-FPM stack. | ||
const ConfigLaravelOctaneServer = "laravel.octane.server" |
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
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
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
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
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,103 @@ | ||
package php_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gkampitakis/go-snaps/snaps" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/zeabur/zbpack/internal/php" | ||
"github.com/zeabur/zbpack/pkg/types" | ||
) | ||
|
||
func TestTemplate(t *testing.T) { | ||
t.Parallel() | ||
|
||
phpVersion := []string{ | ||
"8.1", | ||
"8.2", | ||
"7", | ||
} | ||
framework := []string{ | ||
string(types.PHPFrameworkNone), | ||
string(types.PHPFrameworkLaravel), | ||
string(types.PHPFrameworkThinkphp), | ||
string(types.PHPFrameworkCodeigniter), | ||
} | ||
deps := []string{ | ||
"nginx", | ||
"nginx,owo", | ||
} | ||
property := []string{ | ||
php.PropertyToString(types.PHPPropertyNone), | ||
php.PropertyToString(types.PHPPropertyComposer), | ||
} | ||
octaneServer := []string{ | ||
"", | ||
"roadrunner", | ||
"swoole", | ||
} | ||
|
||
for _, v := range phpVersion { | ||
v := v | ||
for _, d := range deps { | ||
d := d | ||
for _, f := range framework { | ||
f := f | ||
for _, p := range property { | ||
p := p | ||
t.Run(v+"-"+f+"-"+d+"-"+p, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
dockerfile, err := php.GenerateDockerfile(types.PlanMeta{ | ||
"phpVersion": v, | ||
"framework": f, | ||
"deps": d, | ||
"app": string(types.PHPApplicationDefault), | ||
"property": p, | ||
}) | ||
|
||
assert.NoError(t, err) | ||
snaps.MatchSnapshot(t, dockerfile) | ||
}) | ||
|
||
if f == string(types.PHPFrameworkLaravel) { | ||
for _, o := range octaneServer { | ||
o := o | ||
|
||
t.Run(v+"-"+f+"-"+d+"-"+p+"+os-"+o, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
dockerfile, err := php.GenerateDockerfile(types.PlanMeta{ | ||
"phpVersion": v, | ||
"framework": f, | ||
"deps": d, | ||
"app": string(types.PHPApplicationDefault), | ||
"property": p, | ||
"octaneServer": o, | ||
}) | ||
|
||
assert.NoError(t, err) | ||
snaps.MatchSnapshot(t, dockerfile) | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
func TestTemplate_AcgFaka(t *testing.T) { | ||
t.Parallel() | ||
|
||
dockerfile, err := php.GenerateDockerfile(types.PlanMeta{ | ||
"phpVersion": "8.2", | ||
"framework": string(types.PHPFrameworkLaravel), | ||
"deps": "nginx", | ||
"app": string(types.PHPApplicationAcgFaka), | ||
"property": php.PropertyToString(types.PHPPropertyComposer), | ||
}) | ||
|
||
assert.NoError(t, err) | ||
snaps.MatchSnapshot(t, dockerfile) | ||
} |