diff --git a/.github/actions/gradle-and-sha/action.yml b/.github/actions/gradle-and-sha/action.yml index 355c90c73..8883ac296 100644 --- a/.github/actions/gradle-and-sha/action.yml +++ b/.github/actions/gradle-and-sha/action.yml @@ -22,7 +22,9 @@ runs: - name: "Rename output file" shell: bash - run: mv ${{ inputs.intermediate-filepath }} ${{ inputs.final-filepath }} + run: | + ls build/*/* + mv ${{ inputs.intermediate-filepath }} ${{ inputs.final-filepath }} - name: "Generate SHA512 for Linux" shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1617c1fe1..db3fd1b2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,11 +3,11 @@ name: "Generate Releases" on: release: types: [ published ] -## To test this workflow without creating a release, uncomment the following and add a branch name (making sure "push" -## is at the same indent level as "release": -# push: -# branches: -# - 'branch-name' +# To test this workflow without creating a release, uncomment the following and add a branch name (making sure "push" +# is at the same indent level as "release": + push: + branches: + - 'feature/issue-756_airgap' jobs: release: @@ -50,7 +50,7 @@ jobs: if [ ${{ runner.os }} == 'Windows' ]; then echo "FILEPATH=build/jpackage/RCTab-1.3.999.exe" >> $GITHUB_OUTPUT elif [ ${{ runner.os }} == 'Linux' ]; then - echo "FILEPATH=build/jpackage/rctab_1.3.999-1_amd64.deb" >> $GITHUB_OUTPUT + echo "FILEPATH=build/jpackage/rctab_1.3.999_amd64.deb" >> $GITHUB_OUTPUT else echo "FILEPATH=build/jpackage/RCTab-1.3.999.dmg" >> $GITHUB_OUTPUT fi @@ -77,6 +77,22 @@ jobs: intermediate-filepath: build/rcv.zip final-filepath: ${{ steps.zipfn.outputs.FILEPATH }} + - name: "Create caches filename" + id: cachefn + shell: bash + run: echo "DEPENDENCY_FILEPATH=dependency.${{ runner.os }}.zip" >> $GITHUB_OUTPUT + run: echo "PLUGIN_FILEPATH=plugin.${{ runner.os }}.zip" >> $GITHUB_OUTPUT + + - name: "Create dependency zip" + shell: bash + run: | + ./gradlew copyLibs + ./gradlew assemble + zip -r ${{cachefn.DEPENDENCY_FILEPATH}} .dependencycache + zip -r ${{cachefn.PLUGIN_FILEPATH}} ~/.gradle/caches + sha512sum ${{cachefn.DEPENDENCY_FILEPATH}} > ${{cachefn.DEPENDENCY_FILEPATH}}.sha512 + sha512sum ${{cachefn.PLUGIN_FILEPATH}} > ${{cachefn.PLUGIN_FILEPATH}}.sha512 + - name: "Prepare keychain" if: matrix.os == 'macOS-latest' env: @@ -132,6 +148,10 @@ jobs: ${{ github.workspace }}/${{ steps.zipfn.outputs.FILEPATH }}.sha512 ${{ github.workspace }}/${{ steps.exefn.outputs.FILEPATH }} ${{ github.workspace }}/${{ steps.exefn.outputs.FILEPATH }}.sha512 + ${{ github.workspace }}/dependencycache.zip + ${{ github.workspace }}/dependencycache.zip.sha512 + ${{ github.workspace }}/plugincache.zip + ${{ github.workspace }}/plugincache.zip.sha512 retention-days: 90 - name: "Upload binaries to release" diff --git a/build.gradle b/build.gradle index 46821cfd5..049453211 100644 --- a/build.gradle +++ b/build.gradle @@ -15,14 +15,24 @@ repositories { mavenCentral() } +// Caching dependencies for a fully-offline build +def DEPENDENCY_CACHE_DIR = "$projectDir/.dependencycache/" + dependencies { - implementation 'commons-cli:commons-cli:1.5.0' - implementation 'org.apache.commons:commons-csv:1.10.0' - implementation 'org.apache.poi:poi-ooxml:5.2.3' - implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2' - implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2' - implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2' + if (gradle.startParameter.isOffline()) { + implementation fileTree(dir: DEPENDENCY_CACHE_DIR) + } else { + implementation 'commons-cli:commons-cli:1.5.0' + implementation 'org.apache.commons:commons-csv:1.10.0' + implementation 'org.apache.poi:poi-ooxml:5.2.3' + implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2' + implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2' + implementation "com.github.spotbugs:spotbugs:4.8.3" + + } + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3' } @@ -235,3 +245,25 @@ tasks.jlink.doLast { into JLINK_DIR + "/sample_input" } } + +// Tooling to copy dependencies for a fully-offline build +configurations { + cacheableImplementation.extendsFrom implementation +} + +task deleteLibraryCache(type: Delete) { + delete DEPENDENCY_CACHE_DIR +} + +task copyLibs(type: Copy, dependsOn: 'deleteLibraryCache') { + from configurations.cacheableImplementation + into DEPENDENCY_CACHE_DIR +} + +// Necessary for offline builds to succeed +tasks.withType(Tar) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} +tasks.withType(Zip) { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +}