Skip to content

Commit

Permalink
ci: use updated php module
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark committed Nov 18, 2024
1 parent 42f41eb commit 838ce6f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
9 changes: 4 additions & 5 deletions .dagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,10 @@ func (m *Twirp) generate(source *dagger.Directory) *dagger.Directory {

// Build the code generator plugin.
func (m *Twirp) Phpstan() *dagger.Container {
source := phpBase(defaultPhpVersion).Container().
WithDirectory("/work", m.Source).
WithWorkdir("/work").
WithExec([]string{"composer", "install"}).
Directory("/work")
source := phpBase(defaultPhpVersion).
WithSource(m.Source).
WithComposerInstall().
Source()

return dag.Phpstan(dagger.PhpstanOpts{
Version: phpstanVersion,
Expand Down
20 changes: 7 additions & 13 deletions .dagger/tests_e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,25 @@ func (m *Etoe) source(name string) *dagger.Directory {
return m.Main.Source.Directory("tests/" + name)
}

// TODO: make sure Composer dependencies are installed
func (m *Etoe) fullSourceWithCodegen(name string) *dagger.Directory {
generated := m.Main.generate(m.source(name))

return m.Main.Source.WithDirectory("tests/"+name+"/generated", generated)
}

func (m *Etoe) container(name string, phpVersion string) *dagger.Container {
if phpVersion == "" {
phpVersion = defaultPhpVersion
}

return phpBase(phpVersion).Container().
WithFile("/usr/local/bin/clientcompat", m.Main.Clientcompat("")).
WithDirectory("/work", m.fullSourceWithCodegen(name)).
WithWorkdir("/work").
WithExec([]string{"composer", "install"}).
WithWorkdir("/work/tests/" + name)
return phpBase(phpVersion).
WithSource(m.Main.Source).
WithComposerInstall().
Container().
WithWorkdir("/work/src/tests/"+name).
WithMountedDirectory("generated", m.Main.generate(m.source(name)))
}

func (m *Etoe) Clientcompat(
// +optional
phpVersion string,
) *dagger.Container {
return m.container("clientcompat", phpVersion).
WithFile("/usr/local/bin/clientcompat", m.Main.Clientcompat("")).
WithExec([]string{"clientcompat", "-client", "./compat.sh"})
}

Expand Down
12 changes: 6 additions & 6 deletions dagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
],
"dependencies": [
{
"name": "phpstan",
"source": "github.com/sagikazarmark/daggerverse/phpstan@phpstan/v0.2.0",
"pin": "b3c06e7e75b592cce5de7eb6ea54565a7ffbf8aa"
"name": "php",
"source": "github.com/sagikazarmark/daggerverse/php@php/v0.2.0",
"pin": "77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0"
},
{
"name": "arc",
Expand All @@ -25,9 +25,9 @@
"pin": "07f08ab95be76586c798bc55424c684ad6d41497"
},
{
"name": "php",
"source": "github.com/sagikazarmark/daggerverse/php@php/v0.1.0",
"pin": "0af084118b214771286c548a63742219cf95d398"
"name": "phpstan",
"source": "github.com/sagikazarmark/daggerverse/phpstan@phpstan/v0.2.0",
"pin": "b3c06e7e75b592cce5de7eb6ea54565a7ffbf8aa"
}
],
"source": ".dagger"
Expand Down

0 comments on commit 838ce6f

Please sign in to comment.