Skip to content
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

fix(packaging): move to net.laprun.sustainability package / group id #50

Merged
merged 5 commits into from
Apr 2, 2024
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
39 changes: 17 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Quarkiverse Release
name: Release

on:
pull_request:
types: [closed]
types: [ closed ]
paths:
- '.github/project.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

defaults:
Expand All @@ -17,7 +17,7 @@ defaults:
jobs:
release:
runs-on: ubuntu-latest
name: release
name: Maven release
if: ${{github.event.pull_request.merged == true}}

steps:
Expand All @@ -28,24 +28,18 @@ jobs:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
- uses: actions/setup-java@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
distribution: 'temurin'
java-version: 17
cache: 'maven'
server-id: ossrh
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Configure Git author
run: |
Expand All @@ -62,13 +56,14 @@ jobs:

- name: Maven release ${{steps.metadata.outputs.current-version}}
run: |
mvn -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
mvn -B release:perform -Darguments=-DperformRelease -DperformRelease -Prelease
mvn -B release:prepare -Prelease -Darguments="-DskipTests" -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
mvn -B release:perform -Darguments="-DperformRelease -DskipTests" -DperformRelease -Prelease
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_USERNAME: "${{ secrets.OSSRH_USERNAME }}"
MAVEN_PASSWORD: "${{ secrets.OSSRH_TOKEN }}"
MAVEN_GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"

