-
Notifications
You must be signed in to change notification settings - Fork 30
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 #688 from gsmet/codestarts
Add codestarts
- Loading branch information
Showing
23 changed files
with
539 additions
and
14 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
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
11 changes: 11 additions & 0 deletions
11
...rc/main/codestarts/quarkus/quarkiverse-github-app-command-airline-codestart/codestart.yml
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,11 @@ | ||
name: quarkiverse-github-app-command-airline-codestart | ||
ref: quarkiverse-github-app-command-airline | ||
metadata: | ||
title: GitHub App Command Airline | ||
description: Start coding comment-based commands. | ||
related-guide-section: https://docs.quarkiverse.io/quarkus-github-app/dev/commands.html | ||
language: | ||
base: | ||
shared-data: | ||
readme: | ||
include-default-content: false |
39 changes: 39 additions & 0 deletions
39
...kiverse-github-app-command-airline-codestart/java/src/main/java/org/acme/MyGitHubBot.java
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,39 @@ | ||
package org.acme; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import org.kohsuke.github.GHEventPayload; | ||
|
||
import com.github.rvesse.airline.annotations.Arguments; | ||
import com.github.rvesse.airline.annotations.Cli; | ||
import com.github.rvesse.airline.annotations.Command; | ||
|
||
import io.quarkiverse.githubapp.command.airline.AbstractHelpCommand; | ||
|
||
// TODO: make sure you adjust the name as @bot is an actual GitHub user | ||
@Cli(name = "@bot", commands = { MyGitHubBot.SayHello.class, MyGitHubBot.Help.class }, description = "A friendly bot") | ||
public class MyGitHubBot { | ||
|
||
interface Commands { | ||
|
||
void run(GHEventPayload.IssueComment issueCommentPayload) throws IOException; | ||
} | ||
|
||
@Command(name = "say-hello", description = "Says hello") | ||
static class SayHello implements Commands { | ||
|
||
@Arguments | ||
List<String> arguments; | ||
|
||
@Override | ||
public void run(GHEventPayload.IssueComment issueCommentPayload) throws IOException { | ||
issueCommentPayload.getIssue() | ||
.comment(":wave: Hello " + (arguments != null ? String.join(" ", arguments) : "from Bot")); | ||
} | ||
} | ||
|
||
@Command(name = "help", description = "Displays help") | ||
static class Help extends AbstractHelpCommand implements Commands { | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
integration-tests/app/src/test/java/io/quarkiverse/githubapp/it/app/CodestartTest.java
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,31 @@ | ||
package io.quarkiverse.githubapp.it.app; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog; | ||
import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog.Language; | ||
import io.quarkus.devtools.commands.CreateProject.CreateProjectKey; | ||
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest; | ||
|
||
public class CodestartTest { | ||
@RegisterExtension | ||
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder() | ||
.languages(QuarkusCodestartCatalog.Language.JAVA) | ||
.setupStandaloneExtensionTest("io.quarkiverse.githubapp:quarkus-github-app") | ||
.putData(CreateProjectKey.PROJECT_NAME, "My GitHub App") | ||
.putData(CreateProjectKey.PROJECT_DESCRIPTION, "My GitHub App description") | ||
.build(); | ||
|
||
@Test | ||
void testContent() throws Throwable { | ||
codestartTest.checkGeneratedSource("org.acme.MyGitHubApp"); | ||
codestartTest.assertThatGeneratedFileMatchSnapshot(Language.JAVA, "pom.xml"); | ||
codestartTest.assertThatGeneratedFileMatchSnapshot(Language.JAVA, "README.md"); | ||
} | ||
|
||
@Test | ||
void buildAllProjects() throws Throwable { | ||
codestartTest.buildAllProjects(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...-tests/app/src/test/resources/__snapshots__/CodestartTest/testContent/README.md
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,8 @@ | ||
|
||
# My GitHub App | ||
|
||
> My GitHub App description | ||
This repository contains a GitHub App powered by [Quarkus GitHub App](https://github.com/quarkiverse/quarkus-github-app). | ||
|
||
Have a look at the [documentation](https://quarkiverse.github.io/quarkiverse-docs/quarkus-github-app/dev/index.html) to get started. |
122 changes: 122 additions & 0 deletions
122
integration-tests/app/src/test/resources/__snapshots__/CodestartTest/testContent/pom.xml
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,122 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.test</groupId> | ||
<artifactId>test-codestart</artifactId> | ||
<version>1.0.0-codestart</version> | ||
<name>My GitHub App</name> | ||
<description>My GitHub App description</description> | ||
|
||
<properties> | ||
<compiler-plugin.version>3.8.1-MOCK</compiler-plugin.version> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<quarkus.platform.artifact-id>quarkus-mock-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> | ||
<quarkus.platform.version>999-MOCK</quarkus.platform.version> | ||
<skipITs>true</skipITs> | ||
<surefire-plugin.version>3.0.0-MOCK</surefire-plugin.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>${quarkus.platform.artifact-id}</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkiverse.githubapp</groupId> | ||
<artifactId>quarkus-github-app</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>quarkus-mock-maven-plugin</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
<goal>generate-code</goal> | ||
<goal>generate-code-tests</goal> | ||
<goal>native-image-agent</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${compiler-plugin.version}</version> | ||
<configuration> | ||
<parameters>true</parameters> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<properties> | ||
<skipITs>false</skipITs> | ||
<quarkus.native.enabled>true</quarkus.native.enabled> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
...ces/__snapshots__/CodestartTest/testContent/src_main_java_ilove_quark_us_MyGitHubApp.java
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,14 @@ | ||
package ilove.quark.us; | ||
|
||
import java.io.IOException; | ||
|
||
import org.kohsuke.github.GHEventPayload; | ||
|
||
import io.quarkiverse.githubapp.event.Issue; | ||
|
||
class MyGitHubApp { | ||
|
||
void onOpen(@Issue.Opened GHEventPayload.Issue issuePayload) throws IOException { | ||
issuePayload.getIssue().comment(":wave: Hello from my GitHub App"); | ||
} | ||
} |
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
Oops, something went wrong.