-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Github Actions support #717
Conversation
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.objenesis.SpringObjenesis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange import
@Operation(summary = "Init Github Actions YML file") | ||
@ApiResponse(responseCode = "500", description = "An error occurred while initializing the github-actions.yml.mustache file") | ||
@PostMapping("/init") | ||
@GeneratorStep(id = "init") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be github-actions, as init is already used
|
||
@Override | ||
public void addYml(Project project) { | ||
projectRepository.template(project, SOURCE, GITHUB_ACTIONS_YML, GITHUB_ACTIONS_FOLDER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to add setup config
See https://github.com/jhipster/jhipster-lite/blob/main/.github/actions/setup/action.yml
You could add the api to one of config, in generate.sh |
I'm changing it to draft, as there are still some work to do |
adds the feature of generation a GitHub Actions YML file to the generated projects see https://github.com/features/actions Fix jhipster#422
3d18e30
to
2f0b2f2
Compare
Hello @pascalgrimaud i've just pushed the changes concerning the reviews you've made me. Concerning the generate.sh i'm unsure how to approach this since I don't think there's any real way of checking generated github-actions files besides visually looking the website itself... If you have any advice LMK :) |
Thanks a lot @Hawkurane About real final tests, I plan to automate a generated project + push to a repository, so it will trigger github actions there :-) |
import tech.jhipster.lite.generator.project.domain.Project; | ||
|
||
public interface GithubActionsService { | ||
void init(Project project); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename to: addGitHubActionsForMaven
public interface GithubActionsService { | ||
void init(Project project); | ||
|
||
void addYmls(Project project); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we need this
|
||
@RestController | ||
@RequestMapping("/api/github-actions/") | ||
@Tag(name = "Github Actions") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tag(name = "Github Actions") | |
@Tag(name = "GitHub Actions") |
this.githubActionsApplicationService = githubActionsApplicationService; | ||
} | ||
|
||
@Operation(summary = "Init Github Actions YML file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Operation(summary = "Init Github Actions YML file") | |
@Operation(summary = "Add GitHub Actions YML files") |
} | ||
|
||
@Operation(summary = "Init Github Actions YML file") | ||
@ApiResponse(responseCode = "500", description = "An error occurred while initializing the github-actions.yml.mustache file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ApiResponse(responseCode = "500", description = "An error occurred while initializing the github-actions.yml.mustache file") | |
@ApiResponse(responseCode = "500", description = "An error occurred while adding GitHub Actions") |
|
||
@Operation(summary = "Init Github Actions YML file") | ||
@ApiResponse(responseCode = "500", description = "An error occurred while initializing the github-actions.yml.mustache file") | ||
@PostMapping("/init") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PostMapping("/init") | |
@PostMapping("/maven") |
@ApiResponse(responseCode = "500", description = "An error occurred while initializing the github-actions.yml.mustache file") | ||
@PostMapping("/init") | ||
@GeneratorStep(id = "github-actions") | ||
public void init(@RequestBody ProjectDTO projectDTO) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename to addGitHubActionsForMaven
, but if you don't like it, simply ignore my comment
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
steps:{{=<% %>=}} | ||
- name: 'Setup: checkout project' | ||
uses: actions/checkout@v2 | ||
- name: 'Setup: environment' | ||
id: setup | ||
uses: ./.github/actions/setup | ||
- name: 'Init: cache local Maven repository' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven-<%={{ }}=%> | ||
- name: 'Test: run tests' | ||
run: | | ||
chmod +x mvnw | ||
./mvnw clean verify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem with indent
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps:{{=<% %>=}} | |
- name: 'Setup: checkout project' | |
uses: actions/checkout@v2 | |
- name: 'Setup: environment' | |
id: setup | |
uses: ./.github/actions/setup | |
- name: 'Init: cache local Maven repository' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven-<%={{ }}=%> | |
- name: 'Test: run tests' | |
run: | | |
chmod +x mvnw | |
./mvnw clean verify | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps:{{=<% %>=}} | |
- name: 'Setup: checkout project' | |
uses: actions/checkout@v2 | |
- name: 'Setup: environment' | |
id: setup | |
uses: ./.github/actions/setup | |
- name: 'Init: cache local Maven repository' | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: 'Test: run tests' | |
run: | | |
chmod +x mvnw | |
./mvnw clean verify |
and your code works well (after fixing the indent): see pascalgrimaud/jhlite-sample-app#1 |
…y projects using maven build-tools
@pascalgrimaud thank you for the review, |
@Hawkurane : I'd prefer to put it in |
Fixes #422
You can do:
POST /api/projects/init
POST /api/github-actions/init