Skip to content

Commit

Permalink
update pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
hgschmie committed Jan 27, 2024
1 parent 61473a2 commit 49edcb3
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 86 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI build
name: CI Build with tests

on:
push:
Expand All @@ -14,35 +14,33 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
test-java-version: [11, 17, 20]
test-java-version: [11, 17, 21]

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

- uses: actions/setup-java@v3
id: setup_build_jdk
name: Setup Build JDK
- uses: actions/setup-java@v4
id: build_jdk
with:
java-version: 17
java-version: 21
distribution: temurin
cache: maven

- name: Build
- name: build distribution
env:
MAVEN_CONFIG: "-Pfast -Dbasepom.check.skip-enforcer=false -B -fae"
MAVEN_CONFIG: "-Dbasepom.check.skip-enforcer=false -B -fae"
run: |
make install
make install-fast
- uses: actions/setup-java@v3
id: setup_test_jdk
name: Setup Test JDK
- uses: actions/setup-java@v4
id: test_jdk
with:
java-version: ${{ matrix.test-java-version }}
distribution: temurin
cache: maven

- name: Run unit tests
- name: run tests
env:
MAVEN_CONFIG: "-Dbasepom.it.fork-count=1 -B -fae"
MAVEN_CONFIG: "-B -fae"
run: |
make tests
make run-tests
27 changes: 13 additions & 14 deletions .github/workflows/master-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ jobs:
runs-on: ubuntu-latest

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

- name: setup build jdk
uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
java-version: 17
cache: maven
server-id: sonatype-nexus-snapshots
server-username: NEXUS_REPO_USER
Expand All @@ -28,30 +27,30 @@ jobs:
NEXUS_REPO_USER: ${{ secrets.NEXUS_REPO_USER }}
NEXUS_REPO_PASSWORD: ${{ secrets.NEXUS_REPO_PASSWORD }}
MAVEN_CONFIG: "-B -fae"
run: make deploy
run: |
make deploy
site:
runs-on: ubuntu-latest

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

- name: Set git information
- name: configure git user
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git config --global user.name github-cd-action
git config --global user.email github-cd-action@basepom.org
- name: setup build jdk
uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
java-version: 17
cache: maven
server-id: github
server-password: SITE_DEPLOY

- name: deploy documentation
- name: publish docs
env:
SITE_DEPLOY: ${{ secrets.SITE_DEPLOY_TOKEN }}
MAVEN_CONFIG: "-Dbasepom.it.skip=false -Dbasepom.it.fork-count=1 -B -fae"
MAVEN_CONFIG: "-Dbasepom.it.skip=false -B -fae"
run: make deploy-site
33 changes: 33 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Code style analysis

on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main

jobs:
style:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven

