Compile another repo with maven as part of workflow

In our company we have the dev project repos, and an automation repo that includes all our automated test suites, which depends on several external tools such as Appium, TestNG, Node and permissions for several internal endpoints. We want to run those tests as the CI for different dev repos. We’ll need to use a self-hosted runner that we’ll install all those dependencies on. Then, we’ll need to run a parameterized maven compile test command that will build and run the automation repo whenever a pull request is made to one of the dev repos.

My question is - is that possible to do with GitHub Actions alone? Is it possible to get the “status” of the tests of the automation repo directly from the dev repo workflow right after running it?

Hi @nadavinvesting
Yes, you can use GitHub Action to achieve this. Detail steps:

1 Use pull request GitHub event that triggers the dev repo workflow. Such as:

on:
  pull_request:

If you have multiple dev repos, you need to set this workflow for each repos.

2 Check out the additional Maven project to a custom working directory by using Checkout V2 action. Such as:

    - name: checkout Maven project
      uses: actions/checkout@v2
      with:
        repository: NicoNBW/mavenProject
        path: my-maven-Project 

If you want to checkout the different repository that is private you will need to provide your own PAT.

3 Switch to this working directory and run the maven compile test command. Such as:

- name: run maven compile test command
      working-directory: my-maven-Project/maven-unit-test
      run: mvn -Dtest=TestMessageBuilder test

4 Adding a status badge in the README.md file of your dev repo will show the “status” of the tests of the automation repo directly.

The simple example running on hosted runner for reference: https://github.com/NicoNBW/devProject