Skip to content

Commit

Permalink
Migrate to Workflow_call
Browse files Browse the repository at this point in the history
  • Loading branch information
Ponchale committed Oct 13, 2023
1 parent 3d72193 commit 7f36905
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 47 deletions.
84 changes: 38 additions & 46 deletions .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,46 +82,10 @@ jobs:

Part2-win-x86_64-gen-profdata-and-jarlog:
needs: Part1-win-x86_64-build-with-profgen-zstd
runs-on: windows-2022

steps:
- uses: actions/download-artifact@v3
name: Download artifact 📥
with:
name: midori-windows-x86_64-build-with-profgen-zstd
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 🧬

- 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-x86_64-profdata-and-jarlog
path: |
merged.profdata
en-US.log
uses: ./.github/workflows/window-generate-profile-data-and-jarlog.yml
with:
browser-artifact-name: midori-windows-x86_64-build-with-profgen-zstd
arch: x86_64

Part3-win-x86_64-build-with-profdata-and-jarlog:
needs: [Part2-win-x86_64-gen-profdata-and-jarlog, get-buildid]
Expand All @@ -136,19 +100,40 @@ jobs:
MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}}
release-note-url: ${{ inputs.release-note-url }}

################################################################ ↑ Windows x86_64 Build ####################################################################################
################################################################ ↑ Windows x86_64 Build ###################################################################################

Part1-linux-x86_64-build-with-PGO:
uses: ./.github/workflows/linux-build.yml
needs: [get-buildid]
Part1-win-x86-build-with-profgen-zstd:
uses: ./.github/workflows/windows-build.yml
with:
profgen: true
aarch64: false
build32bit: true
zstd: true
buildjet: ${{ inputs.buildjet }}

Part2-win-x86-gen-profdata-and-jarlog:
needs: Part1-win-x86-build-with-profgen-zstd
uses: ./.github/workflows/window-generate-profile-data-and-jarlog.yml
with:
browser-artifact-name: midori-windows-x86-build-with-profgen-zstd
arch: x86

Part3-win-x86-build-with-profdata-and-jarlog:
needs: [Part2-win-x86-gen-profdata-and-jarlog, get-buildid]
uses: ./.github/workflows/windows-build.yml
with:
aarch64: false
beta: false
mar: true
build32bit: true
beta: false
buildjet: ${{ inputs.buildjet }}
profdata_jarlog_artifact_name: "midori-windows-x86-profdata-and-jarlog"
out_artifact_name: please-use-this-midori-windows-x86-package-build-with-profdata-and-jarlog
MOZ_BUILD_DATE: ${{needs.get-buildid.outputs.buildids}}
release-note-url: ${{ inputs.release-note-url }}

################################################################ ↑ Windows x86 Build ####################################################################################

################################################################ ↑ Linux x86_64 Build ####################################################################################
Part1-linux-aarch64-build:
uses: ./.github/workflows/linux-build.yml
Expand Down Expand Up @@ -284,7 +269,7 @@ jobs:
####################################################################### macOS Universal #######################################################################

Deploy-to-installer:
needs: [Part1-linux-x86_64-build-with-PGO, Part1-linux-aarch64-build, Part4-macOS-Universal-package-and-sign, Part3-win-x86_64-build-with-profdata-and-jarlog, get-display-version]
needs: [Part1-linux-x86_64-build-with-PGO, Part1-linux-aarch64-build, Part4-macOS-Universal-package-and-sign, Part3-win-x86_64-build-with-profdata-and-jarlog, Part3-win-x86-build-with-profdata-and-jarlog, get-display-version]
runs-on: ubuntu-latest
environment:
name: Deploy-to-installer-release
Expand All @@ -302,6 +287,7 @@ jobs:
mkdir -p ~/downloads/artifacts/linux-x64
mkdir -p ~/downloads/artifacts/linux-aarch64
mkdir -p ~/downloads/artifacts/windows-x64
mkdir -p ~/downloads/artifacts/windows-x86
mkdir -p ~/downloads/artifacts/macOS-x64
- name: download Linux x86_64 build artifact 📥
Expand All @@ -322,6 +308,12 @@ jobs:
name: please-use-this-midori-windows-x86_64-package-build-with-profdata-and-jarlog
path: ~/downloads/artifacts/windows-x64

- name: download Windows x86 build artifact📥
uses: actions/download-artifact@v3
with:
name: please-use-this-midori-windows-x86-package-build-with-profdata-and-jarlog
path: ~/downloads/artifacts/windows-x86

- name: download macOS Universal build artifact📥
uses: actions/download-artifact@v3
with:
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/window-generate-profile-data-and-jarlog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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:
Integration:
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 🧬

- 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
2 changes: 1 addition & 1 deletion .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ jobs:
fs.appendFileSync(process.env.GITHUB_ENV, `ARTIFACT_NAME=${name}`);
env:
GHA_out_artifact_name : ${{inputs.out_artifact_name}}
GHA_default_name: midori-windows-${{fromJson('["x86_64","aarch64"]')[inputs.aarch64]}}-${{fromJson('["package","build-with-profgen"]')[inputs.profgen]}}${{fromJson('["","-zstd"]')[inputs.zstd]}}
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
Expand Down

0 comments on commit 7f36905

Please sign in to comment.