Build erofs-utils #464
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build erofs-utils | |
on: | |
push: | |
branches: [ "dev" ] | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Push a new release' | |
required: false | |
default: 'false' | |
version: | |
description: 'Version' | |
required: false | |
default: 'v1.8.1-24081000' | |
jobs: | |
release: | |
needs: [ Build-on-Ubuntu, Build-on-macOS ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled() | |
- name: Version | |
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled() | |
run: | | |
ARTIFACT_DIR=$(ls); for name in ${ARTIFACT_DIR}; do chmod +x ${name}/*; touch -c -d "2009-01-01 00:00:00" ${name}/*; zip -9 -jy "${name}.zip" ${name}/* > /dev/null 2>&1; done; | |
ls -lahR | |
- name: Upload release | |
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled() | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
removeArtifacts: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ github.event.inputs.version }} | |
tag: ${{ github.event.inputs.version }} | |
body: This release is built by github-action. | |
artifacts: "*.zip" | |
Build-on-Ubuntu: | |
runs-on: ubuntu-24.04 | |
env: | |
TZ: UTC-8 | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_HARDLINK: "true" | |
CCACHE_BASEDIR: "${{ github.workspace }}" | |
AARCH64_TOOLS_PATH: "/opt/aarch64" | |
LOONGARCH64_TOOLS_PATH: "/opt/loongarch64" | |
cygwin_prebuilt_packages: "deb [trusted=yes] https://github.com/affggh/deb-cygwin-debian/releases/download/snapshot-deb ./" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- name: Update system and install dependencies | |
run: | | |
sudo apt update -y | |
sudo apt install llvm ninja-build -y | |
- name: Install NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r27c | |
local-cache: false | |
- name: Download and install clang+llvm | |
run: | | |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz | |
tar -xf clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz -C /opt | |
echo "CUSTOM_CLANG_PATH=/opt/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04" >> $GITHUB_ENV | |
- name: Setup cygwin cross toolchains | |
run: | | |
echo "${{ env.cygwin_prebuilt_packages }}" > sources.list | |
sudo cp -af sources.list /etc/apt/sources.list.d/deb-cygwin.list | |
rm -f sources.list | |
sudo apt-get update && sudo apt-get install cygwin cygwin-gcc cygwin-libiconv cygwin-xclang cygwin-libc++ | |
- name: Set up cache aarch64 tools | |
id: cache-aarch64-tools | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.AARCH64_TOOLS_PATH }} | |
key: ${{ runner.os }}-aarch64_tools_231221 | |
- name: Download and install aarch64 tools | |
if: steps.cache-aarch64-tools.outputs.cache-hit != 'true' | |
run: | | |
wget https://github.com/sekaiacg/erofs-utils/releases/download/v1.7.1-231221/gcc-linaro-14.0.0-2023.06-x86_64_aarch64-linux-gnu.tar.xz | |
mkdir ${AARCH64_TOOLS_PATH} | |
tar -xf gcc-linaro-14.0.0-2023.06-x86_64_aarch64-linux-gnu.tar.xz -C ${AARCH64_TOOLS_PATH} | |
- name: Set up aarch64 tools | |
run: | | |
echo "AARCH64_GCC_PATH=${AARCH64_TOOLS_PATH}/gcc-linaro-14.0.0-2023.06-x86_64_aarch64-linux-gnu" >> $GITHUB_ENV | |
- name: Set up cache loongarch64 tools | |
id: cache-loongarch64-tools | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LOONGARCH64_TOOLS_PATH }} | |
key: ${{ runner.os }}-loongarch64_tools_230927 | |
- name: Download and install loongarch64 tools | |
if: steps.cache-loongarch64-tools.outputs.cache-hit != 'true' | |
run: | | |
wget https://github.com/loongson/build-tools/releases/download/2023.08.08/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz | |
mkdir ${LOONGARCH64_TOOLS_PATH} | |
tar -xf CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz -C ${LOONGARCH64_TOOLS_PATH} | |
- name: Set up loongarch64 tools | |
run: | | |
echo "LD_LIBRARY_PATH=${LOONGARCH64_TOOLS_PATH}/cross-tools/target/usr/lib64:${LOONGARCH64_TOOLS_PATH}/cross-tools/loongarch64-unknown-linux-gnu/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
echo "PATH=$GITHUB_WORKSPACE:${LOONGARCH64_TOOLS_PATH}/cross-tools/bin:$PATH" >> $GITHUB_ENV | |
echo "LOONGARCH64_GCC_PATH=${LOONGARCH64_TOOLS_PATH}/cross-tools" >> $GITHUB_ENV | |
- name: Setup ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ runner.os }} | |
restore-keys: ${{ runner.os }} | |
- name: Build erofs-utils | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
run: | | |
chmod a+x build.sh | |
./build.sh | |
chmod a+x build_cygwin.sh | |
./build_cygwin.sh | |
- name: Prepare artifact | |
if: success() | |
id: Artifact | |
run: | | |
echo "androidArmv8aDir=target/Android_arm64-v8a" >> $GITHUB_OUTPUT | |
androidArm64v8aName=`ls -d target/Android_arm64-v8a/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "androidArm64v8aName=$androidArm64v8aName" >> $GITHUB_OUTPUT | |
echo "androidArmeabiv7Dir=target/Android_armeabi-v7a" >> $GITHUB_OUTPUT | |
androidArmeabiv7aName=`ls -d target/Android_armeabi-v7a/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "androidArmeabiv7aName=$androidArmeabiv7aName" >> $GITHUB_OUTPUT | |
echo "androidX86x64Dir=target/Android_x86_64" >> $GITHUB_OUTPUT | |
androidX86x64Name=`ls -d target/Android_x86_64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "androidX86x64Name=$androidX86x64Name" >> $GITHUB_OUTPUT | |
echo "androidX86Dir=target/Android_x86" >> $GITHUB_OUTPUT | |
androidX86Name=`ls -d target/Android_x86/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "androidX86Name=$androidX86Name" >> $GITHUB_OUTPUT | |
echo "linuxX86x64Dir=target/Linux_x86_64" >> $GITHUB_OUTPUT | |
linuxX86x64Name=`ls -d target/Linux_x86_64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "linuxX86x64Name=$linuxX86x64Name" >> $GITHUB_OUTPUT | |
echo "wslX86x64Dir=target/WSL_x86_64" >> $GITHUB_OUTPUT | |
wslX86x64Name=`ls -d target/WSL_x86_64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "wslX86x64Name=$wslX86x64Name" >> $GITHUB_OUTPUT | |
echo "linuxAarch64Dir=target/Linux_aarch64" >> $GITHUB_OUTPUT | |
linuxAarch64Name=`ls -d target/Linux_aarch64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "linuxAarch64Name=$linuxAarch64Name" >> $GITHUB_OUTPUT | |
echo "linuxLoongarch64Dir=target/Linux_loongarch64" >> $GITHUB_OUTPUT | |
linuxLoongarch64Name=`ls -d target/Linux_loongarch64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "linuxLoongarch64Name=$linuxLoongarch64Name" >> $GITHUB_OUTPUT | |
echo "cygwinX86x64Dir=target/Cygwin_x86_64" >> $GITHUB_OUTPUT | |
cygwinX86x64Name=`ls -d target/Cygwin_x86_64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "cygwinX86x64Name=$cygwinX86x64Name" >> $GITHUB_OUTPUT | |
- name: Upload erofs-utils Android_arm64-v8a | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.androidArm64v8aName }} | |
path: '${{ steps.Artifact.outputs.androidArmv8aDir }}/${{ steps.Artifact.outputs.androidArm64v8aName }}/*' | |
- name: Upload erofs-utils Android_armeabi-v7a | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.androidArmeabiv7aName }} | |
path: '${{ steps.Artifact.outputs.androidArmeabiv7Dir }}/${{ steps.Artifact.outputs.androidArmeabiv7aName }}/*' | |
- name: Upload erofs-utils Android_x86_64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.androidX86x64Name }} | |
path: '${{ steps.Artifact.outputs.androidX86x64Dir }}/${{ steps.Artifact.outputs.androidX86x64Name }}/*' | |
- name: Upload erofs-utils Android_x86 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.androidX86Name }} | |
path: '${{ steps.Artifact.outputs.androidX86Dir }}/${{ steps.Artifact.outputs.androidX86Name }}/*' | |
- name: Upload erofs-utils Linux_x86_64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.linuxX86x64Name }} | |
path: '${{ steps.Artifact.outputs.linuxX86x64Dir }}/${{ steps.Artifact.outputs.linuxX86x64Name }}/*' | |
- name: Upload erofs-utils WSL_x86_64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.wslX86x64Name }} | |
path: '${{ steps.Artifact.outputs.wslX86x64Dir }}/${{ steps.Artifact.outputs.wslX86x64Name }}/*' | |
- name: Upload erofs-utils Linux_aarch64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.linuxAarch64Name }} | |
path: '${{ steps.Artifact.outputs.linuxAarch64Dir }}/${{ steps.Artifact.outputs.linuxAarch64Name }}/*' | |
- name: Upload erofs-utils Linux_loongarch64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.linuxLoongarch64Name }} | |
path: '${{ steps.Artifact.outputs.linuxLoongarch64Dir }}/${{ steps.Artifact.outputs.linuxLoongarch64Name }}/*' | |
- name: Upload erofs-utils Cygwin_x86_64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.Artifact.outputs.cygwinX86x64Name }} | |
path: "${{ steps.Artifact.outputs.cygwinX86x64Dir }}/${{ steps.Artifact.outputs.cygwinX86x64Name }}/*" | |
Build-on-macOS: | |
runs-on: macos-latest | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_HARDLINK: "true" | |
CCACHE_BASEDIR: "${{ github.workspace }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: brew install ccache ninja | |
- name: Setup ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ runner.os }} | |
restore-keys: ${{ runner.os }} | |
- name: Build erofs-utils | |
run: | | |
chmod a+x build_darwin.sh | |
./build_darwin.sh | |
- name: Prepare artifact | |
if: success() | |
id: prepareArtifact | |
run: | | |
echo "darwinX86x64Dir=target/Darwin_x86_64" >> $GITHUB_OUTPUT | |
darwinX86x64Name=`ls -d target/Darwin_x86_64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "darwinX86x64Name=$darwinX86x64Name" >> $GITHUB_OUTPUT | |
echo "darwinAarch64Dir=target/Darwin_aarch64" >> $GITHUB_OUTPUT | |
darwinAarch64Name=`ls -d target/Darwin_aarch64/erofs-utils-v*/ | awk -F '(/|.zip)' '{print $3}'` && echo "darwinAarch64Name=$darwinAarch64Name" >> $GITHUB_OUTPUT | |
- name: Upload erofs-utils Darwin_x86_64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepareArtifact.outputs.darwinX86x64Name }} | |
path: '${{ steps.prepareArtifact.outputs.darwinX86x64Dir }}/${{ steps.prepareArtifact.outputs.darwinX86x64Name }}/*' | |
- name: Upload erofs-utils Darwin_aarch64 | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepareArtifact.outputs.darwinAarch64Name }} | |
path: '${{ steps.prepareArtifact.outputs.darwinAarch64Dir }}/${{ steps.prepareArtifact.outputs.darwinAarch64Name }}/*' |