Skip to content

Commit

Permalink
Fixing build for Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rooije committed Apr 9, 2024
1 parent 00847cf commit fef7c02
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 75 deletions.
Empty file modified gradlew
100644 → 100755
Empty file.
33 changes: 5 additions & 28 deletions mydeltares-keycloak-spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
testImplementation('org.apache.httpcomponents:httpmime:4.5.14')

testImplementation('org.junit.jupiter:junit-jupiter:5.9.1')
implementation platform('org.testcontainers:testcontainers-bom:1.19.3') //import bom
implementation platform('org.testcontainers:testcontainers-bom:1.19.1') //import bom
testImplementation('org.testcontainers:mysql') //no version specified
testImplementation('org.junit.platform:junit-platform-suite-engine')

Expand All @@ -53,41 +53,18 @@ jar {
from { configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) } }
}

tasks.register('copyJarsToDocker', Copy) {

if (file('build/libs/mydeltares-keycloak-spi-3.0.jar').exists()){
println('File exists during configuration')
} else {
println('File does not exist during configuration')
}

copy {
println('Copying jars to docker')
from('build/libs/')
into( '../docker/keycloak/providers/')
}
}

tasks.register('copyJarsToLiferay', Copy) {

if (file('build/libs/mydeltares-keycloak-theme-3.0.jar').exists()){
println('File exists during configuration')
} else {
println('File does not exist during configuration')
}

tasks.register('copyJarsToDocker', Task) {
println('Copying jars to docker')
copy {
println('Copying jars to docker')
from('build/libs/')
into( liferayDockerPath)
into(liferayDockerPath + '/docker/keycloak/providers/')
}

}

jar {
println('Configuring build step')
doLast {
println('Running last step: copyJarsToDocker')
tasks.copyJarsToDocker
copyJarsToDocker
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package nl.deltares.keycloak;

import nl.deltares.keycloak.utils.KeycloakTestServer;
import org.junit.BeforeClass;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

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

@SelectPackages({"nl.deltares.keycloak"})
@IncludeTags("IntegrationTestCategory")
Expand All @@ -25,22 +24,10 @@ public static void startKeyCloak() throws Throwable {
final File testResources = Paths.get( "src", "test", "resources", "docker").toFile();
final File buildLibs = Paths.get( "build", "libs").toFile();

File keycloakTmpDir = Files.createTempDirectory("keycloak").toFile();
Files.copy(new File(buildLibs, "mydeltares-keycloak-spi-3.0.jar").toPath(),
new File(testResources, "/keycloak/providers/mydeltares-keycloak-spi-3.0.jar").toPath(), StandardCopyOption.REPLACE_EXISTING);

File dataDir = new File(keycloakTmpDir, "keycloak/data/import");
dataDir.mkdirs();
File configDir = new File(keycloakTmpDir, "keycloak/conf");
configDir.mkdir();
File deploymentDir = new File(keycloakTmpDir, "keycloak/providers");
deploymentDir.mkdir();

Files.copy(new File(testResources, "docker-compose.yml").toPath(), new File(keycloakTmpDir, "docker-compose.yml").toPath());
Files.copy(new File(testResources, "keycloak/data/import/realm-export.json").toPath(), new File(dataDir, "realm-export.json").toPath());
Files.copy(new File(testResources, "keycloak/conf/keycloak.conf").toPath(), new File(configDir, "keycloak.conf").toPath());
Files.copy(new File(buildLibs, "mydeltares-keycloak-spi-3.0.jar").toPath(), new File(deploymentDir, "mydeltares-keycloak-spi-3.0.jar").toPath());
// Files.copy(new File(testResources, "keycloak/providers/mydeltares-keycloak-theme-3.0.jar").toPath(), new File(deploymentDir, "mydeltares-keycloak-theme-3.0.jar").toPath());

KeycloakTestServer.startKeycloak(keycloakTmpDir.getPath());
KeycloakTestServer.startKeycloak(testResources.getPath());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
- keycloak

keycloak:
image: quay.io/keycloak/keycloak:23.0.0
image: quay.io/keycloak/keycloak:24.0.1
ports:
- 8080:8080
- 8787:8787
Expand Down
33 changes: 4 additions & 29 deletions mydeltares-keycloak-theme/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,18 @@ test {
useJUnitPlatform()
}

tasks.register('copyJarsToDocker', Copy) {

if (file('build/libs/mydeltares-keycloak-theme-3.0.jar').exists()){
println('File exists during configuration')
} else {
println('File does not exist during configuration')
}

copy {
println('Copying jars to docker')
from('build/libs/')
into( '../docker/keycloak/providers/')

}

}

tasks.register('copyJarsToLiferay', Copy) {

if (file('build/libs/mydeltares-keycloak-theme-3.0.jar').exists()){
println('File exists during configuration')
} else {
println('File does not exist during configuration')
}

tasks.register("copyJarsToDocker", Task) {
println('Copying jars to docker')
copy {
println('Copying jars to docker')
from('build/libs/')
into( liferayDockerPath)
into(liferayDockerPath + '/docker/keycloak/providers/')
}

}

jar {
println('Configuring build step')
doLast {
println('Running last step: copyJarsToDocker')
tasks.copyJarsToDocker
copyJarsToDocker
}
}

0 comments on commit fef7c02

Please sign in to comment.