Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

mingw: initial support for UCRT based environments #103

mingw: initial support for UCRT based environments

mingw: initial support for UCRT based environments #103

Workflow file for this run

name: CI
on:
push:
paths-ignore:
- '.github/workflows/release.yaml'
- 'LICENSE'
- 'README.md'
pull_request:
paths-ignore:
- '.github/workflows/release.yaml'
- 'LICENSE'
- 'README.md'
env:
progname: "magiskboot"
permissions:
contents: read
jobs:
vars:
name: Prepare (variables)
runs-on: ubuntu-latest
permissions:
contents: none
outputs:
short_sha: ${{ steps.get_short_sha.outputs.SHORT_SHA }}
steps:
- name: Determine short Git commit SHA
id: get_short_sha
run: |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c 1-7`" >> $GITHUB_OUTPUT
src:
name: Prepare (source)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Prepare
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake ninja-build
- name: Prepare (Git)
run: |
git config --global user.email "[email protected]"
git config --global user.name "Example user"
- name: Package source
run: |
cmake -B build -G Ninja -DNO_TARGETS_OR_DEPS=ON
cmake --build build -t package_source
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: srcpkg
path: ${{ github.workspace }}/build/magiskboot_*-src.tar.xz
build-linux:
name: Build (Linux)
runs-on: ubuntu-latest
needs: [vars, src]
strategy:
matrix:
include:
- os: "ubuntu"
tag: "jammy"
note: "glibc-x86_64-static"
cmake_flag: "-DPREFER_STATIC_LINKING=ON"
upload: "yes"
- os: "alpine"
tag: "edge"
note: "musl-x86_64"
- os: "archlinux"
tag: "latest"
note: "glibc-x86_64"
container:
image: ${{ matrix.os }}:${{ matrix.tag }}
volumes:
- ${{ github.workspace }}:/workspace
# New versions of glibc use the new clone3() syscall which has not
# yet been whitelisted in GitHub's secomp profile. To prevent jobs
# using these distros from failing (e.g. openSUSE) change the
# secomp policy.
#
# See https://github.com/nmeum/android-tools/pull/48#issuecomment-944893176
options: --security-opt seccomp=unconfined
steps:
- name: Prepare (source)
uses: actions/download-artifact@v3
with:
name: srcpkg
- name: Prepare (Ubuntu)
if: matrix.os == 'ubuntu'
run: |
apt update
DEBIAN_FRONTEND=noninteractive apt install -y curl build-essential lzma-dev \
liblzma-dev liblz4-dev libbz2-dev zlib1g-dev pkgconf clang-15 \
libc++-15-dev libc++abi-15-dev cmake ninja-build libbsd-dev
ln -s $(which clang-15) $(dirname $(which clang-15))/clang
ln -s $(which clang++-15) $(dirname $(which clang-15))/clang++
- name: Prepare (Alpine Linux)
if: matrix.os == 'alpine'
run: |
apk update
apk add build-base curl xz-dev lz4-dev bzip2-dev zlib-dev \
pkgconf clang libc++-dev cmake samurai libbsd-dev
- name: Prepare (archlinux)
if: matrix.os == 'archlinux'
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm --needed curl base-devel xz lz4 bzip2 \
zlib pkgconf clang libc++ cmake ninja libbsd
- name: Prepare (Rust)
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
. "$HOME/.cargo/env"
rustup component add rust-src
- name: Build
run: |
echo -e "\n### extract source ###\n"
tar -xf magiskboot_*-src.tar.xz
cd magiskboot_*-src/
echo -e "\n### configure ###\n"
. "$HOME/.cargo/env"
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_flag }}
echo -e "\n### make ###\n"
cmake --build build -j $(nproc)
ldd build/magiskboot || true
./build/magiskboot || true
cp -afv build/magiskboot /workspace/magiskboot
- name: Upload artifacts
if: matrix.upload == 'yes'
uses: actions/upload-artifact@v3
with:
name: ${{ env.progname }}-${{ needs.vars.outputs.short_sha }}-${{ matrix.os }}-${{ matrix.tag }}-${{ matrix.note }}
path: ${{ github.workspace }}/magiskboot
build-macos:
name: Build (macOS)
strategy:
matrix:
os_release: [11, 12, 13]
runs-on: macos-${{ matrix.os_release }}
needs: [vars, src]
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
upload_suffix: "x86_64-static"
steps:
- name: Prepare (source)
uses: actions/download-artifact@v3
with:
name: srcpkg
- name: Prepare
run: |
brew install --overwrite coreutils xz lz4 bzip2 \
zlib pkg-config cmake ninja rustup-init
- name: Prepare (Rust)
run: |
rustup-init -y --default-toolchain nightly
. "$HOME/.cargo/env"
rustup component add rust-src
- name: Fix up Rust
if: matrix.os_release == 13
run: |
rm -rf ~/.cargo/registry/index
- name: Build
run: |
echo -e "\n### extract source ###\n"
tar -xf magiskboot_*-src.tar.xz
cd magiskboot_*-src/
echo -e "\n### configure ###\n"
. "$HOME/.cargo/env"
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release \
-DPREFER_STATIC_LINKING=ON
echo -e "\n### make ###\n"
cmake --build build -j $(nproc)
otool -L build/magiskboot
./build/magiskboot || true
cp -afv build/magiskboot $GITHUB_WORKSPACE/magiskboot
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.progname }}-${{ needs.vars.outputs.short_sha }}-macos-${{ matrix.os_release }}-${{ env.upload_suffix }}
path: ${{ github.workspace }}/magiskboot
build-windows:
name: Build (Windows)
runs-on: windows-latest
needs: [vars, src]
env:
MSYS: "winsymlinks:native"
MAGISKBOOT_WINSUP_NOCASE: 1
upload_suffix: "windows-mingw-w64-x86_64-static"
steps:
- name: Prepare (source)
uses: actions/download-artifact@v3
with:
name: srcpkg
- name: Prepare
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
base-devel
pacboy: >-
xz:x lz4:x bzip2:x zlib:x pkgconf:x
clang:x lld:x cmake:x libc++:x ninja:x
- name: Prepare (Rust)
shell: msys2 {0}
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y \
--default-toolchain nightly \
--default-host x86_64-pc-windows-gnu
echo 'export PATH=$(cygpath ${USERPROFILE}\\.cargo\\bin):$PATH' > $(cygpath $USERPROFILE)/.cargo/env
. "$(cygpath $USERPROFILE)/.cargo/env"
rustup component add rust-src
- name: Build
shell: msys2 {0}
run: |
echo -e "\n### extract source ###\n"
tar -xf magiskboot_*-src.tar.xz
cd magiskboot_*-src/
echo -e "\n### configure ###\n"
. "$(cygpath $USERPROFILE)/.cargo/env"
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release \
-DPREFER_STATIC_LINKING=ON
echo -e "\n### make ###\n"
cmake --build build -j $(nproc)
ldd build/magiskboot.exe
./build/magiskboot.exe || true
cp -afv build/magiskboot.exe $GITHUB_WORKSPACE/magiskboot.exe
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.progname }}-${{ needs.vars.outputs.short_sha }}-${{ env.upload_suffix }}
path: ${{ github.workspace }}/magiskboot.exe