- name: Push changes to ${{github.base_ref}} branch
run: |
git push
git push origin ${{steps.metadata.outputs.current-version}}
git push origin ${{steps.metadata.outputs.current-version}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To use the extension:
your application:
```xml
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability.power.quarkus</groupId>
<artifactId>quarkus-power</artifactId>
<version>${project.version}</version>
</dependency>
Expand Down
428 changes: 428 additions & 0 deletions contributing/eclipse-format.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions contributing/eclipse.importorder
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Organize Import Order
#Wed Jan 23 12:03:29 AEDT 2019
0=java
1=javax
2=jakarta
3=org
4=com
4 changes: 2 additions & 2 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -23,7 +23,7 @@
<artifactId>quarkus-rest-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power</artifactId>
<version>${project.version}</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import io.quarkiverse.power.deployment.devui.commands.PowerCommands;
import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ConsoleCommandBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import net.laprun.sustainability.power.quarkus.deployment.devui.commands.PowerCommands;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;

class PowerProcessor {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package io.quarkiverse.power.deployment.devui.commands;
package net.laprun.sustainability.power.quarkus.deployment.devui.commands;

import java.util.List;

import org.aesh.command.*;
import org.aesh.command.Command;
import org.aesh.command.CommandResult;
import org.aesh.command.GroupCommand;
import org.aesh.command.GroupCommandDefinition;
import org.aesh.command.invocation.CommandInvocation;

import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkiverse.power.runtime.SensorMeasure;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;

@GroupCommandDefinition(name = "power", description = "Power consumption commands", generateHelp = true)
@SuppressWarnings("rawtypes")
public class PowerCommands implements GroupCommand {
private final PowerMeasurer<? extends SensorMeasure> sensor;
private final PowerMeasurer sensor;

public PowerCommands(PowerMeasurer<? extends SensorMeasure> sensor) {
public PowerCommands(PowerMeasurer sensor) {
this.sensor = sensor;
}

Expand All @@ -23,7 +25,7 @@ public List<Command> getCommands() {
}

@Override
public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
public CommandResult execute(CommandInvocation commandInvocation) {
commandInvocation.println(commandInvocation.getHelpInfo());
return CommandResult.SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package io.quarkiverse.power.deployment.devui.commands;
package net.laprun.sustainability.power.quarkus.deployment.devui.commands;

import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.option.Option;

import io.quarkiverse.power.runtime.PowerMeasure;
import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkiverse.power.runtime.SensorMeasure;
import io.quarkus.deployment.console.QuarkusCommand;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasure;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;

@CommandDefinition(name = "start", description = "Starts measuring power consumption of the current application")
public class StartCommand extends QuarkusCommand {
private final PowerMeasurer<? extends SensorMeasure> sensor;
private final PowerMeasurer sensor;
private PowerMeasure baseline;

@Option(name = "stopAfter", shortName = 's', description = "Automatically stop the measures after the specified duration in seconds", defaultValue = "-1")
Expand All @@ -21,7 +20,7 @@ public class StartCommand extends QuarkusCommand {
@Option(name = "frequency", shortName = 'f', description = "The frequency at which measurements should be taken, in milliseconds", defaultValue = "1000")
private long frequency;

public StartCommand(PowerMeasurer<? extends SensorMeasure> sensor) {
public StartCommand(PowerMeasurer sensor) {
this.sensor = sensor;
}

Expand All @@ -41,10 +40,7 @@ public CommandResult doExecute(CommandInvocation commandInvocation) {
commandInvocation.println("Establishing baseline for 30s, please do not use your application until done.");
commandInvocation.println("Power measurement will start as configured after this initial measure is done.");
sensor.start(30, 1000);
sensor.onError(e -> {
commandInvocation.println("An error occurred: " + e.getMessage());
e.printStackTrace();
});
sensor.onError(e -> commandInvocation.println("An error occurred: " + e.getMessage()));
sensor.onCompleted((m) -> {
baseline = m;
outputConsumptionSinceStarted(baseline, commandInvocation, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package io.quarkiverse.power.deployment.devui.commands;
package net.laprun.sustainability.power.quarkus.deployment.devui.commands;

import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandResult;
import org.aesh.command.invocation.CommandInvocation;

import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkiverse.power.runtime.SensorMeasure;
import io.quarkus.deployment.console.QuarkusCommand;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;

@CommandDefinition(name = "stop", description = "Stops power measurement and outputs accumulated power since measures were started")
public class StopCommand extends QuarkusCommand {

private final PowerMeasurer<? extends SensorMeasure> sensor;
private final PowerMeasurer sensor;

public StopCommand(PowerMeasurer<? extends SensorMeasure> sensor) {
public StopCommand(PowerMeasurer sensor) {
this.sensor = sensor;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -7,11 +7,11 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkiverse.power.runtime.PowerMeasurer;
import io.quarkiverse.power.runtime.ServerSampler;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
import net.laprun.sustainability.power.PowerResource;
import net.laprun.sustainability.power.quarkus.runtime.PowerMeasurer;
import net.laprun.sustainability.power.quarkus.runtime.ServerSampler;

public class PowerMeasurerTest {
@TestHTTPResource
Expand All @@ -22,12 +22,10 @@ public class PowerMeasurerTest {
.withApplicationRoot((jar) -> jar.addClasses(PowerResource.class, TestPowerMeasurer.class, TestPowerSensor.class));

@Test
void startShouldAccumulateOverSpecifiedDurationAndStop() throws Exception {
final var measurer = new PowerMeasurer<>(new ServerSampler(uri));
void startShouldAccumulateOverSpecifiedDurationAndStop() {
final var measurer = new PowerMeasurer(new ServerSampler(uri));

measurer.start(1, 100);
measurer.onCompleted(measure -> {
assertEquals(10, measure.numberOfSamples());
});
measurer.onCompleted(measure -> assertEquals(10, measure.numberOfSamples()));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import io.quarkus.test.Mock;
import net.laprun.sustainability.power.PowerMeasurer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.deployment;
package net.laprun.sustainability.power.quarkus.deployment;

import io.quarkus.test.Mock;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.test;
package net.laprun.sustainability.power.quarkus.test;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.test;
package net.laprun.sustainability.power.quarkus.test;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ TIP: Describe what the extension does here.

== Installation

If you want to use this extension, you need to add the `io.quarkiverse.power:quarkus-power` extension first to your build file.
If you want to use this extension, you need to add the `net.laprun.sustainability:quarkus-power` extension first to your build file.

For instance, with Maven, add the following dependency to your POM file:

[source,xml,subs=attributes+]
----
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power</artifactId>
<version>{project-version}</version>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand All @@ -18,9 +18,9 @@
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power</artifactId>
<version>${project.version}</version>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.quarkiverse.power.it;
package net.laprun.sustainability.power.quarkus.it;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.GET;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.it;
package net.laprun.sustainability.power.quarkus.it;

import io.quarkus.test.junit.QuarkusIntegrationTest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkiverse.power.it;
package net.laprun.sustainability.power.quarkus.it;

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.is;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>quarkiverse-parent</artifactId>
<version>16</version>
</parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.power</groupId>
<groupId>net.laprun.sustainability</groupId>
<artifactId>quarkus-power-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.quarkiverse.power.runtime;
package net.laprun.sustainability.power.quarkus.runtime;

import java.util.List;

import net.laprun.sustainability.power.SensorMetadata;

abstract class AbstractPowerMeasure implements PowerMeasure {
private final SensorMetadata sensorMetadata;
private final List<double[]> measures;
Expand Down
Loading
Loading