Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/flakeFinder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
--out-dir "failed_tests/"
env:
AWS_REGION: us-west-2
GIT_BRANCH: main
- name: Upload Errors
uses: actions/upload-artifact@v4
with:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
os: [ubuntu-latest, windows-latest]
fail-fast: false
name: Build on ${{ matrix.os }}
env:
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -44,9 +46,16 @@ jobs:
env:
AWS_REGION: us-west-2
run: |
sudo -E mvn -ntp -U verify
sudo -E mvn -ntp -U verify
sudo chown -R runner target
if: matrix.os == 'ubuntu-latest'
- name: Show file
run: |
sudo cat target/git.properties
git branch --show-current
git rev-parse --abbrev-ref HEAD
git symbolic-ref --short HEAD
if: matrix.os == 'ubuntu-latest' && failure()
- name: Upload Failed Test Report
uses: actions/upload-artifact@v4
if: failure()
Expand All @@ -68,8 +77,7 @@ jobs:
run: python3 .github/scripts/cover2cover.py target/jacoco-report/jacoco-it/jacoco.xml src/main/java > target/jacoco-report/cobertura-it.xml
if: matrix.os == 'ubuntu-latest'
- name: Check compatibility
run: >-
mvn -ntp japicmp:cmp -DskipTests
run: mvn -ntp initialize japicmp:cmp -DskipTests
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
- name: Upload Compatibility Report
uses: actions/upload-artifact@v4
Expand Down
169 changes: 169 additions & 0 deletions nucleus-build-version.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Maven POM for generating Git-based version properties for Greengrass Nucleus -->
<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
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aws.greengrass</groupId>
<artifactId>nucleus-build-version</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>

<build>
<plugins>
<!-- Extract Git information and write to properties file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Get current Git branch name -->
<execution>
<id>set-git-branch-info</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Load environment variables -->
<property environment="env"/>
<exec executable="git" outputproperty="git.branch">
<arg value="branch"/>
<arg value="--show-current"/>
</exec>
<!-- Use env var iff git.branch is empty and env var is set. Otherwise, use default -->
<condition property="git.branch" value="${env.GIT_BRANCH}" else="dev">
<and>
<isset property="git.branch"/>
<not><equals arg1="${git.branch}" arg2=""/></not>

<isset property="env.GIT_BRANCH"/>
<not><equals arg1="${env.GIT_BRANCH}" arg2=""/></not>
</and>
</condition>
<echo file="${project.build.directory}/git.properties" append="true">git.branch=${git.branch}${line.separator}</echo>
</target>
</configuration>
</execution>
<!-- Get latest Git tag for version determination -->
<execution>
<id>set-git-latest-tag-info</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- Get the most recent tag sorted by version -->
<exec executable="git" outputproperty="git.latest.tag">
<arg value="for-each-ref"/>
<arg value="--count=1"/>
<arg value="--sort=-version:refname"/>
<arg value="--format=%(refname:short)"/>
<arg value="refs/tags"/>
</exec>
<!-- Write latest tag to git.properties file -->
<echo file="${project.build.directory}/git.properties" append="true">git.latest.tag=${git.latest.tag}${line.separator}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>

<!-- Load the generated Git properties into Maven properties -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<!-- Read the git.properties file created above -->
<file>${project.build.directory}/git.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>

<!-- Process version strings using regex transformations -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.1</version>
<executions>
<!-- Check if current branch is a release branch -->
<execution>
<id>process-release-branch-info</id>
<phase>initialize</phase>
<goals><goal>regex-property</goal></goals>
<configuration>
<name>release.branch.match</name>
<value>${git.branch}</value>
<!-- Match release_MAJOR.MINOR.x pattern and extract version -->
<regex>^release_(\d+\.\d+)\.x$</regex>
<!-- Transform release_MAJOR.MINOR.x to MAJOR.MINOR.0 -->
<replacement>$1.0</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
<!-- Set final branch version (dev for non-release branches) -->
<execution>
<id>process-non-release-branch-info</id>
<phase>initialize</phase>
<goals><goal>regex-property</goal></goals>
<configuration>
<name>git.current.branch.snapshot</name>
<value>${release.branch.match}</value>
<!-- Default to 'dev' if not a release branch -->
<regex>^${git.branch}$</regex>
<replacement>dev</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
<!-- Convert latest tag to SNAPSHOT version format -->
<execution>
<id>process-latest-tag-info</id>
<phase>initialize</phase>
<goals><goal>regex-property</goal></goals>
<configuration>
<name>git.latest.tag.snapshot</name>
<value>${git.latest.tag}</value>
<!-- Transform vMAJOR.MINOR.PATCH to MAJOR.MINOR.0-SNAPSHOT -->
<regex>^v?(\d+)\.(\d+)\.\d+.*$</regex>
<replacement>$1.$2.0-SNAPSHOT</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>

<!-- Write final git.current.branch.snapshot version information -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>set-build-snapshot-version</id>
<phase>compile</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<!-- Append final branch snapshot version to properties -->
<echo file="${project.build.directory}/git.properties" append="true">git.current.branch.snapshot=${git.current.branch.snapshot}${line.separator}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
20 changes: 13 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.aws.greengrass</groupId>
<artifactId>nucleus</artifactId>
<version>2.15.0-SNAPSHOT</version>
<version>${git.current.branch.snapshot}-SNAPSHOT</version>
<packaging>jar</packaging>

<licenses>
Expand Down Expand Up @@ -204,9 +204,9 @@
<version>1.11</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>6.4.4</version>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>6.4.4</version>
</dependency>

<!-- zeroturnaround brings in an older version jna which tries to load msvcr100.dll. msvcr100.dll is not shipped
Expand Down Expand Up @@ -308,7 +308,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${lastVersion}</version>
<version>${git.latest.tag.snapshot}</version>
<type>${project.packaging}</type>
</dependency>
</oldVersion>
Expand Down Expand Up @@ -856,9 +856,8 @@
<maven.compiler.useIncrementalCompilation>false</maven.compiler.useIncrementalCompilation>
<skipTests>false</skipTests>
<excludedGroups>E2E,E2E-INTRUSIVE</excludedGroups>
<groups></groups>
<greengrassjar.name>Greengrass</greengrassjar.name>
<lastVersion>2.14.0-SNAPSHOT</lastVersion>
<git.current.branch.snapshot>dev</git.current.branch.snapshot>
</properties>
<distributionManagement>
<snapshotRepository>
Expand All @@ -868,4 +867,11 @@
</snapshotRepository>
</distributionManagement>
<name>greengrass-nucleus</name>
<!-- Get build and latest tag snapshot versions properties using git repo details -->
<parent>
<groupId>com.aws.greengrass</groupId>
<artifactId>nucleus-build-version</artifactId>
<version>1.0.0</version>
<relativePath>nucleus-build-version.xml</relativePath>
</parent>
</project>
23 changes: 21 additions & 2 deletions src/test/greengrass-nucleus-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.aws.greengrass</groupId>
<artifactId>greengrass-nucleus-benchmark</artifactId>
<version>2.15.0-SNAPSHOT</version>
<version>${git.current.branch.snapshot}-SNAPSHOT</version>
<packaging>jar</packaging>

<name>JMH benchmark sample: Java</name>
Expand Down Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.aws.greengrass</groupId>
<artifactId>nucleus</artifactId>
<version>2.15.0-SNAPSHOT</version>
<version>${git.current.branch.snapshot}-SNAPSHOT</version>
</dependency>
</dependencies>

Expand All @@ -79,6 +79,25 @@

<build>
<plugins>
<!-- Read git info from the nucleus project build folder -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>../../../target/git.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Loading