From 744e3356f43dde2beee5ddb96b3c718206d0a04b Mon Sep 17 00:00:00 2001 From: Ponchale Date: Sun, 17 Mar 2024 21:03:04 -0500 Subject: [PATCH] update build for Midori --- ...indow-generate-profile-data-and-jarlog.yml | 151 +++++++++--------- .github/workflows/windows-build.yml | 77 ++++----- 2 files changed, 112 insertions(+), 116 deletions(-) diff --git a/.github/workflows/window-generate-profile-data-and-jarlog.yml b/.github/workflows/window-generate-profile-data-and-jarlog.yml index af7cf42dbf4..e92a96f4151 100644 --- a/.github/workflows/window-generate-profile-data-and-jarlog.yml +++ b/.github/workflows/window-generate-profile-data-and-jarlog.yml @@ -1,73 +1,78 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# Please write our copyright if you use this file. -# Β© 2023 Midori Projects & Contributors - -on: - workflow_call: - inputs: - browser-artifact-name: - description: 'Artifact to download' - required: true - default: 'midori-windows-x86_64-build-with-profgen-zstd' - type: string - arch: - description: 'Architecture to output' - required: true - default: 'x86_64' - type: string - workflow_dispatch: - inputs: - browser-artifact: - description: 'Artifact to download' - required: true - default: 'midori-windows-x86_64-build-with-profgen-zstd' - type: string - arch: - description: 'Architecture to output' - required: true - default: 'x86_64' - type: string -jobs: - Generate-Profile-data-and-jarlog: - runs-on: Generate-Profile-data-and-jarlog - steps: - - uses: actions/download-artifact@v3 - name: Download artifact πŸ“₯ - with: - name: ${{ inputs.browser-artifact-name }} - path: C:\artifact - - - name: Unpack artifact - run: | - cd C:\artifact - zstd -d midori-*.tar.zst - 7z x midori-*.tar - - uses: actions/checkout@v3 - name: Clone 🧬 - with: - submodules: 'recursive' - - - name: Setup πŸͺ› - run: | - (New-Object System.Net.WebClient).DownloadFile("https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe","C:\MozillaBuildSetup-Latest.exe") - C:\MozillaBuildSetup-Latest.exe /S | out-null - - name: Generate πŸ”„ - run: | - $workspace_dir = [regex]::replace($env:GITHUB_WORKSPACE, "^([A-Z]):", { "/" + $args.value.Substring(0, 1).toLower() }) -replace "\\","/" - - echo "cd $workspace_dir" '' >> mozilla-build-run.sh - echo 'export PATH=/c/mozilla-build/msys2/usr/bin:$PATH' '' >> mozilla-build-run.sh - echo './mach --no-interactive bootstrap --application-choice browser' '' >> mozilla-build-run.sh - echo 'LLVM_PROFDATA=/c/Users/runneradmin/.mozbuild/clang/bin/llvm-profdata.exe JARLOG_FILE=en-US.log ./mach python build/pgo/profileserver.py --binary /c/artifact/midori/midori.exe' '' >> mozilla-build-run.sh - C:\mozilla-build\start-shell.bat $workspace_dir\mozilla-build-run.sh - - - name: Publish 🎁 - uses: actions/upload-artifact@v3 - with: - name: midori-windows-${{ inputs.arch }}-profdata-and-jarlog - path: | - merged.profdata - en-US.log \ No newline at end of file +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Please write our copyright if you use this file. +# Β© 2023 Midori Projects & Contributors + +on: + workflow_call: + inputs: + browser-artifact-name: + description: 'Artifact to download' + required: true + default: 'midori-windows-x86_64-build-with-profgen-zstd' + type: string + arch: + description: 'Architecture to output' + required: true + default: 'x86_64' + type: string + workflow_dispatch: + inputs: + browser-artifact: + description: 'Artifact to download' + required: true + default: 'midori-windows-x86_64-build-with-profgen-zstd' + type: string + arch: + description: 'Architecture to output' + required: true + default: 'x86_64' + type: string + +jobs: + Generate-Profile-data-and-jarlog: + runs-on: windows-latest + steps: + - uses: actions/download-artifact@v4 + name: Download artifact πŸ“₯ + with: + name: ${{ inputs.browser-artifact-name }} + path: C:\artifact + + - name: Unpack artifact + run: | + cd C:\artifact + zstd -d midori-*.tar.zst + 7z x midori-*.tar + + - uses: actions/checkout@v4 + name: Clone 🧬 + with: + submodules: 'recursive' + + - name: Setup πŸͺ› + run: | + (New-Object System.Net.WebClient).DownloadFile("https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe","C:\MozillaBuildSetup-Latest.exe") + C:\MozillaBuildSetup-Latest.exe /S | out-null + + - name: Generate πŸ”„ + run: | + $Env:USE_MINTTY = "0" + + $workspace_dir = [regex]::replace($env:GITHUB_WORKSPACE, "^([A-Z]):", { "/" + $args.value.Substring(0, 1).toLower() }) -replace "\\","/" + + echo "cd $workspace_dir" '' >> mozilla-build-run.sh + echo 'export PATH=/c/mozilla-build/msys2/usr/bin:$PATH' '' >> mozilla-build-run.sh + echo './mach --no-interactive bootstrap --application-choice browser' '' >> mozilla-build-run.sh + echo 'LLVM_PROFDATA=/c/Users/runneradmin/.mozbuild/clang/bin/llvm-profdata.exe JARLOG_FILE=en-US.log ./mach python build/pgo/profileserver.py --binary /c/artifact/midori/midori.exe' '' >> mozilla-build-run.sh + C:\mozilla-build\start-shell.bat $workspace_dir\mozilla-build-run.sh + + - name: Publish 🎁 + uses: actions/upload-artifact@v4 + with: + name: midori-windows-${{ inputs.arch }}-profdata-and-jarlog + path: | + merged.profdata + en-US.log diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index d085160f383..32c4d346b83 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -6,7 +6,6 @@ # Β© 2023 Midori Projects & Contributors #! SELF HOST DOES NOT SUPPORTED -#TODO! buildjet config not implemented #TODO: separate Publish to other workflow #! aarch64 PGO can maybe not comportable with pgo @@ -51,31 +50,29 @@ on: MOZ_BUILD_DATE: type: string default: "" - #? If you want to ALWAYS build with buildjet, do default to true - buildjet: - type: boolean - default: false - #? buildjet cache also is, but idk how to use on sccache release-note-url: type: string required: false default: "" + release-note-url-ja: + type: string + required: false + default: "" outputs: mar_name: value: ${{jobs.win-build.outputs.mar_name}} mar_size: value: ${{jobs.win-build.outputs.mar_size}} - jobs: win-build: - runs-on: ${{fromJson('["ubuntu-latest","buildjet-16vcpu-ubuntu-2204"]')[inputs.buildjet]}} + runs-on: ubuntu-latest outputs: mar_name: ${{steps.gen-mar.outputs.MAR_NAME}} mar_size: ${{steps.gen-mar.outputs.MAR_SIZE}} steps: - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "lts/*" - name: Check Argument Compatibility @@ -116,34 +113,24 @@ jobs: sudo perl -p -i -e 's%(deb(?:-src|)\s+)https?://(?!archive\.canonical\.com|security\.ubuntu\.com)[^\s]+%$1http://archive.ubuntu.com/ubuntu/%' /etc/apt/sources.list sudo apt update - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Clone 🧬 - - - name: Clone Submodules 🧬 - run: | - git submodule update --init --recursive - - - name: Clone l10n-central 🧬 - uses: actions/checkout@v3 with: - repository: goastian/l10n-central - path: l10n-central + submodules: 'recursive' - #! ON UBUNTU RUNNER - name: Setup Disk & Swap Space πŸ’Ώ - if: ${{!inputs.buildjet}} run: | chmod +x .github/workflows/src/disk_swap_for_github_runner.sh .github/workflows/src/disk_swap_for_github_runner.sh - name: Configure sccache - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 name: Download artifact if use profdataπŸ“₯ if: inputs.profdata_jarlog_artifact_name with: @@ -156,7 +143,7 @@ jobs: if [[ $GHA_aarch64 == 'true' ]]; then cp ./.github/workflows/src/windows/aarch64/mozconfig_win_aarch64_pgo_base mozconfig - elif [[ $GHA_32bit == 'true' ]]; then + elif [[ $GHA_32bit == 'true' ]]; then cp ./.github/workflows/src/windows/x86/mozconfig_win_x86_pgo_base mozconfig else cp ./.github/workflows/src/windows/x86_64/mozconfig_win_x86_64_pgo_base mozconfig @@ -166,13 +153,13 @@ jobs: export MOZ_BUILD_DATE=$GHA_MOZ_BUILD_DATE fi - if [[ $GHA_beta != 'true' ]];then - echo 'ac_add_options --with-branding=browser/branding/official' >> mozconfig - else + if [[ $GHA_beta == 'true' ]];then echo 'ac_add_options --with-branding=browser/branding/beta' >> mozconfig + else + echo 'ac_add_options --with-branding=browser/branding/official' >> mozconfig fi - echo 'ac_add_options --with-l10n-base=$PWD/l10n-central/l10n-central' >> mozconfig + echo 'ac_add_options --with-l10n-base=$PWD/floorp/browser/locales/l10n-central' >> mozconfig if [[ $GHA_profgen == 'true' ]]; then echo 'ac_add_options --enable-profile-generate=cross' >> mozconfig @@ -234,23 +221,29 @@ jobs: - name: Change update url if beta if: inputs.beta run: | - sed -i 's|https://@MOZ_APPUPDATE_HOST@/browser/%DISPLAY_VERSION%/%OS%/%ARCH%/update.xml|https://@MOZ_APPUPDATE_HOST@/${{github.repository}}/releases/download/beta/WINNT-x86_64.xml |g' ./build/application.ini.in + sed -i 's|https://@MOZ_APPUPDATE_HOST@/browser/%DISPLAY_VERSION%/%OS%/%ARCH%/update.xml|https://@MOZ_APPUPDATE_HOST@/browser/beta/%OS%/%ARCH%/update.xml |g' ./build/application.ini.in #On Package, if not copies, error occur - name: Copy l10n files if beta if: inputs.beta run: | - for dir in $(ls -l $PWD/l10n-central/l10n-central | grep ^d | awk '{print $9}'); do - mkdir -p $PWD/l10n-central/l10n-central/$dir/browser/branding/beta - cp ./browser/branding/beta/locales/en-US/brand.dtd $PWD/l10n-central/l10n-central/$dir/browser/branding/beta/brand.dtd - cp ./browser/branding/beta/locales/en-US/brand.ftl $PWD/l10n-central/l10n-central/$dir/browser/branding/beta/brand.ftl - cp ./browser/branding/beta/locales/en-US/brand.properties $PWD/l10n-central/l10n-central/$dir/browser/branding/beta/brand.properties + for dir in $(ls -l $PWD/floorp/browser/locales/l10n-central | grep ^d | awk '{print $9}'); do + mkdir -p $PWD/floorp/browser/locales/l10n-central/$dir/browser/branding/beta + cp ./browser/branding/beta/locales/en-US/brand.dtd $PWD/floorp/browser/locales/l10n-central/$dir/browser/branding/beta/brand.dtd + cp ./browser/branding/beta/locales/en-US/brand.ftl $PWD/floorp/browser/locales/l10n-central/$dir/browser/branding/beta/brand.ftl + cp ./browser/branding/beta/locales/en-US/brand.properties $PWD/floorp/browser/locales/l10n-central/$dir/browser/branding/beta/brand.properties done + - name: Change Release Note for Japanese + if: inputs.release-note-url-ja + run: | + sed -i 's|https://astian.org/midori-en/|${{inputs.release-note-url-ja}}|g' ./browser/branding/official/pref/firefox-branding.js + echo "$(cat ./browser/branding/official/pref/firefox-branding.js)" + - name: Change Release Note URL if: inputs.release-note-url run: | - sed -i 's|https://blog.ablaze.one/category/ablaze/ablaze-project/floorp/|${{inputs.release-note-url}}|g' ./browser/branding/official/pref/firefox-branding.js + sed -i 's|https://https://astian.org/midori-en/|${{inputs.release-note-url}}|g' ./browser/branding/official/pref/firefox-branding.js echo "$(cat ./browser/branding/official/pref/firefox-branding.js)" - name: Build πŸ”¨ @@ -263,7 +256,7 @@ jobs: ./mach build env: GHA_MOZ_BUILD_DATE: ${{inputs.MOZ_BUILD_DATE}} - + - name: Retry Build if 1st build is failed πŸ”¨ if: failure() run: | @@ -276,20 +269,18 @@ jobs: GHA_MOZ_BUILD_DATE: ${{inputs.MOZ_BUILD_DATE}} - name: Package πŸ“¦ - run: | if [[ -n $GHA_MOZ_BUILD_DATE ]];then export MOZ_BUILD_DATE=$GHA_MOZ_BUILD_DATE fi ./mach package - ./mach package-multi-locale --locales ar cs da de el en-US en-GB es-ES es-MX fr hu id it ja ko lt nl nn-NO pl pt-BR pt-PT ru sv-SE th tr vi zh-CN zh-TW + ./mach package-multi-locale --locales ar cs da de el en-US en-GB es-ES fr hu id it ja ko lt nl nn-NO pl pt-BR pt-PT ru sv-SE th tr uk vi zh-CN zh-TW env: GHA_MOZ_BUILD_DATE: ${{inputs.MOZ_BUILD_DATE}} - name: Copy πŸ“‚ - run: | mkdir ~/output if [[ $GHA_aarch64 == 'true' ]];then @@ -305,11 +296,10 @@ jobs: if [[ $GHA_zstd != 'true' ]];then cp obj-${arch}-pc-windows-msvc/dist/install/sea/midori-*.en-US.${arch_inst}.installer-stub.exe ~/output/midori-stub.installer.exe - cp obj-${arch}-pc-windows-msvc/dist/floorp-*.en-US.${arch_inst}.zip ~/output/ - cp obj-${arch}-pc-windows-msvc/dist/install/sea/midori-*.en-US.${arch_inst}.installer.exe ~/output/midori-${arch_inst}.installer.exe + cp obj-${arch}-pc-windows-msvc/dist/midori-*.en-US.${arch_inst}.zip ~/output/ cp obj-${arch}-pc-windows-msvc/dist/install/sea/midori-*.en-US.${arch_inst}.installer.exe ~/output/midori-${arch_inst}.installer.exe else - tar -I "zstd -T4 -10" --remove-files -cvf ~/output/midori-$(cat browser/config/version.txt).en-us.${arch_inst}.tar.zst midori + cp obj-${arch}-pc-windows-msvc/dist/midori-*.en-US.${arch_inst}.zip ~/output/ 7z x ~/output/midori-*.en-US.${arch_inst}.zip tar -I "zstd -T4 -10" --remove-files -cvf ~/output/midori-$(cat browser/config/version.txt).en-us.${arch_inst}.tar.zst midori rm ~/output/midori-*.en-US.${arch_inst}.zip @@ -333,6 +323,7 @@ jobs: else arch="x86_64" fi + touch "obj-${arch}-pc-windows-msvc/dist/midori/precomplete" MAR="obj-${arch}-pc-windows-msvc/dist/host/bin/mar" \ MOZ_PRODUCT_VERSION=$(cat browser/config/version_display.txt) \ @@ -358,7 +349,7 @@ jobs: GHA_default_name: midori-windows-${{fromJson('["x86","aarch"]')[inputs.aarch64]}}${{fromJson('["_64",""]')[inputs.build32bit]}}-${{fromJson('["package","build-with-profgen"]')[inputs.profgen]}}${{fromJson('["","-zstd"]')[inputs.zstd]}} - name: Publish Package🎁 - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{env.ARTIFACT_NAME}} path: ~/output