Skip to content

Commit

Permalink
Remove manylinux container
Browse files Browse the repository at this point in the history
  • Loading branch information
idavis committed Oct 18, 2023
1 parent 79f8716 commit b929941
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 168 deletions.
5 changes: 2 additions & 3 deletions .github/actions/install-llvm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ runs:
shell: pwsh
if: ${{ (inputs.os == 'ubuntu-20.04') && (steps.cache-llvm.outputs.cache-hit != 'true') }}
- name: Windows - Install build dependencies, ninja
run: |
run: |
choco install --accept-license -y ninja
choco uninstall -y llvm
shell: pwsh
Expand All @@ -55,7 +55,6 @@ runs:

- name: Install LLVM
run: |
$target_prefix = if("${{ inputs.target }}" -eq "manylinux") {"manylinux-"} else {""}
./build.ps1 -t "$($target_prefix)install-llvm-from-source"
./build.ps1 -t install-llvm-from-source
shell: pwsh
if: ${{ steps.cache-llvm.outputs.cache-hit != 'true' }}
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
target: "checks",
env: {},
}
- {
os: "ubuntu-20.04",
arch: "amd64",
target: "manylinux",
env: {},
}
- {
os: "ubuntu-20.04",
arch: "amd64",
Expand Down Expand Up @@ -83,7 +77,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: manylinux-artifacts
path: target/wheels/*manylinux_2_17*.whl
path: target/wheels/*manylinux_2_*.whl
if: ${{ matrix.config.os == 'ubuntu-20.04' }}
- name: Artifacts
uses: actions/upload-artifact@v2
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
config:
- {
os: "ubuntu-22.04",
os: "ubuntu-20.04",
arch: "amd64",
env: {},
}
Expand All @@ -39,7 +39,7 @@ jobs:
submodules: 'recursive'
- name: Linux - Install build dependencies, ccache, ninja
run: sudo apt-get install -y ccache ninja-build
if: ${{ matrix.config.os == 'ubuntu-22.04' }}
if: ${{ matrix.config.os == 'ubuntu-20.04' }}
- name: Windows - Install build dependencies, sccache, ninja
run: choco install --accept-license -y sccache ninja
if: ${{ matrix.config.os == 'windows-2019' }}
Expand All @@ -52,11 +52,6 @@ jobs:
- name: "Build and Package LLVM"
run: ./build.ps1 -t package-llvm
shell: pwsh
if: ${{ matrix.config.os != 'ubuntu-22.04' }}
- name: "Build and Package LLVM for manylinux"
run: ./build.ps1 -t package-manylinux-llvm
shell: pwsh
if: ${{ matrix.config.os == 'ubuntu-22.04' }}
- name: Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
3 changes: 0 additions & 3 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,3 @@ be linked into the rest of the build.
The `build.ps1`, `maturin` builds all generate Python wheels to the
`target/wheels` folder. The default Python3 installation will be used targeting
Python ABI 3.7.

The manylinux support uses a Docker image in the build scripts to run the builds
in the CI environment.
11 changes: 5 additions & 6 deletions eng/Dockerfile.examples
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@

ARG RELEASE=jammy

FROM buildpack-deps:buster-scm AS buster
FROM buildpack-deps:bullseye-scm AS bullseye

RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends powershell python3-minimal python3-pip python3-setuptools sudo \
&& rm -rf /var/lib/apt/lists/*

FROM buildpack-deps:bullseye-scm AS bullseye
FROM buildpack-deps:bookworm-scm AS bookworm

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list \
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bookworm-prod bookworm main" > /etc/apt/sources.list.d/microsoft.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends powershell python3-minimal python3-pip python3-setuptools sudo \
&& rm -rf /var/lib/apt/lists/*
Expand Down
64 changes: 0 additions & 64 deletions eng/Dockerfile.manylinux

This file was deleted.

83 changes: 5 additions & 78 deletions eng/psakefile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,12 @@ Properties {
$VscodeSettingsJson = Join-Path $Root .vscode settings.json
$DocsRoot = Join-Path $Root docs
$DocsBuild = Join-Path $DocsRoot _build
$ManylinuxTag = "manylinux2014_x86_64_maturin"
$ManylinuxRoot = "/io"
$Python = Resolve-Python
}

task default -depends build, run-examples
task build -depends qirlib, pyqir
task checks -depends cargo-fmt, cargo-clippy, black, mypy
task manylinux -depends build-manylinux-container-image, run-manylinux-container-image, run-examples-in-containers

task run-manylinux-container-image -preaction { Write-CacheStats } -postaction { Write-CacheStats } {
$llvmDir = Resolve-InstallationDirectory
$llvmMount = @("-v", "$($llvmDir):/tmp/llvm")
Write-BuildLog "Running container image: $ManylinuxTag"
$ioVolume = "${Root}:$ManylinuxRoot"
$userName = Get-LinuxContainerUserName

Invoke-LoggedCommand {
docker run --rm `
--user $userName `
--volume $ioVolume @llvmMount `
--env QIRLIB_CACHE_DIR=/tmp/llvm `
--workdir $ManylinuxRoot `
$ManylinuxTag `
conda run --no-capture-output pwsh build.ps1 -t default
}
}

task cargo-fmt {
Invoke-LoggedCommand -workingDirectory $Root -errorMessage "Please run 'cargo fmt --all' before pushing" {
Expand Down Expand Up @@ -77,8 +56,11 @@ task qirlib -depends init {
task pyqir -depends init {
$env:MATURIN_PEP517_ARGS = (Get-CargoArgs) -Join " "
Get-Wheels pyqir | Remove-Item
Invoke-LoggedCommand { pip --verbose wheel --wheel-dir $Wheels $Pyqir }
Invoke-LoggedCommand { & $Python -m pip --verbose wheel --wheel-dir $Wheels $Pyqir }

if ($IsLinux) {
Invoke-LoggedCommand { & $Python -m pip install auditwheel }
}
if (Test-CommandExists auditwheel) {
$unauditedWheels = Get-Wheels pyqir
Invoke-LoggedCommand { auditwheel repair --wheel-dir $Wheels $unauditedWheels }
Expand Down Expand Up @@ -179,41 +161,6 @@ task install-llvm-from-source -depends configure-sccache -postaction { Write-Cac
Assert (Test-LlvmConfig $installationDirectory) "install-llvm-from-source failed to install a usable LLVM installation"
}

task manylinux-install-llvm-from-source -depends build-manylinux-container-image -preaction { Write-CacheStats } -postaction { Write-CacheStats } {
$llvmDir = Resolve-InstallationDirectory
$llvmMount = @("-v", "$($llvmDir):/tmp/llvm")
Write-BuildLog "Running container image: $ManylinuxTag"
$ioVolume = "${Root}:$ManylinuxRoot"
$userName = Get-LinuxContainerUserName

Invoke-LoggedCommand {
docker run --rm `
--user $userName `
--volume $ioVolume @llvmMount `
--workdir $ManylinuxRoot `
$ManylinuxTag `
conda run --no-capture-output pwsh build.ps1 -t install-llvm-from-source
}
}

task package-manylinux-llvm -depends build-manylinux-container-image -preaction { Write-CacheStats } -postaction { Write-CacheStats } {
$llvmDir = Resolve-InstallationDirectory
$llvmMount = @("-v", "$($llvmDir):/tmp/llvm")
Write-BuildLog "Running container image: $ManylinuxTag"
$ioVolume = "${Root}:$ManylinuxRoot"
$userName = Get-LinuxContainerUserName

Invoke-LoggedCommand {
docker run --rm `
--user $userName `
--volume $ioVolume @llvmMount `
--workdir $ManylinuxRoot `
--env QIRLIB_PKG_DEST=$ManylinuxRoot/target/manylinux `
$ManylinuxTag `
conda run --no-capture-output pwsh build.ps1 -t package-llvm
}
}

task package-llvm {
if ($IsWindows) {
Include vcvars.ps1
Expand All @@ -236,32 +183,12 @@ task package-llvm {
}
}

task build-manylinux-container-image {
Write-BuildLog "Building container image manylinux-llvm-builder"
$RustVersion = (rustc --version) -split " " -match "^(\d+\.)?(\d+\.)?(\*|\d+)$"
Write-BuildLog "Found rustc version $RustVersion"
Invoke-LoggedCommand -workingDirectory (Join-Path $Root eng) {
$user = Get-LinuxContainerUserName
$uid = Get-LinuxContainerUserId
$gid = Get-LinuxContainerGroupId
docker build `
--build-arg USERNAME=$user `
--build-arg USER_UID=$uid `
--build-arg USER_GID=$gid `
--build-arg RUST_TOOLCHAIN=$RustVersion `
--tag $ManylinuxTag `
-f Dockerfile.manylinux `
$Root
}
}

# This is only usable if building for manylinux
task run-examples-in-containers {
$user = Get-LinuxContainerUserName
$uid = Get-LinuxContainerUserId
$gid = Get-LinuxContainerGroupId

foreach ($release in @("buster", "bullseye", "focal", "jammy")) {
foreach ($release in @("bullseye", "bookworm", "focal", "jammy")) {
exec -workingDirectory (Join-Path $Root eng) {
Get-Content Dockerfile.examples | docker build `
--build-arg RELEASE=$release `
Expand Down

0 comments on commit b929941

Please sign in to comment.