Container based build workflow for Linux (#3760)

This commit is contained in:
Yi Huang 2023-07-16 04:53:53 -07:00 коммит произвёл GitHub
Родитель 21ea4975a5
Коммит c926ddb6cb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 11 добавлений и 26 удалений

Просмотреть файл

@ -23,7 +23,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -ForOneBranchPackage
arguments: -ForContainerBuild
- task: DownloadPipelineArtifact@2
inputs:
artifact: drop_build_linux_build_linux_$(openssl_name)_Debug

Просмотреть файл

@ -22,7 +22,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -Tls ${{ parameters.tls }} -ForOneBranch -InitSubmodules
arguments: -Tls ${{ parameters.tls }} -ForContainerBuild
- task: PowerShell@2
displayName: x64
${{ if eq(parameters.tls, 'openssl') }}:

Просмотреть файл

@ -19,7 +19,7 @@ jobs:
inputs:
pwsh: true
filePath: scripts/prepare-machine.ps1
arguments: -InstallXdpSdk -ForOneBranch
arguments: -InstallXdpSdk -ForContainerBuild
- task: PowerShell@2
displayName: x64
target: windows_build_container2

Просмотреть файл

@ -4,6 +4,6 @@
"cpus": 4,
"memory": "2gb"
},
"onCreateCommand": "pwsh -c './scripts/prepare-machine.ps1 -ForOneBranch -InitSubmodules'",
"onCreateCommand": "pwsh -c './scripts/prepare-machine.ps1 -ForContainerBuild'",
"runArgs": ["--privileged"]
}

Просмотреть файл

@ -4,6 +4,6 @@
"cpus": 4,
"memory": "2gb"
},
"onCreateCommand": "pwsh -c './scripts/prepare-machine.ps1 -ForOneBranch -InitSubmodules'",
"onCreateCommand": "pwsh -c './scripts/prepare-machine.ps1 -ForContainerBuild'",
"runArgs": ["--init", "--privileged"]
}

11
.github/workflows/build-reuse-unix.yml поставляемый
Просмотреть файл

@ -78,23 +78,18 @@ jobs:
name: Build
runs-on: ${{ inputs.os }}
container:
image: ${{ inputs.plat == 'linux' && contains(inputs.arch, 'arm') && format('ghcr.io/microsoft/msquic/linux-build-xcomp:{0}', inputs.os) || '' }}
image: ${{ inputs.plat == 'linux' && format('ghcr.io/microsoft/msquic/linux-build-xcomp:{0}', inputs.os) || '' }}
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set ownership
if: inputs.plat == 'linux' && contains(inputs.arch, 'arm')
if: inputs.plat == 'linux'
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Prepare Machine
if: contains(inputs.arch, 'arm') != true
shell: pwsh
run: scripts/prepare-machine.ps1 -ForBuild -Tls ${{ inputs.tls }}
- name: Prepare Machine
if: contains(inputs.arch, 'arm') == true
shell: pwsh
run: scripts/prepare-machine.ps1 -ForOneBranch -InitSubmodules -Tls ${{ inputs.tls }}
run: scripts/prepare-machine.ps1 ${{ inputs.plat == 'linux' && '-ForContainerBuild' || '-ForBuild' }} -Tls ${{ inputs.tls }}
- name: Build For Test
if: inputs.test == '-Test'
shell: pwsh

Просмотреть файл

@ -10,9 +10,6 @@ on the provided configuration.
.PARAMETER Force
Overwrite and force installation of all dependencies.
.PARAMETER InitSubmodules
Dynamically initializes submodules based Tls and Extra configuration knobs.
.PARAMETER ForKernel
Indicates build is for kernel mode.
@ -41,10 +38,7 @@ param (
[switch]$Force,
[Parameter(Mandatory = $false)]
[switch]$ForOneBranch,
[Parameter(Mandatory = $false)]
[switch]$ForOneBranchPackage,
[switch]$ForContainerBuild,
[Parameter(Mandatory = $false)]
[switch]$ForBuild,
@ -55,9 +49,6 @@ param (
[Parameter(Mandatory = $false)]
[switch]$ForKernel,
[Parameter(Mandatory = $false)]
[switch]$InitSubmodules,
[Parameter(Mandatory = $false)]
[switch]$InstallSigningCertificates,
@ -129,7 +120,7 @@ if ($UseXdp) {
}
}
if (!$ForOneBranch -and !$ForOneBranchPackage -and !$ForBuild -and !$ForTest -and !$InstallXdpDriver -and !$UninstallXdp) {
if (!$ForContainerBuild -and !$ForBuild -and !$ForTest -and !$InstallXdpDriver -and !$UninstallXdp) {
# When no args are passed, assume we want to build and test everything
# locally (i.e. a dev environment). Set Tls to OpenSSL to make sure
# everything is available.
@ -144,7 +135,6 @@ if ($ForBuild) {
$InstallNasm = $true
$InstallJom = $true
$InstallXdpSdk = $true
$InitSubmodules = $true
$InstallCoreNetCiDeps = $true; # For kernel signing certs
}
@ -492,7 +482,7 @@ if ($ForKernel) {
git rm submodules/openssl3
}
if ($InitSubmodules) {
if ($ForBuild -or $ForContainerBuild) {
Write-Host "Initializing clog submodule"
git submodule init submodules/clog