From de07a926c2206a968bf6320921b12d8bb77ef75d Mon Sep 17 00:00:00 2001 From: Jabster28 <29015942+Jabster28@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:06:45 +0100 Subject: [PATCH] add installer builds to artifacts w/ GH action (#864) --- .github/workflows/artifacts.yml | 108 ++++++++++++++++++++++++++++++++ desktop/package/package.gradle | 57 +++++++++-------- 2 files changed, 140 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/artifacts.yml diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml new file mode 100644 index 0000000000..fb45e8f245 --- /dev/null +++ b/.github/workflows/artifacts.yml @@ -0,0 +1,108 @@ +name: Build Haveno Installers + +on: + push: + branches: + - master + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '21' + + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y rpm + + - name: Build Haveno Installer for Linux + run: | + ./gradlew clean build --refresh-keys --refresh-dependencies + ./gradlew packageInstallers + working-directory: . + + - name: Move Release Files + run: | + mkdir ${{ github.workspace }}/release + mv desktop/build/temp-*/binaries/haveno-*.rpm ${{ github.workspace }}/release + mv desktop/build/temp-*/binaries/haveno_*.deb ${{ github.workspace }}/release + mv desktop/build/temp-*/binaries/desktop-*.jar.SHA-256 ${{ github.workspace }}/release + + - uses: actions/upload-artifact@v2 + with: + name: HavenoInstaller-linux + path: ${{ github.workspace }}/release + + + build-macos: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '21' + + - name: Build Haveno Installer for macOS + run: | + ./gradlew clean build --refresh-keys --refresh-dependencies + ./gradlew packageInstallers + working-directory: . + + - name: Move Release Files + run: | + mkdir ${{ github.workspace }}/release + mv desktop/build/temp-*/binaries/Haveno-*.dmg ${{ github.workspace }}/release + mv desktop/build/temp-*/binaries/desktop-*.jar.SHA-256 ${{ github.workspace }}/release + + - uses: actions/upload-artifact@v2 + with: + name: HavenoInstaller-macos + path: ${{ github.workspace }}/release + + build-windows: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '21' + + - name: Install WiX Toolset + run: | + Invoke-WebRequest -Uri 'https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314.exe' -OutFile wix314.exe + .\wix314.exe /quiet /norestart + shell: powershell + + - name: Build Haveno Installer for Windows + run: | + ./gradlew clean build --refresh-keys --refresh-dependencies + ./gradlew packageInstallers + working-directory: . + + - name: Move Release Files + run: | + mkdir ${{ github.workspace }}/release + Move-Item -Path desktop\build\temp-*/binaries\Haveno-*.exe -Destination ${{ github.workspace }}/release + Move-Item -Path desktop\build\temp-*/binaries\desktop-*.jar.SHA-256 -Destination ${{ github.workspace }}/release + shell: powershell + + - uses: actions/upload-artifact@v2 + with: + name: HavenoInstaller-windows + path: ${{ github.workspace }}/release diff --git a/desktop/package/package.gradle b/desktop/package/package.gradle index a5e1d72cb8..fd1fc81f43 100644 --- a/desktop/package/package.gradle +++ b/desktop/package/package.gradle @@ -6,33 +6,40 @@ task jpackageSanityChecks { description 'Interactive sanity checks on the version of the code that will be packaged' doLast { - executeCmd("git --no-pager log -5 --oneline") - ant.input(message: "Above you see the current HEAD and its recent history.\n" + - "Is this the right commit for packaging? (y=continue, n=abort)", - addproperty: "sanity-check-1", - validargs: "y,n") - if (ant.properties['sanity-check-1'] == 'n') { - ant.fail('Aborting') - } + if (!System.getenv("CI")) { + executeCmd("git --no-pager log -5 --oneline") + ant.input(message: "Above you see the current HEAD and its recent history.\n" + + "Is this the right commit for packaging? (y=continue, n=abort)", + addproperty: "sanity-check-1", + validargs: "y,n") + if (ant.properties['sanity-check-1'] == 'n') { + ant.fail('Aborting') + } - executeCmd("git status --short --branch") - ant.input(message: "Above you see any local changes that are not in the remote branch.\n" + - "If you have any local changes, please abort, get them merged, get the latest branch and try again.\n" + - "Continue with packaging? (y=continue, n=abort)", - addproperty: "sanity-check-2", - validargs: "y,n") - if (ant.properties['sanity-check-2'] == 'n') { - ant.fail('Aborting') - } + executeCmd("git status --short --branch") + ant.input(message: "Above you see any local changes that are not in the remote branch.\n" + + "If you have any local changes, please abort, get them merged, get the latest branch and try again.\n" + + "Continue with packaging? (y=continue, n=abort)", + addproperty: "sanity-check-2", + validargs: "y,n") + if (ant.properties['sanity-check-2'] == 'n') { + ant.fail('Aborting') + } - // TODO Evtl check programmatically in gradle (i.e. fail if below v11) - executeCmd("java --version") - ant.input(message: "Above you see the installed java version, which will be used to compile and build Haveno.\n" + - "Is this java version ok for that? (y=continue, n=abort)", - addproperty: "sanity-check-3", - validargs: "y,n") - if (ant.properties['sanity-check-3'] == 'n') { - ant.fail('Aborting') + // TODO Evtl check programmatically in gradle (i.e. fail if below v11) + executeCmd("java --version") + ant.input(message: "Above you see the installed java version, which will be used to compile and build Haveno.\n" + + "Is this java version ok for that? (y=continue, n=abort)", + addproperty: "sanity-check-3", + validargs: "y,n") + if (ant.properties['sanity-check-3'] == 'n') { + ant.fail('Aborting') + } + } else { + println "CI environment detected, skipping interactive sanity checks" + executeCmd("git --no-pager log -5 --oneline") + executeCmd("git status --short --branch") + executeCmd("java --version") } } }