Skip to content
Merged
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
14 changes: 6 additions & 8 deletions .github/workflows/native-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Native build test
name: Native build

on:
workflow_dispatch:
Expand Down Expand Up @@ -43,18 +43,16 @@ jobs:

- name: 'Build Native Image'
run: |
pushd server
mvn -ntp -B --file pom.xml -Pnative package -DskipTests
popd
mvn -ntp -B --file pom.xml -Pnative package -DskipTests -pl server,cli

- name: 'Create distribution'
run: |
pushd server
mvn -ntp -B --file pom.xml -Pdist package -DskipTests
popd
mvn -ntp -B --file pom.xml -Pdist package -DskipTests -pl server,cli

- name: 'Upload build artifact'
uses: actions/upload-artifact@v5
with:
name: power-server-${{ runner.os }}-${{ runner.arch }}
path: server/target/distributions/*.tar.gz
path: |
server/target/distributions/*.tar.gz
cli/target/distributions/*.tar.gz
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ jobs:
- name: 'Set up Java'
uses: actions/setup-java@v5
with:
java-version: 17
java-version: 21
distribution: 'temurin'
cache: maven

- name: 'Release with JReleaser'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -ntp -B --file server/pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release
mvn -ntp -B --file pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release -pl server,cli

- name: 'JReleaser output'
if: always()
Expand Down
55 changes: 54 additions & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<artifactId>power-server-cli</artifactId>
<name>power-server : cli</name>
<description>A CLI command to measure power consumption of the specified process</description>
<properties>
<distribution.directory>${project.build.directory}/distributions</distribution.directory>
<executable-suffix/>
</properties>
<dependencies>
<dependency>
<groupId>net.laprun.sustainability</groupId>
Expand All @@ -33,6 +37,13 @@
</dependencies>

<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>${os-maven-plugin.version}</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
Expand All @@ -43,5 +54,47 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>dist</id>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<executions>
<execution>
<id>make-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>false</attach>
<appendAssemblyId>false</appendAssemblyId>
<finalName>${project.artifactId}-${project.version}-${os.detected.classifier}</finalName>
<outputDirectory>${distribution.directory}</outputDirectory>
<workDirectory>${project.build.directory}/assembly/work</workDirectory>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dist-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<executable-suffix>.exe</executable-suffix>
</properties>
</profile>
</profiles>
</project>
17 changes: 17 additions & 0 deletions cli/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>dist</id>
<formats>
<format>tar.gz</format>
</formats>
<files>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-runner${executable-suffix}
</source>
<outputDirectory>./bin</outputDirectory>
<destName>${project.artifactId}${executable-suffix}</destName>
</file>
</files>
</assembly>
1 change: 0 additions & 1 deletion cli/src/main/java/net/laprun/sustainability/cli/Power.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.laprun.sustainability.cli;

import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

Expand Down
42 changes: 42 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,48 @@
</artifact>
</artifacts>
</power-server>
<power-server-cli>
<name>power-server-cli</name>
<stereotype>CLI</stereotype>
<executable>
<name>power</name>
</executable>
<type>BINARY</type>
<brew>
<active>RELEASE</active>
<multiPlatform>true</multiPlatform>
</brew>
<sdkman>
<active>RELEASE</active>
</sdkman>
<artifacts>
<artifact>
<path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz</path>
<transform>artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.tar.gz</transform>
<platform>linux-x86_64</platform>
</artifact>
<!--<artifact>
<path>
{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip
</path>
<transform>
artifacts/{{distributionName}}-{{projectEffectiveVersion}}-windows-x86_64.zip
</transform>
<platform>windows-x86_64</platform>
</artifact>-->
<artifact>
<path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.tar.gz</path>
<transform>artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-x86_64.tar.gz</transform>
<platform>osx-x86_64</platform>
</artifact>
<artifact>
<path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-aarch_64.tar.gz</path>
<transform>
{{artifactsDir}}/{{distributionName}}-{{projectEffectiveVersion}}-osx-aarch_64.tar.gz</transform>
<platform>osx-aarch_64</platform>
</artifact>
</artifacts>
</power-server-cli>
</distributions>
</jreleaser>
</configuration>
Expand Down
Loading