mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
test: add e2e tests with local Forgejo instance (#201)
* feat(forge): add new forge for forgejo We only support repositories hosted on Forgejo instances, but not Forgejo Actions or Woodpecker as CI solutions for now. * test(e2e): introduce e2e test framework with local forgejo
This commit is contained in:
parent
afef176e37
commit
fcf7906149
14 changed files with 936 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import (
|
|||
rp "github.com/apricote/releaser-pleaser"
|
||||
"github.com/apricote/releaser-pleaser/internal/commitparser/conventionalcommits"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge/forgejo"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge/github"
|
||||
"github.com/apricote/releaser-pleaser/internal/forge/gitlab"
|
||||
"github.com/apricote/releaser-pleaser/internal/log"
|
||||
|
|
@ -26,6 +27,10 @@ func newRunCommand() *cobra.Command {
|
|||
flagRepo string
|
||||
flagExtraFiles string
|
||||
flagUpdaters []string
|
||||
|
||||
flagAPIURL string
|
||||
flagAPIToken string
|
||||
flagUsername string
|
||||
)
|
||||
|
||||
var cmd = &cobra.Command{
|
||||
|
|
@ -68,6 +73,21 @@ func newRunCommand() *cobra.Command {
|
|||
Owner: flagOwner,
|
||||
Repo: flagRepo,
|
||||
})
|
||||
case "forgejo":
|
||||
logger.DebugContext(ctx, "using forge Forgejo")
|
||||
f, err = forgejo.New(logger, &forgejo.Options{
|
||||
Options: forgeOptions,
|
||||
Owner: flagOwner,
|
||||
Repo: flagRepo,
|
||||
|
||||
APIURL: flagAPIURL,
|
||||
APIToken: flagAPIToken,
|
||||
Username: flagUsername,
|
||||
})
|
||||
if err != nil {
|
||||
logger.ErrorContext(ctx, "failed to create client", "err", err)
|
||||
return fmt.Errorf("failed to create forgejo client: %w", err)
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unknown --forge: %s", flagForge)
|
||||
}
|
||||
|
|
@ -110,6 +130,10 @@ func newRunCommand() *cobra.Command {
|
|||
cmd.PersistentFlags().StringVar(&flagExtraFiles, "extra-files", "", "")
|
||||
cmd.PersistentFlags().StringSliceVar(&flagUpdaters, "updaters", []string{}, "")
|
||||
|
||||
cmd.PersistentFlags().StringVar(&flagAPIURL, "api-url", "", "")
|
||||
cmd.PersistentFlags().StringVar(&flagAPIToken, "api-token", "", "")
|
||||
cmd.PersistentFlags().StringVar(&flagUsername, "username", "", "")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue