tweaks to work better with the GitHub action
This commit is contained in:
parent
5b8f078201
commit
c4fa643e61
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@ -3,13 +3,13 @@ name: Build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- unstable
|
- test_gradle
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- unstable
|
- test_gradle
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
gradle:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -22,11 +22,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
- name: Ant build
|
- name: Setup Gradle
|
||||||
run: ant -noinput -buildfile build.xml clean check jar unittest
|
uses: gradle/gradle-build-action@v2
|
||||||
- name: Upload Artifact
|
# 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
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: openrocket_build_${{ github.run_number }}
|
name: build-reports
|
||||||
path: ${{github.workspace}}/swing/build/jar/OpenRocket.jar
|
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
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ jdk:
|
|||||||
- oraclejdk13
|
- oraclejdk13
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- gradlew clean test distFull
|
- gradlew clean serializeEnginesDist build dist
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks: https://www.travisbuddy.com/
|
webhooks: https://www.travisbuddy.com/
|
||||||
|
12
build.gradle
12
build.gradle
@ -48,8 +48,7 @@ shadowJar {
|
|||||||
|
|
||||||
//shadowJar.dependsOn([':core:serializeEngines'])
|
//shadowJar.dependsOn([':core:serializeEngines'])
|
||||||
|
|
||||||
// Runs a distribution build of the application. This does not include executions of the
|
// Packages the application for distribution.
|
||||||
// serialization of engines.
|
|
||||||
tasks.register('dist') {
|
tasks.register('dist') {
|
||||||
group = 'openrocket'
|
group = 'openrocket'
|
||||||
dependsOn 'shadowJar'
|
dependsOn 'shadowJar'
|
||||||
@ -57,12 +56,3 @@ tasks.register('dist') {
|
|||||||
println "Completed the deployable jar in './build/libs"
|
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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -54,29 +54,63 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def serializedEnginesPath = './src/main/resources/datafiles/thrustcurves/thrustcurves.ser'
|
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') {
|
tasks.register('serializeEngines') {
|
||||||
group = 'openrocket'
|
group = 'openrocket'
|
||||||
if (!project.file(serializedEnginesPath).exists()) {
|
dependsOn serializeEnginesDelete
|
||||||
println 'Serializing engines.'
|
|
||||||
dependsOn serializeEnginesExecute
|
dependsOn serializeEnginesExecute
|
||||||
}
|
}
|
||||||
else {
|
tasks.register('serializeEnginesDist') {
|
||||||
println "Serialized engines in ${project.file(serializedEnginesPath)} already exist."
|
group = 'openrocket'
|
||||||
}
|
dependsOn serializeEnginesExecuteDist
|
||||||
}
|
}
|
||||||
// Deletes the serialize engine file if it exists.
|
// Deletes the serialize engine file if it exists.
|
||||||
tasks.register('serializeEnginesDelete', Delete) {
|
tasks.register('serializeEnginesDelete', Delete) {
|
||||||
group = 'openrocket'
|
group = 'openrocket'
|
||||||
delete fileTree(serializedEnginesPath)
|
delete fileTree(serializedEnginesPath)
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
println "Starting serializeEnginesDelete..."
|
||||||
}
|
}
|
||||||
// Excutes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
|
doLast {
|
||||||
|
println "...serializeEnginesDelete Completed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
|
||||||
tasks.register('serializeEnginesExecute', JavaExec) {
|
tasks.register('serializeEnginesExecute', JavaExec) {
|
||||||
group = 'openrocket'
|
group = 'openrocket'
|
||||||
|
dependsOn serializeEnginesDelete
|
||||||
workingDir new File(projectDir, 'build/tmp')
|
workingDir new File(projectDir, 'build/tmp')
|
||||||
classpath = sourceSets.main.runtimeClasspath
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
mainClass.set('net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors')
|
mainClass.set('net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors')
|
||||||
args '../../resources-src/datafiles/thrustcurves/', '../.' + serializedEnginesPath
|
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) {
|
tasks.register('copyReadmeMain', Copy) {
|
||||||
@ -89,7 +123,8 @@ tasks.register('copyReadmeMain', Copy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//clean.dependsOn([serializeEnginesDelete])
|
//clean.dependsOn([serializeEnginesDelete])
|
||||||
compileJava.dependsOn([copyReadmeMain])
|
processResources.dependsOn([copyReadmeMain])
|
||||||
|
//jar.dependsOn([serializeEnginesExecute])
|
||||||
|
|
||||||
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
|
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
|
||||||
tasks.register('testCoreArtifactsJar', Jar) {
|
tasks.register('testCoreArtifactsJar', Jar) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user