- name: run code checkers
env:
MAVEN_CONFIG: "-B -fae"
run: |
make install-notests
113 changes: 57 additions & 56 deletions repack/src/main/java/org/basepom/mojo/repack/RepackMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,160 +60,161 @@ public final class RepackMojo extends AbstractMojo {
private static final PluginLog LOG = new PluginLog(RepackMojo.class);

@Parameter(defaultValue = "${project}", readonly = true, required = true)
public MavenProject project;
MavenProject project;

@Parameter(defaultValue = "${session}", readonly = true, required = true)
public MavenSession session;
MavenSession session;

@Component
public MavenProjectHelper projectHelper;
MavenProjectHelper projectHelper;

/**
* The name of the main class. If not specified the first compiled class found that contains a {@code main} method will be used.
*/
@Parameter(property = "repack.main-class")
public String mainClass = null;
String mainClass = null;

/**
* Collection of artifact definitions to include.
*/
private Set<DependencyDefinition> includedDependencies = ImmutableSet.of();

// called by maven
@Parameter(alias = "includes")
public Set<DependencyDefinition> includedDependencies = ImmutableSet.of();
public void setIncludedDependencies(final String... includedDependencies) {
checkNotNull(includedDependencies, "includedDependencies is null");

this.includedDependencies = Arrays.stream(includedDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

/**
* Collection of artifact definitions to exclude.
*/
private Set<DependencyDefinition> excludedDependencies = ImmutableSet.of();

// called by maven
@Parameter(alias = "excludedDependencies")
public Set<DependencyDefinition> excludedDependencies = ImmutableSet.of();
public void setExcludedDependencies(final String... excludedDependencies) {
checkNotNull(excludedDependencies, "excludedDependencies is null");

this.excludedDependencies = Arrays.stream(excludedDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

/**
* Include system scoped dependencies.
*/
@Parameter(defaultValue = "false", property = "repack.include-system-scope")
public boolean includeSystemScope = false;
boolean includeSystemScope = false;

/**
* Include provided scoped dependencies.
*/
@Parameter(defaultValue = "false", property = "repack.include-provided-scope")
public boolean includeProvidedScope = false;
boolean includeProvidedScope = false;

/**
* Include optional dependencies
*/
@Parameter(defaultValue = "false", property = "repack.include-optional")
public boolean includeOptional = false;
boolean includeOptional = false;

/**
* Directory containing the generated archive.
*/
@Parameter(defaultValue = "${project.build.directory}", property = "repack.output-directory")
public File outputDirectory;
File outputDirectory;

/**
* Name of the generated archive.
*/
@Parameter(defaultValue = "${project.build.finalName}", property = "repack.final-name")
public String finalName;
String finalName;

/**
* Skip the execution.
*/
@Parameter(defaultValue = "false", property = "repack.skip")
public boolean skip = false;
boolean skip = false;

/**
* Silence all non-output and non-error messages.
*/
@Parameter(defaultValue = "false", property = "repack.quiet")
public boolean quiet = false;
boolean quiet = false;

/**
* Do a summary report.
*/
@Parameter(defaultValue = "true", property = "repack.report")
public boolean report = true;
boolean report = true;

/**
* Classifier to add to the repacked archive. Use the blank string to replace the main artifact.
*/
@Parameter(defaultValue = "repacked", property = "repack.classifier")
public String repackClassifier = "repacked";
String repackClassifier = "repacked";

/**
* Attach the repacked archive to the build cycle.
*/
@Parameter(defaultValue = "true", property = "repack.attach-artifact")
public boolean attachRepackedArtifact = true;
boolean attachRepackedArtifact = true;

/**
* A list of the libraries that must be unpacked at runtime (do not work within the fat jar).
*/
private Set<DependencyDefinition> runtimeUnpackedDependencies = ImmutableSet.of();

// called by maven
@Parameter
public Set<DependencyDefinition> runtimeUnpackedDependencies = ImmutableSet.of();
public void setRuntimeUnpackedDependencies(final String... runtimeUnpackedDependencies) {
checkNotNull(runtimeUnpackedDependencies, "runtimeUnpackDependencies is null");

this.runtimeUnpackedDependencies = Arrays.stream(runtimeUnpackedDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

/**
* A list of optional libraries that should be included even if optional dependencies are not included by default.
*/
private Set<DependencyDefinition> optionalDependencies = ImmutableSet.of();

// called by maven
@Parameter
public Set<DependencyDefinition> optionalDependencies = ImmutableSet.of();
public void setOptionalDependencies(final String... optionalDependencies) {
checkNotNull(optionalDependencies, "optionalDependencies is null");

this.optionalDependencies = Arrays.stream(optionalDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

/**
* Timestamp for reproducible output archive entries, either formatted as ISO 8601 (<code>yyyy-MM-dd'T'HH:mm:ssXXX</code>) or an {@code int} representing
* seconds since the epoch.
*/
@Parameter(defaultValue = "${project.build.outputTimestamp}", property = "repack.output-timestamp")
public String outputTimestamp;
String outputTimestamp;

/**
* The type of archive (which corresponds to how the dependencies are laid out inside it). Possible values are {@code JAR}, {@code WAR}, {@code ZIP},
* {@code DIR}, {@code NONE}. Defaults to {@code JAR}.
*/
@Parameter(defaultValue = "JAR", property = "repack.layout")
public LayoutType layout = LayoutType.JAR;
LayoutType layout = LayoutType.JAR;

/**
* The layout factory that will be used to create the executable archive if no explicit layout is set. Alternative layouts implementations can be provided
* by 3rd parties.
*/
@Parameter
public LayoutFactory layoutFactory = null;
LayoutFactory layoutFactory = null;

// called by maven
public void setIncludedDependencies(final String... includedDependencies) {
checkNotNull(includedDependencies, "includedDependencies is null");

this.includedDependencies = Arrays.stream(includedDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

// called by maven
public void setExcludedDependencies(final String... excludedDependencies) {
checkNotNull(excludedDependencies, "excludedDependencies is null");

this.excludedDependencies = Arrays.stream(excludedDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

// called by maven
public void setRuntimeUnpackedDependencies(final String... runtimeUnpackedDependencies) {
checkNotNull(runtimeUnpackedDependencies, "runtimeUnpackDependencies is null");

this.runtimeUnpackedDependencies = Arrays.stream(runtimeUnpackedDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

// called by maven
public void setOptionalDependencies(final String... optionalDependencies) {
checkNotNull(optionalDependencies, "optionalDependencies is null");

this.optionalDependencies = Arrays.stream(optionalDependencies)
.map(DependencyDefinition::new)
.collect(toImmutableSet());
}

@Override
public void execute() throws MojoExecutionException {
Expand Down

0 comments on commit 49edcb3

Please sign in to comment.