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

parallel_iocs #175

Merged
merged 2 commits into from
Jan 10, 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: 39 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
RELEASE_NOTES
bin/
stage/
.DS_Store
*.swp
/mts

.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Eclipse settings
.settings

# vscode settings
.vscode

# Integration tests folders
tomcat_*

# War files
wars
2 changes: 1 addition & 1 deletion .github/workflows/ant.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Ant
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-ant

name: Java CI
name: Ant build

on:
push:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Docker Run Integration Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

permissions:
contents: read
checks: write

jobs:
epicstests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Create Build Reports Folder
run: mkdir -p build/reports/tests
- name: Build and push
uses: docker/build-push-action@v4
with:
file: docker/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run tests with docker compose
run: docker compose -f docker/docker-compose.epicsTests.yml run epicsarchiver-test
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/epicsTests/TEST-*.xml'
- name: Upload build reports
if: always()
uses: actions/upload-artifact@v3
with:
name: build-reports
path: build/reports/
4 changes: 3 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle
name: Gradle build and test

on:
push:
Expand All @@ -15,6 +15,7 @@ on:

permissions:
contents: read
checks: write

jobs:
build:
Expand All @@ -24,6 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ gradle-app.setting
.vscode

# Integration tests folders
tomcat_*
tomcat_*

# War files
wars
115 changes: 59 additions & 56 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ java {
}

version gitVersion()
def stageDir = layout.projectDir.file("stage")
def warDir = layout.projectDir.file("build")
def srcDir = layout.projectDir.file("src/main")
def libDir = layout.projectDir.file("lib")
def stageDir = layout.projectDirectory.file("build/stage")
def srcDir = layout.projectDirectory.file("src/main")
def libDir = layout.projectDirectory.file("lib")
def apiDocsDir = layout.projectDirectory.file("docs/api")
def archapplsite = System.getenv("ARCHAPPL_SITEID") ?: "tests"


Expand Down Expand Up @@ -108,36 +108,21 @@ dependencies {
implementation("org.phoebus:core-pva:4.7.2")
}

tasks.register("cleanWars", Delete) {
tasks.register("cleanApiDocs", Delete) {
group = "Clean"
description = "Remove any war files created, and the staging directory"
delete file(stageDir)
delete file("${warDir}/retrieval.war")
delete file("${warDir}/engine.war")
delete file("${warDir}/etl.war")
delete file("${warDir}/mgmt.war")
delete file("${warDir}/archappl_v${version}.tar.gz")
delete file("RELEASE_NOTES")
description = "Remove the generated java api docs."
delete file(apiDocsDir)
}

Collection getListOfFolders(String dir, String pattern) {
file(dir).listFiles({ file -> !file.isFile() && file.name ==~ pattern } as FileFilter)
}

tasks.register("cleanTestData", Delete) {
group = "Clean"
description = "Remove any integration test folders created, and the staging directory"
delete getListOfFolders("./", /tomcat_*/)
}
clean.dependsOn("cleanTestData")
clean.dependsOn "cleanWars"
clean.dependsOn("cleanApiDocs")

tasks.register("generateBPLActionsMappings", JavaExec) {
group = "Documentation"
description = "Generates the rest api documentation."
it.outputs.file("${apiDocsDir}/mgmtpathmappings.txt")
doFirst {
mkdir "docs/api"
standardOutput new FileOutputStream("${projectDir}/docs/api/mgmtpathmappings.txt")
mkdir apiDocsDir
standardOutput = new FileOutputStream("${apiDocsDir}/mgmtpathmappings.txt")
}
mainClass = "org.epics.archiverappliance.mgmt.BPLServlet"

Expand All @@ -146,8 +131,10 @@ tasks.register("generateBPLActionsMappings", JavaExec) {

tasks.register("generateJavaDocTagletScriptables", JavaExec) {
group = "Documentation"
dependsOn "generateBPLActionsMappings"
mainClass = "org.epics.archiverappliance.common.taglets.ProcessMgmtScriptables"

it.inputs.file("${apiDocsDir}/mgmt_scriptables.txt")
it.outputs.file("${apiDocsDir}/mgmt_scriptables.html")
classpath = sourceSets.main.runtimeClasspath
workingDir = project.projectDir
}
Expand All @@ -159,10 +146,11 @@ javadoc {
doFirst {
copy {
from layout.projectDirectory.file("LICENSE"),
file("${srcDir}/main/edu/stanford/slac/archiverappliance/PB/EPICSEvent.proto")
file("${srcDir}/edu/stanford/slac/archiverappliance/PB/EPICSEvent.proto")
into layout.projectDirectory.dir("docs")
}
}
it.outputs.file("${apiDocsDir}/mgmt_scriptables.txt")
source = sourceSets.main.allJava
failOnError = false
options {
Expand All @@ -182,8 +170,8 @@ tasks.register("syncStaticContentHeaderFooters", JavaExec) {
group = "Staging"
dependsOn "compileJava"
mainClass = "org.epics.archiverappliance.mgmt.bpl.SyncStaticContentHeadersFooters"
args "${srcDir}/main/org/epics/archiverappliance/mgmt/staticcontent/index.html",
"${srcDir}/main/org/epics/archiverappliance/mgmt/staticcontent/"
args "${srcDir}/org/epics/archiverappliance/mgmt/staticcontent/index.html",
"${srcDir}/org/epics/archiverappliance/mgmt/staticcontent/"

classpath = sourceSets.main.runtimeClasspath
}
Expand All @@ -206,9 +194,14 @@ tasks.register("zipSvgViewer", Zip) {
tasks.register("stage") {
group = "Staging"
description = "Copy static content from each of the projects into the staging directory."
dependsOn javadoc
finalizedBy "zipSvgViewer"
mkdir stageDir

copy {
from "${docsDir}/*.*"
into apiDocsDir
}
copy {
from file("${srcDir}/org/epics/archiverappliance/staticcontent")
into file("${stageDir}/org/epics/archiverappliance/staticcontent")
Expand All @@ -227,8 +220,9 @@ tasks.register("stage") {
tasks.register("generateReleaseNotes", Exec) {
group = "Staging"
description = "Generate the Release Notes."
it.outputs.file("${stageDir}/RELEASE_NOTES")
doFirst {
standardOutput new FileOutputStream("${projectDir}/RELEASE_NOTES")
standardOutput new FileOutputStream("${stageDir}/RELEASE_NOTES")
}
commandLine "git", "log", "--oneline", "remotes/origin/master"
}
Expand All @@ -241,6 +235,11 @@ tasks.withType(War).configureEach {
from("${stageDir}/org/epics/archiverappliance/staticcontent") {
into "ui/comm"
}
if (archapplsite == "tests") {
from("src/resources/test/log4j2.xml") {
into "WEB-INF/classes"
}
}
from("src/sitespecific/${archapplsite}/classpathfiles") {
into "WEB-INF/classes"
}
Expand All @@ -249,7 +248,7 @@ tasks.withType(War).configureEach {

tasks.register("mgmtWar", War) {
group = "Wars"
dependsOn javadoc
dependsOn "generateJavaDocTagletScriptables"
from("${stageDir}/org/epics/archiverappliance/mgmt/staticcontent") {
into "ui"
}
Expand Down Expand Up @@ -418,46 +417,52 @@ tasks.register("shutdownAllTomcats", Exec) {
group = "test"
description "task to shut down all tomcats after running integration tests," +
" if they didn't shut down correctly."
ignoreExitValue true
commandLine "pkill", "-9", "-f", "tomcat"
}

tasks.register("integrationSetup") {
tasks.register("integrationTestSetup", Copy) {
group = "Test"
description = "Setup for Integration Tests."
dependsOn "buildRelease"
doFirst {
dependsOn("buildRelease")
it.inputs.dir("$System.env.TOMCAT_HOME/conf")
it.outputs.dir("$System.env.TOMCAT_HOME/conf_original")
// backup the original tomcat conf folder
// if not already done. See org.epics.archiverappliance.TomcatSetup
def catalinaConf = file("$System.env.TOMCAT_HOME/conf_original")
if (!catalinaConf.exists()) {
copy {
from layout.buildDirectory.file("libs/mgmt.war")
from layout.buildDirectory.file("libs/engine.war")
from layout.buildDirectory.file("libs/etl.war")
from layout.buildDirectory.file("libs/retrieval.war")
into file("${warDir}")
}
// backup the original tomcat conf folder
// if not already done. See org.epics.archiverappliance.TomcatSetup
def catalinaConf = file("$System.env.TOMCAT_HOME/conf_original")
if (!catalinaConf.exists()) {
copy {
from file("$System.env.TOMCAT_HOME/conf")
into file("$System.env.TOMCAT_HOME/conf_original")
}
from "$System.env.TOMCAT_HOME/conf"
into "$System.env.TOMCAT_HOME/conf_original"
}
}

}

tasks.register("integrationTests", Test) {
group = "Test"
description = "Run the integration tests, ones that require a tomcat installation."
dependsOn "integrationSetup"
forkEvery 1
maxParallelForks = 1
dependsOn("integrationTestSetup")
useJUnitPlatform {
includeTags "integration",
"localEpics"
includeTags "integration"
excludeTags "slow",
"flaky"
}
finalizedBy "shutdownAllTomcats"
}

tasks.register("epicsTests", Test) {
group = "Test"
description = "Run the epics integration tests with parallel iocs."
dependsOn "integrationTestSetup"
useJUnitPlatform {
includeTags "localEpics"
excludeTags "slow",
"flaky",
"integration"
}
finalizedBy "shutdownAllTomcats"
}

tasks.register("singleForkTests", Test) {
Expand All @@ -475,15 +480,13 @@ tasks.register("singleForkTests", Test) {

test {
group = "Test"
description = "Run all the fast unit tests."
useJUnitPlatform {
excludeTags "integration",
"localEpics",
"flaky",
"singleFork",
"slow"
}

}

tasks.register("allTests", Test) {
Expand All @@ -498,7 +501,7 @@ tasks.register("allTests", Test) {
tasks.register("testRun", JavaExec) {
group = "test"
description = "Runs the application same as for integration tests."
dependsOn "integrationSetup"
dependsOn "integrationTestSetup"

mainClass = "org.epics.archiverappliance.TestRun"

Expand Down
8 changes: 4 additions & 4 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
<property environment="env"/>
<property name="ver" value="1.1.0"/>
<property name="src" location="src/main"/>
<property name="classes" location="bin/"/>
<property name="classes" location="build/classes/"/>
<property name="stage" location="stage/"/>
<property name="lib" location="lib/"/>
<property name="docs" location="docs/"/>
<property name="wardest" location="./build"/>
<property name="dist" location="./build"/>
<property name="wardest" location="./build/libs"/>
<property name="dist" location="./build/distributions"/>
<property name="test.dir" location="src/test"/>
<property name="tomcathome" location="${env.TOMCAT_HOME}"/>

Expand All @@ -43,7 +43,7 @@
<echo>Building the archiver appliance for the site ${archapplsite}</echo>

<target name="wars" depends="clean, retrieval_war, engine_war, etl_war, mgmt_war, generate_release_notes">
<tar destfile="${wardest}/archappl_v${version}.tar.gz" basedir="${wardest}" compression="gzip" includes="mgmt.war engine.war etl.war retrieval.war">
<tar destfile="${dist}/archappl_v${version}.tar.gz" basedir="${wardest}" compression="gzip" includes="mgmt.war engine.war etl.war retrieval.war">
<tarfileset dir="${docs}/samples" filemode="755">
<include name="quickstart.sh"/>
</tarfileset>
Expand Down
Loading
Loading