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

fix Cygwin build

fix Cygwin build #131

Workflow file for this run

name: CI
on:
push:
branches-ignore:
- main
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"
dpkg_arch: "amd64"
extra_patches: "patches-contrib/Magisk/0021-workaround-revert-extract_if-to-drain_filter-rename.patch"
upload: "yes"
- os: "ubuntu"
tag: "jammy"
note: "glibc-i368-static"
cmake_flag: "-DPREFER_STATIC_LINKING=ON"
dpkg_arch: "i386"
extra_patches: "patches-contrib/Magisk/0021-workaround-revert-extract_if-to-drain_filter-rename.patch"
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: |
_arch=${{ matrix.dpkg_arch }}
dpkg --add-architecture $_arch
apt update
DEBIAN_FRONTEND=noninteractive apt install -y curl tar patch file python3 \
libc6-dev:$_arch binutils:$_arch liblzma-dev:$_arch liblz4-dev:$_arch \
libbz2-dev:$_arch zlib1g-dev:$_arch pkg-config:$_arch clang-15:$_arch \
libc++-15-dev:$_arch libc++abi-15-dev:$_arch cmake:$_arch \
ninja-build:$_arch rustc:$_arch cargo:$_arch
unset _arch
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 linux-headers curl file xz-dev lz4-dev bzip2-dev zlib-dev \
python3 pkgconf clang libc++-dev cmake samurai rust cargo
- name: Prepare (archlinux)
if: matrix.os == 'archlinux'
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm --needed curl file base-devel xz lz4 bzip2 python \
zlib pkgconf clang libc++ cmake ninja rust
- name: Build
run: |
echo -e "\n### extract source ###\n"
tar -xf magiskboot_*-src.tar.xz
cd magiskboot_*-src/
echo -e "\n### patch source ###\n"
./scripts/apply_patches.py ${{ matrix.extra_patches }}
echo -e "\n### configure ###\n"
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_flag }}
echo -e "\n### make ###\n"
cmake --build build -j $(nproc)
file build/magiskboot
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-standalone"
steps:
- name: Prepare (source)
uses: actions/download-artifact@v3
with:
name: srcpkg
- name: Prepare
run: |
brew install --overwrite coreutils file xz lz4 \
bzip2 zlib pkg-config cmake ninja rust
- 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"
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release \
-DPREFER_STATIC_LINKING=ON
echo -e "\n### make ###\n"
cmake --build build -j $(nproc)
file build/magiskboot
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]
strategy:
matrix:
include:
- msystem: CLANG32
note: "ucrt-i686-standalone"
upload: "yes"
- msystem: MINGW32
note: "msvcrt-i686-standalone"
upload: "yes"
- msystem: CLANG64
note: "ucrt-x86_64-standalone"
upload: "yes"
- msystem: MINGW64
note: "msvcrt-x86_64-standalone"
upload: "yes"
- msystem: UCRT64
note: "ucrt-x86_64-standalone"
env:
MSYS: "winsymlinks:native"
MAGISKBOOT_WINSUP_NOCASE: 1
upload_prefix: "windows-mingw-w64"
steps:
- name: Prepare (source)
uses: actions/download-artifact@v3
with:
name: srcpkg
- name: Prepare
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
base-devel file
pacboy: >-
xz:p lz4:p bzip2:p zlib:p pkgconf:p clang:p
lld:p cmake:p libc++:p ninja:p rust:p
- 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"
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release \
-DPREFER_STATIC_LINKING=ON
echo -e "\n### make ###\n"
cmake --build build -j $(nproc)
file build/magiskboot.exe
ldd build/magiskboot.exe
./build/magiskboot.exe || true
cp -afv build/magiskboot.exe $GITHUB_WORKSPACE/magiskboot.exe
- name: Upload artifacts
if: matrix.upload == 'yes'
uses: actions/upload-artifact@v3
with:
name: ${{ env.progname }}-${{ needs.vars.outputs.short_sha }}-${{ env.upload_prefix }}-${{ matrix.note }}
path: ${{ github.workspace }}/magiskboot.exe