From ce77d16ff5ab051adb15eba8da8dd93cb6403036 Mon Sep 17 00:00:00 2001 From: Jai A P Date: Wed, 7 Sep 2022 02:48:29 +0530 Subject: [PATCH] Add linux armv7l and win/osx arm64 builds (#2113) * Add linux armv7l * Add linux armv7l * Update release.yml * Update build.yml * Update release.yml * Update build.js * Update release.yml * Update build.yml * Update release.yml * Update release.yml * Update build.yml * Update _scripts/build.js Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> * Update _scripts/build.js Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> * Update _scripts/build.js Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> * Update build.yml * Update build.yml * Update release.yml * Remove squirrel build from windows as unused * Update build.yml * Update release.yml * Update build.yml * Update release.yml * Update build.yml * Update release.yml * Update .github/workflows/release.yml Co-authored-by: PikachuEXE * Update .github/workflows/build.yml Co-authored-by: PikachuEXE Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Co-authored-by: PikachuEXE --- .github/workflows/build.yml | 135 +++++++++++++++++++++++++----- .github/workflows/release.yml | 150 +++++++++++++++++++++++++++++++--- _scripts/build.js | 18 ++-- 3 files changed, 263 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77b99a85..3ef58734 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,26 +6,45 @@ name: Build on: push: branches: [ master, development, '**-RC' ] + workflow_dispatch: jobs: build: strategy: matrix: node-version: [16.x] - runtime: [ linux-x64, linux-arm64, win-x64, osx-x64 ] + runtime: + - linux-x64 + - linux-armv7l + - linux-arm64 + - win-x64 + - win-arm64 + - osx-x64 + # `osx-arm64` disabled due to "macOS gatekeeper" + # See details in https://github.com/FreeTubeApp/FreeTube/pull/2113 + # - osx-arm64 include: - runtime: linux-x64 os: ubuntu-latest + - runtime: linux-armv7l + os: ubuntu-latest + - runtime: linux-arm64 os: ubuntu-latest - runtime: osx-x64 os: macOS-latest +# - runtime: osx-arm64 +# os: macOS-latest + - runtime: win-x64 os: windows-latest + - runtime: win-arm64 + os: windows-latest + runs-on: ${{ matrix.os }} steps: @@ -73,15 +92,19 @@ jobs: - name: Install libarchive-tools - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-x64') + if: startsWith(matrix.os, 'ubuntu') run: sudo apt -y install libarchive-tools; echo "Version Number ${{ toJson(job) }} ${{ toJson(needs) }}" - name: Build x64 with Node.js ${{ matrix.node-version}} if: contains(matrix.runtime, 'x64') run: npm run build --if-present + - name: Build ARMv7l with Node.js ${{ matrix.node-version}} + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + run: npm run build:arm32 --if-present + - name: Build ARM64 with Node.js ${{ matrix.node-version}} - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') + if: contains(matrix.runtime, 'arm64') run: npm run build:arm64 --if-present - name: Upload Linux .zip x64 Artifact @@ -91,7 +114,14 @@ jobs: name: freetube_${{ steps.versionNumber.outputs.result }}_linux_portable_x64 path: build/freetube-${{ steps.versionNumber.outputs.result }}.zip - - name: Upload Linux .zip ARM Artifact + - name: Upload Linux .zip ARMv7l Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + with: + name: freetube_${{ steps.versionNumber.outputs.result }}_linux_portable_armv7l + path: build/freetube-${{ steps.versionNumber.outputs.result }}-armv7l.zip + + - name: Upload Linux .zip ARM64 Artifact uses: actions/upload-artifact@v2 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') with: @@ -105,7 +135,14 @@ jobs: name: freetube_${{ steps.versionNumber.outputs.result }}_amd64.deb path: build/freetube_${{ steps.versionNumber.outputs.result }}_amd64.deb - - name: Upload .deb ARM Artifact + - name: Upload .deb ARMv7l Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + with: + name: freetube_${{ steps.versionNumber.outputs.result }}_armv7l.deb + path: build/freetube_${{ steps.versionNumber.outputs.result }}_armv7l.deb + + - name: Upload .deb ARM64 Artifact uses: actions/upload-artifact@v2 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') with: @@ -119,7 +156,14 @@ jobs: name: freetube_${{ steps.versionNumber.outputs.result }}_amd64.AppImage path: build/FreeTube-${{ steps.versionNumber.outputs.result }}.AppImage - - name: Upload AppImage ARM Artifact + - name: Upload AppImage ARMv7l Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + with: + name: freetube_${{ steps.versionNumber.outputs.result }}_armv7l.AppImage + path: build/FreeTube-${{ steps.versionNumber.outputs.result }}-armv7l.AppImage + + - name: Upload AppImage ARM64 Artifact uses: actions/upload-artifact@v2 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') with: @@ -132,8 +176,10 @@ jobs: with: name: freetube_${{ steps.versionNumber.outputs.result }}_amd64.rpm path: build/freetube-${{ steps.versionNumber.outputs.result }}.x86_64.rpm + + # rpm are not built for armv7l - - name: Upload .rpm ARM Artifact + - name: Upload .rpm ARM64 Artifact uses: actions/upload-artifact@v2 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') with: @@ -147,7 +193,14 @@ jobs: name: freetube_${{ steps.versionNumber.outputs.result }}_alpine_amd64.apk path: build/freetube-${{ steps.versionNumber.outputs.result }}.apk - - name: Upload Alpine .apk ARM Artifact + - name: Upload Alpine .apk ARMv7l Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + with: + name: freetube_${{ steps.versionNumber.outputs.result }}_alpine_armv7l.apk + path: build/freetube-${{ steps.versionNumber.outputs.result }}-armv7l.apk + + - name: Upload Alpine .apk ARM64 Artifact uses: actions/upload-artifact@v2 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') with: @@ -168,30 +221,72 @@ jobs: # name: freetube_${{ steps.versionNumber.outputs.result }}_static_web # path: dist/web - - name: Upload Windows .exe Artifact + - name: Upload Windows x64 .exe Artifact uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'windows') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-x64') + with: + name: freetube-${{ steps.versionNumber.outputs.result }}-setup-x64.exe + path: build/freetube Setup ${{ steps.versionNumber.outputs.result }}.exe + + - name: Upload Windows arm64 .exe Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-arm64') + with: + name: freetube-${{ steps.versionNumber.outputs.result }}-setup-arm64.exe + path: build/freetube Setup ${{ steps.versionNumber.outputs.result }}.exe + + - name: Upload Windows x64 .zip Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-x64') with: name: freetube-${{ steps.versionNumber.outputs.result }}-win-x64-portable path: build/freetube-${{ steps.versionNumber.outputs.result }}-win.zip - - name: Upload Windows .zip Artifact + - name: Upload Windows arm64 .zip Artifact uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'windows') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-arm64') with: - name: freetube-${{ steps.versionNumber.outputs.result }}-setup-x64.exe - path: build/freetube Setup ${{ steps.versionNumber.outputs.result }}.exe - - - name: Upload Windows Portable Artifact + name: freetube-${{ steps.versionNumber.outputs.result }}-win-arm64-portable + path: build/freetube-${{ steps.versionNumber.outputs.result }}-arm64-win.zip + + - name: Upload Windows x64 Portable Artifact uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'windows') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-x64') with: name: freetube-${{ steps.versionNumber.outputs.result }}-portable-x64.exe path: build/freetube ${{ steps.versionNumber.outputs.result }}.exe - - name: Upload Mac .dmg Artifact + - name: Upload Windows arm64 Portable Artifact uses: actions/upload-artifact@v2 - if: startsWith(matrix.os, 'macos') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-arm64') with: - name: freetube-${{ steps.versionNumber.outputs.result }}-mac.dmg + name: freetube-${{ steps.versionNumber.outputs.result }}-portable-arm64.exe + path: build/freetube ${{ steps.versionNumber.outputs.result }}.exe + + - name: Upload Mac x64 .dmg Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-x64') + with: + name: freetube-${{ steps.versionNumber.outputs.result }}-mac-x64.dmg path: build/freetube-${{ steps.versionNumber.outputs.result }}.dmg + +# - name: Upload Mac arm64 .dmg Artifact +# uses: actions/upload-artifact@v2 +# if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-arm64') +# with: +# name: freetube-${{ steps.versionNumber.outputs.result }}-mac-arm64.dmg +# path: build/freetube-${{ steps.versionNumber.outputs.result }}-arm64.dmg + + - name: Upload Mac x64 .zip Artifact + uses: actions/upload-artifact@v2 + if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-x64') + with: + name: freetube-${{ steps.versionNumber.outputs.result }}-mac-x64.zip + path: build/freetube-${{ steps.versionNumber.outputs.result }}-mac.zip + +# - name: Upload Mac arm64 .zip Artifact +# uses: actions/upload-artifact@v2 +# if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-arm64') +# with: +# name: freetube-${{ steps.versionNumber.outputs.result }}-mac-arm64.zip +# path: build/freetube-${{ steps.versionNumber.outputs.result }}-arm64-mac.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 962124ff..0a3d0047 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,19 +13,37 @@ jobs: strategy: matrix: node-version: [16.x] - runtime: [ linux-x64, linux-arm64, win-x64, osx-x64 ] + runtime: + - linux-x64 + - linux-armv7l + - linux-arm64 + - win-x64 + - win-arm64 + - osx-x64 + # `osx-arm64` disabled due to "macOS gatekeeper" + # See details in https://github.com/FreeTubeApp/FreeTube/pull/2113 + # - osx-arm64 include: - runtime: linux-x64 os: ubuntu-latest + - runtime: linux-armv7l + os: ubuntu-latest + - runtime: linux-arm64 os: ubuntu-latest - runtime: osx-x64 os: macOS-latest - + +# - runtime: osx-arm64 +# os: macOS-latest + - runtime: win-x64 os: windows-latest + + - runtime: win-arm64 + os: windows-latest runs-on: ${{ matrix.os }} @@ -49,8 +67,12 @@ jobs: if: contains(matrix.runtime, 'x64') run: npm run build --if-present + - name: Build ARMv7l with Node.js ${{ matrix.node-version}} + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + run: npm run build:arm32 --if-present + - name: Build ARM64 with Node.js ${{ matrix.node-version}} - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') + if: contains(matrix.runtime, 'arm64') run: npm run build:arm64 --if-present - name: Upload AppImage x64 Release @@ -75,7 +97,18 @@ jobs: asset_path: build/freetube-${{ env.PACKAGE_VERSION }}.zip asset_content_type: application/zip - - name: Upload Linux .zip ARM Release + - name: Upload Linux .zip ARMv7l Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube-${{ env.PACKAGE_VERSION }}-linux-portable-armv7l.zip + asset_path: build/freetube-${{ env.PACKAGE_VERSION }}-armv7l.zip + asset_content_type: application/zip + + - name: Upload Linux .zip ARM64 Release uses: actions/upload-release-asset@v1 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') env: @@ -97,7 +130,18 @@ jobs: asset_path: build/freetube_${{ env.PACKAGE_VERSION }}_amd64.deb asset_content_type: application/vnd.debian.binary-package - - name: Upload Linux .deb ARM Release + - name: Upload Linux .deb ARMv7l Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-armv7l') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube_${{ env.PACKAGE_VERSION }}_armv7l.deb + asset_path: build/freetube_${{ env.PACKAGE_VERSION }}_armv7l.deb + asset_content_type: application/vnd.debian.binary-package + + - name: Upload Linux .deb ARM64 Release uses: actions/upload-release-asset@v1 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') env: @@ -118,8 +162,10 @@ jobs: asset_name: freetube_${{ env.PACKAGE_VERSION }}_amd64.rpm asset_path: build/freetube-${{ env.PACKAGE_VERSION }}.x86_64.rpm asset_content_type: application/x-rpm + + # rpm are not built for armv7l - - name: Upload Linux .rpm ARM Release + - name: Upload Linux .rpm ARM64 Release uses: actions/upload-release-asset@v1 if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.runtime, 'linux-arm64') env: @@ -130,9 +176,9 @@ jobs: asset_path: build/freetube-${{ env.PACKAGE_VERSION }}.aarch64.rpm asset_content_type: application/x-rpm - - name: Upload Windows .exe Release + - name: Upload Windows x64 .exe Release uses: actions/upload-release-asset@v1 - if: startsWith(matrix.os, 'windows') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-x64') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -141,9 +187,20 @@ jobs: asset_path: build/freetube Setup ${{ env.PACKAGE_VERSION }}.exe asset_content_type: application/x-ms-dos-executable - - name: Upload Windows .zip Release + - name: Upload Windows arm64 .exe Release uses: actions/upload-release-asset@v1 - if: startsWith(matrix.os, 'windows') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-arm64') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube-${{ env.PACKAGE_VERSION }}-setup-arm64.exe + asset_path: build/freetube Setup ${{ env.PACKAGE_VERSION }}.exe + asset_content_type: application/x-ms-dos-executable + + - name: Upload Windows x64 .zip Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-x64') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -152,13 +209,80 @@ jobs: asset_path: build/freetube-${{ env.PACKAGE_VERSION }}-win.zip asset_content_type: application/zip - - name: Upload Mac .dmg Release + - name: Upload Windows arm64 .zip Release uses: actions/upload-release-asset@v1 - if: startsWith(matrix.os, 'macos') + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-arm64') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} - asset_name: freetube-${{ env.PACKAGE_VERSION }}-mac.dmg + asset_name: freetube-${{ env.PACKAGE_VERSION }}-win-arm64-portable.zip + asset_path: build/freetube-${{ env.PACKAGE_VERSION }}-arm64-win.zip + asset_content_type: application/zip + + - name: Upload Windows x64 portable Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-x64') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube-${{ env.PACKAGE_VERSION }}-win-x64-portable.exe + asset_path: build/FreeTube ${{ env.PACKAGE_VERSION }}.exe + asset_content_type: application/x-ms-dos-executable + + - name: Upload Windows arm64 portable Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'windows') && startsWith(matrix.runtime, 'win-arm64') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube-${{ env.PACKAGE_VERSION }}-win-arm64-portable.exe + asset_path: build/FreeTube ${{ env.PACKAGE_VERSION }}.exe + asset_content_type: application/x-ms-dos-executable + + - name: Upload Mac x64 .dmg Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-x64') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube-${{ env.PACKAGE_VERSION }}-mac-x64.dmg asset_path: build/freetube-${{ env.PACKAGE_VERSION }}.dmg asset_content_type: application/x-apple-diskimage + +# - name: Upload Mac arm64 .dmg Release +# uses: actions/upload-release-asset@v1 +# if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-arm64') +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} +# asset_name: freetube-${{ env.PACKAGE_VERSION }}-mac-arm64.dmg +# asset_path: build/freetube-${{ env.PACKAGE_VERSION }}-arm64.dmg +# asset_content_type: application/x-apple-diskimage + + - name: Upload Mac x64 .zip Release + uses: actions/upload-release-asset@v1 + if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-x64') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} + asset_name: freetube-${{ env.PACKAGE_VERSION }}-mac-x64.zip + asset_path: build/freetube-${{ env.PACKAGE_VERSION }}-mac.zip + asset_content_type: application/x-apple-diskimage + +# - name: Upload Mac arm64 .zip Release +# uses: actions/upload-release-asset@v1 +# if: startsWith(matrix.os, 'macos') && startsWith(matrix.runtime, 'osx-arm64') +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: https://uploads.github.com/repos/FreeTubeApp/FreeTube/releases/${{ secrets.UPLOAD_ID }}/assets{?name,label} +# asset_name: freetube-${{ env.PACKAGE_VERSION }}-mac-arm64.zip +# asset_path: build/freetube-${{ env.PACKAGE_VERSION }}-arm64-mac.zip +# asset_content_type: application/x-apple-diskimage + diff --git a/_scripts/build.js b/_scripts/build.js index 4e909708..e4a727c9 100644 --- a/_scripts/build.js +++ b/_scripts/build.js @@ -13,15 +13,19 @@ const cpus = os.cpus() if (platform === 'darwin') { let arch = Arch.x64 -// Macbook Air 2020 with M1 = 'Apple M1' - // Macbook Pro 2021 with M1 Pro = 'Apple M1 Pro' - if (cpus[0].model.startsWith('Apple')) { + if (args[2] === 'arm64') { arch = Arch.arm64 } - - targets = Platform.MAC.createTarget(['dmg'], arch) + + targets = Platform.MAC.createTarget(['DMG','zip'], arch) } else if (platform === 'win32') { - targets = Platform.WINDOWS.createTarget() + let arch = Arch.x64 + + if (args[2] === 'arm64') { + arch = Arch.arm64 + } + + targets = Platform.WINDOWS.createTarget(['nsis', 'zip', 'portable'], arch) } else if (platform === 'linux') { let arch = Arch.x64 @@ -126,7 +130,7 @@ const config = { }, win: { icon: '_icons/icon.ico', - target: ['nsis', 'zip', 'portable', 'squirrel'], + target: ['nsis', 'zip', 'portable'], }, nsis: { allowToChangeInstallationDirectory: true,