Skip to content

Commit

Permalink
Merge pull request logisim-evolution#2001 from davidhutchens/workflow
Browse files Browse the repository at this point in the history
Update to have nightly build both x86_64 and aarch64 Mac versons.
  • Loading branch information
BFH-ktt1 authored May 15, 2024
2 parents 8708f93 + 243d90e commit b3294ea
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 9 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
uses: actions/upload-artifact@v4
if: success()
with:
path: build/dist/${{ needs.git_check.outputs.lse_name }}_${{ needs.git_check.outputs.lse_version }}-1_amd64.deb
path: build/dist/${{ needs.git_check.outputs.lse_name }}_${{ needs.git_check.outputs.lse_version }}_amd64.deb
name: ${{ needs.git_check.outputs.base_name }}_amd64.deb

# ###########################################################################################
Expand Down Expand Up @@ -229,21 +229,44 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Set up JDK ${{ env.JDK_VERSION }} ${{ env.JDK_DISTRO }}

- name: Set up aarch64 JDK ${{ env.JDK_VERSION }} ${{ env.JDK_DISTRO }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JDK_VERSION }}
distribution: ${{ env.JDK_DISTRO }}

- name: "Build aarch64 DMG"
run: |
# Have no mercy.
set -euo pipefail
chmod +x gradlew
./gradlew createDmg -x checkstyleMain -x checkstyleTest
- name: 'Upload aarch64 DMG'
uses: actions/upload-artifact@v4
if: success()
with:
path: build/dist/${{ needs.git_check.outputs.lse_name }}-${{ needs.git_check.outputs.lse_version }}-aarch64.dmg
name: ${{ needs.git_check.outputs.base_name }}-aarch64.dmg

- name: Set up x86_64 JDK ${{ env.JDK_VERSION }} ${{ env.JDK_DISTRO }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JDK_VERSION }}
distribution: ${{ env.JDK_DISTRO }}
architecture: "x64"

- name: "Build DMG"
- name: "Build x86_64 DMG"
run: |
# Have no mercy.
set -euo pipefail
chmod +x gradlew
./gradlew createDmg -x checkstyleMain -x checkstyleTest
- name: 'Upload DMG'
- name: 'Upload x86_64 DMG'
uses: actions/upload-artifact@v4
if: success()
with:
Expand Down
40 changes: 35 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,28 @@ fun deleteDirectoryContents(directory: String) {
}
}

/**
* Helper function to verify the distribution file now exists in build/dist.
* It issues a warning if it does not and also lists the contents of its directory.
*/
fun verifyFileExists(filename: String) {
var theFile = File(filename)
if (theFile.isFile()) {
return
}
logger.warn("*** WARNING ***");
logger.warn("File does not exist: ${filename}")
var parentDir = theFile.getParentFile();
if (parentDir != null && parentDir.isDirectory()) {
logger.warn("Directory actually contains:")
for (file in parentDir.list()) {
logger.warn(" ${file}")
}
} else {
logger.warn("Parent directory does not exist: ${parentDir}");
}
}

/**
* Task createPackageInput
*
Expand Down Expand Up @@ -298,8 +320,8 @@ tasks.register("createDeb") {
// https://www.debian.org/doc/manuals/debian-faq/pkg-basics.en.html
val appVersion = ext.get(APP_VERSION) as String
val targetDir = ext.get(TARGET_DIR) as String
val debPackagePath = "${targetDir}/${project.name}_${appVersion}-1_amd64.deb"
outputs.file(debPackagePath)
val outputFile = "${targetDir}/${project.name}_${appVersion}_amd64.deb"
outputs.file(outputFile)

doFirst {
if (!OperatingSystem.current().isLinux) {
Expand All @@ -310,6 +332,7 @@ tasks.register("createDeb") {
doLast {
val params = (ext.get(LINUX_PARAMS) as List<Any?>).filterIsInstance<String>() + listOf("--type", "deb")
runCommand(params, "Error while creating the DEB package.")
verifyFileExists(outputFile);
}
}

Expand All @@ -324,7 +347,8 @@ tasks.register("createRpm") {
dependsOn("createPackageInput")
inputs.dir(ext.get(PACKAGE_INPUT_DIR) as String)
inputs.dir("${ext.get(SUPPORT_DIR) as String}/linux")
outputs.file("${ext.get(TARGET_FILE_PATH_BASE) as String}-1.x86_64.rpm")
var outputFile = "${ext.get(TARGET_FILE_PATH_BASE) as String}-1.x86_64.rpm"
outputs.file(outputFile);

doFirst {
if (!OperatingSystem.current().isLinux) {
Expand All @@ -335,6 +359,7 @@ tasks.register("createRpm") {
doLast {
val params = (ext.get(LINUX_PARAMS) as List<Any?>).filterIsInstance<String>() + listOf("--type", "rpm")
runCommand(params, "Error while creating the RPM package.")
verifyFileExists(outputFile);
}
}

Expand All @@ -353,7 +378,8 @@ tasks.register("createMsi") {

inputs.dir(ext.get(PACKAGE_INPUT_DIR) as String)
inputs.dir("${supportDir}/windows")
outputs.file("${ext.get(TARGET_FILE_PATH_BASE_SHORT) as String}-${osArch}.msi")
var outputFile = "${ext.get(TARGET_FILE_PATH_BASE_SHORT) as String}-${osArch}.msi"
outputs.file(outputFile);

doFirst {
if (!OperatingSystem.current().isWindows) {
Expand Down Expand Up @@ -391,6 +417,7 @@ tasks.register("createMsi") {
throw GradleException("createMsi failed to rename .msi file to include architecture ${osArch}")
}
delete("${targetDir}/${fromFile}")
verifyFileExists(outputFile);
}
}

Expand Down Expand Up @@ -470,7 +497,9 @@ tasks.register("createDmg") {
val osArch = ext.get(OS_ARCH) as String

inputs.dir(appDirName)
outputs.file("${ext.get(TARGET_FILE_PATH_BASE) as String}-${osArch}.dmg")

val outputFile = "${ext.get(TARGET_FILE_PATH_BASE) as String}-${osArch}.dmg"
outputs.file(outputFile);

doFirst {
if (!OperatingSystem.current().isMacOsX) {
Expand All @@ -490,6 +519,7 @@ tasks.register("createDmg") {
"--type", "dmg",
)
runCommand(params, "Error while creating the DMG package")
verifyFileExists(outputFile);
}
}

Expand Down

0 comments on commit b3294ea

Please sign in to comment.