tweaks to work better with the GitHub action

This commit is contained in:
thzero 2023-05-08 19:40:52 -05:00
parent 5b8f078201
commit c4fa643e61
4 changed files with 65 additions and 30 deletions

View File

@ -3,13 +3,13 @@ name: Build
on:
push:
branches:
- unstable
- test_gradle
pull_request:
branches:
- unstable
- test_gradle
jobs:
build:
gradle:
runs-on: ubuntu-latest
steps:
@ -22,11 +22,21 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
- name: Ant build
run: ant -noinput -buildfile build.xml clean check jar unittest
- name: Upload Artifact
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# Not sure why this is needed, per a support issue (https://github.com/gradle/gradle-build-action/issues/517) it should not
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Execute Gradle build
run: ./gradlew clean serializeEnginesDist build dist
- name: Upload build reports
uses: actions/upload-artifact@v3
with:
name: openrocket_build_${{ github.run_number }}
path: ${{github.workspace}}/swing/build/jar/OpenRocket.jar
name: build-reports
path: build/reports/
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# name: openrocket_build_${{ github.run_number }}
# path: ${{github.workspace}}/build/lib/openrocket*.jar

View File

@ -9,7 +9,7 @@ jdk:
- oraclejdk13
script:
- gradlew clean test distFull
- gradlew clean serializeEnginesDist build dist
notifications:
webhooks: https://www.travisbuddy.com/

View File

@ -48,21 +48,11 @@ shadowJar {
//shadowJar.dependsOn([':core:serializeEngines'])
// Runs a distribution build of the application. This does not include executions of the
// serialization of engines.
// Packages the application for distribution.
tasks.register('dist') {
group = 'openrocket'
dependsOn 'shadowJar'
doLast {
println "Completed the deployable jar in './build/libs"
}
}
// Runs a complete distribution build of the application. This includes executions the
// serialization of engines by fetching data from ThrustCurve.
tasks.register('distFull') {
group = 'openrocket'
dependsOn ':core:serializeEngines', 'shadowJar'
doLast {
println "Completed the full build and deployable jar in './build/libs"
}
}

View File

@ -54,29 +54,63 @@ dependencies {
}
def serializedEnginesPath = './src/main/resources/datafiles/thrustcurves/thrustcurves.ser'
// Executes the serialization of engines from ThrustCurve.
def serializedEnginesPathDist = './build/resources/main/datafiles/thrustcurves/thrustcurves.ser'
// Executes the serialization of engines from ThrustCurve for a build.
tasks.register('serializeEngines') {
group = 'openrocket'
if (!project.file(serializedEnginesPath).exists()) {
println 'Serializing engines.'
dependsOn serializeEnginesExecute
}
else {
println "Serialized engines in ${project.file(serializedEnginesPath)} already exist."
}
dependsOn serializeEnginesDelete
dependsOn serializeEnginesExecute
}
tasks.register('serializeEnginesDist') {
group = 'openrocket'
dependsOn serializeEnginesExecuteDist
}
// Deletes the serialize engine file if it exists.
tasks.register('serializeEnginesDelete', Delete) {
group = 'openrocket'
delete fileTree(serializedEnginesPath)
doFirst {
println "Starting serializeEnginesDelete..."
}
doLast {
println "...serializeEnginesDelete Completed"
}
}
// Excutes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
// Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
tasks.register('serializeEnginesExecute', JavaExec) {
group = 'openrocket'
dependsOn serializeEnginesDelete
workingDir new File(projectDir, 'build/tmp')
classpath = sourceSets.main.runtimeClasspath
mainClass.set('net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors')
args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPath
doFirst {
println "Starting serializeEnginesExecute..."
// println "${serializedEnginesPath}"
}
doLast {
println "...serializeEnginesExecute Completed"
}
}
// Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
// TODO: Shouldn't need a seperate task, but the args are not changing when dynamically updating
// the variable.
tasks.register('serializeEnginesExecuteDist', JavaExec) {
group = 'openrocket'
dependsOn serializeEnginesDelete
workingDir new File(projectDir, 'build/tmp')
classpath = sourceSets.main.runtimeClasspath
mainClass.set('net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors')
args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPathDist
doFirst {
println "Starting serializeEnginesExecuteDist..."
}
doLast {
println "...serializeEnginesExecuteDist Completed"
}
}
tasks.register('copyReadmeMain', Copy) {
@ -89,7 +123,8 @@ tasks.register('copyReadmeMain', Copy) {
}
//clean.dependsOn([serializeEnginesDelete])
compileJava.dependsOn([copyReadmeMain])
processResources.dependsOn([copyReadmeMain])
//jar.dependsOn([serializeEnginesExecute])
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
tasks.register('testCoreArtifactsJar', Jar) {