Skip to content

Commit

Permalink
[GHA] Add workflow for Pull Request
Browse files Browse the repository at this point in the history
This new workflow would build the new project as well as running SpotBugs (from maven plugin) and display review at the end of the workflow
- Related #123
  • Loading branch information
RoiArthurB committed Apr 23, 2024
1 parent e343bc7 commit ea3e360
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/travis-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
required: false
IS_STABLE_RELEASE:
type: boolean
RUN_SPOTBUGS:
required: false
default: false
type: boolean
secrets:
GAMA_KEYSTORE_BASE64:
required: false
Expand Down Expand Up @@ -97,6 +101,26 @@ jobs:
- name: Compiling gama
run: bash $GITHUB_WORKSPACE/travis/build.sh -e -B ${{ inputs.mvn_extra_arguments }}

# Spotbugs
- name: Running SpotBugs
if: "${{ inputs.RUN_SPOTBUGS }}"
run: |
cd ${{ github.workspace }}/gama.annotations
mvn verify spotbugs:spotbugs
cd ${{ github.workspace }}/gama.processor
mvn verify spotbugs:spotbugs
cd ${{ github.workspace }}/gama.parent
- uses: actions/upload-artifact@v4
if: "${{ inputs.RUN_SPOTBUGS }}"
with:
name: result-spotbugs
if-no-files-found: error
compression-level: 9
overwrite: true
path: |
${{ github.workspace }}/**/spotbugsXml.xml
- name: Install SSH key
# Consider it's a release and want to update p2 site for it
if: "${{ inputs.get_all_archives_for_release }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger-compilation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

jobs:

ci-handler:
ci-release:
if: ${{ contains(github.event.head_commit.message, 'ci release') }}
runs-on: ubuntu-latest
steps:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/trigger-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: "Pull Request validation"

on:
# Triggers the workflow on pull request events
pull_request:
workflow_dispatch: # For manual trigger

jobs:

compiling-gama:
name: Compiling GAMA
uses: ./.github/workflows/travis-build.yaml
with:
get_testing_compiled_archives: false
get_all_archives_for_release: false
RUN_SPOTBUGS: true

spotbugs-result:
name: Display Spotbugs results
runs-on: ubuntu-latest
needs: compiling-gama
steps:
- uses: actions/download-artifact@v4
with:
name: result-spotbugs

- name: Display structure of downloaded files
run: ls -lahR

- uses: jwgmeligmeyling/spotbugs-github-action@master
with:
path: '**/spotbugsXml.xml'
20 changes: 16 additions & 4 deletions gama.annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@
<!-- <plugins combine.self="override"> -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.plugins.version}</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.plugins.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
Expand All @@ -154,7 +154,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
Expand Down Expand Up @@ -187,6 +187,18 @@
<version>${tycho.version}</version>
</plugin>

<!-- Code Review for PR
Execute by running `mvn -B verify spotbugs:spotbugs` -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.4.0</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
</configuration>
</plugin>

</plugins>
</build>
<packaging>eclipse-plugin</packaging>
Expand Down
12 changes: 12 additions & 0 deletions gama.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,18 @@
</filesets>
</configuration>
</plugin>

<!-- Code Review for PR
Execute by running `mvn -B verify spotbugs:spotbugs` -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.4.0</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>

<pluginManagement>
Expand Down
12 changes: 12 additions & 0 deletions gama.processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
</plugin>

<!-- Code Review for PR
Execute by running `mvn -B verify spotbugs:spotbugs` -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.4.0</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
<packaging>eclipse-plugin</packaging>
Expand Down

0 comments on commit ea3e360

Please sign in to comment.