Skip to content

build: CI for macOS #1001

build: CI for macOS

build: CI for macOS #1001

Workflow file for this run

name: 'DwarFS CI Build'
on:
workflow_dispatch:
push:
branches:
- main
- 'mhx/**'
tags:
- v*
permissions:
contents: read
jobs:
windows:
if: false
runs-on:
- self-hosted
- Windows
strategy:
matrix:
arch:
- X64
build_mode:
- Release
- Debug
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: '0'
ref: ${{ github.ref }}
- name: Set MSVC Dev Environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure Build
shell: cmd
run: |
cmake -B${{ runner.temp }}\build -S${{ runner.workspace }}\dwarfs -GNinja -DCMAKE_MAKE_PROGRAM=C:\bin\ninja.exe -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -DWITH_UNIVERSAL_BINARY=ON -DWITH_TESTS=ON -DWITH_BENCHMARKS=ON -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_INSTALLED_DIR=${{ runner.workspace }}\vcpkg-install-dwarfs -DDWARFS_ARTIFACTS_DIR=Z:\artifacts\dwarfs -DWITH_PXATTR=ON
- name: Run Build
shell: cmd
run: |
cmake --build ${{ runner.temp }}\build
- name: Run Test
shell: cmd
run: |
copy "C:\Program Files (x86)\WinFsp\bin\winfsp-x64.dll" ${{ runner.temp }}\build
ctest --test-dir ${{ runner.temp }}\build --output-on-failure -j8
- name: Build Package
shell: cmd
run: |
cmake --build ${{ runner.temp }}\build --target package
if: matrix.build_mode == 'Release'
- name: Compress Universal Binary
shell: cmd
run: |
cmake --build ${{ runner.temp }}\build --target universal_upx
if: matrix.build_mode == 'Release'
- name: Copy Artifacts
shell: cmd
run: |
cmake --build ${{ runner.temp }}\build --target copy_artifacts
if: matrix.build_mode == 'Release'
- name: Prepare Artifact Upload
shell: cmd
run: cat ${{ runner.temp }}\build\artifacts.env >> %GITHUB_ENV%
if: matrix.build_mode == 'Release'
- name: Upload Binary Tarball
uses: actions/upload-artifact@v4
with:
name: ${{ env.binary_tarball }}
path: ${{ runner.temp }}\build\${{ env.binary_tarball }}
if-no-files-found: error
compression-level: 0
if: matrix.build_mode == 'Release'
- name: Upload Universal Binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.universal_binary }}
path: ${{ runner.temp }}\build\${{ env.universal_binary }}
if-no-files-found: error
compression-level: 0
if: matrix.build_mode == 'Release'
package-source:
runs-on:
- self-hosted
- Linux
- amd64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: '0'
ref: ${{ github.ref }}
- name: Build Docker Image
run: |
docker build \
-f .docker/Dockerfile.arch \
-t dwarfs-linux-build-arch \
--build-arg ARCH=amd64 \
--build-arg SCRIPT=build-linux.sh \
.docker
- name: Run Build
run: |
docker run --rm \
--cap-add SYS_ADMIN --device /dev/fuse --privileged \
--mount type=bind,source=${GITHUB_WORKSPACE},target=/workspace,readonly \
--mount type=bind,source=${{ runner.temp }},target=/tmp-runner \
--mount type=bind,source=/home/mhx/github-ccache,target=/ccache \
--mount type=bind,source=/home/mhx/github-local,target=/local \
--mount type=bind,source=/mnt/opensource/artifacts/dwarfs,target=/artifacts \
--env BUILD_TYPE=clang-release-ninja-source \
--env BUILD_ARCH=amd64 \
--env BUILD_DIST=arch \
--env GITHUB_REF_NAME \
--env GITHUB_REF_TYPE \
--env GITHUB_RUN_ID \
--env GITHUB_RUN_NUMBER \
--env GITHUB_RUN_ATTEMPT \
dwarfs-linux-build-arch
linux-src:
if: false
needs: package-source
strategy:
matrix:
arch:
- amd64
- arm64v8
dist:
- ubuntu
- fedora
- arch
build_type:
- gcc-debug-shared-ninja-full
- gcc-release-ninja-split
- gcc-release-shared-ninja-split
- clang-release-shared-ninja-full
exclude:
- arch: arm64v8
dist: arch
build_type: gcc-debug-shared-ninja-full
- arch: arm64v8
dist: arch
build_type: gcc-release-ninja-split
- arch: arm64v8
dist: arch
build_type: gcc-release-shared-ninja-split
- arch: arm64v8
dist: arch
build_type: clang-release-shared-ninja-full
include:
- arch: amd64
dist: ubuntu
build_type: oldgcc-debug-shared-make-split
- arch: arm64v8
dist: ubuntu
build_type: gcc-debug-shared-noperfmon-ninja-split
- arch: amd64
dist: ubuntu
build_type: gcc-debug-shared-nostacktrace-ninja-split
- arch: amd64
dist: ubuntu
build_type: oldclang-debug-shared-make-split
- arch: amd64
dist: ubuntu-2204
build_type: gcc-release-shared-ninja-split
- arch: amd64
dist: ubuntu-2204
build_type: gcc-debug-shared-ninja-full
- arch: amd64
dist: ubuntu-2204
build_type: clang-release-ninja-split
runs-on:
- self-hosted
- Linux
- ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: '0'
ref: ${{ github.ref }}
- name: Build Docker Image
run: |
docker build \
-f .docker/Dockerfile.${{ matrix.dist }} \
-t dwarfs-linux-build-${{ matrix.dist }} \
--build-arg ARCH=${{ matrix.arch }} \
--build-arg SCRIPT=build-linux.sh \
.docker
- name: Run Build (${{ matrix.build_type }})
run: |
docker run --rm \
--cap-add SYS_ADMIN --device /dev/fuse --privileged \
--mount type=bind,source=${GITHUB_WORKSPACE},target=/workspace,readonly \
--mount type=bind,source=${{ runner.temp }},target=/tmp-runner \
--mount type=bind,source=/home/mhx/github-ccache,target=/ccache \
--mount type=bind,source=/home/mhx/github-local,target=/local \
--mount type=bind,source=/mnt/opensource/artifacts/dwarfs,target=/artifacts \
--env BUILD_FROM_TARBALL=1 \
--env BUILD_TYPE=${{ matrix.build_type }} \
--env BUILD_ARCH=${{ matrix.arch }} \
--env BUILD_DIST=${{ matrix.dist }} \
--env GITHUB_REF_NAME \
--env GITHUB_REF_TYPE \
--env GITHUB_RUN_ID \
--env GITHUB_RUN_NUMBER \
--env GITHUB_RUN_ATTEMPT \
dwarfs-linux-build-${{ matrix.dist }}
linux-git:
if: false
strategy:
matrix:
arch:
- amd64
- arm64v8
dist:
- ubuntu
- fedora
- arch
build_type:
- gcc-debug-shared-ninja
- gcc-release-ninja
- gcc-release-shared-ninja
- clang-release-shared-ninja
exclude:
- arch: arm64v8
dist: arch
build_type: gcc-debug-shared-ninja
- arch: arm64v8
dist: arch
build_type: gcc-release-ninja
- arch: arm64v8
dist: arch
build_type: gcc-release-shared-ninja
- arch: arm64v8
dist: arch
build_type: clang-release-shared-ninja
include:
- arch: amd64
dist: ubuntu
build_type: clang-reldbg-shared-asan-ninja
- arch: amd64
dist: ubuntu
build_type: clang-debug-shared-tsan-ninja
- arch: amd64
dist: ubuntu
build_type: clang-reldbg-shared-ubsan-ninja
- arch: amd64
dist: ubuntu
build_type: clang-debug-coverage-ninja
- arch: amd64
dist: ubuntu
build_type: oldgcc-debug-shared-make
- arch: arm64v8
dist: ubuntu
build_type: gcc-debug-shared-noperfmon-ninja
- arch: amd64
dist: ubuntu
build_type: gcc-debug-shared-nostacktrace-ninja
- arch: amd64
dist: ubuntu
build_type: oldclang-debug-shared-make
- arch: amd64
dist: ubuntu
build_type: gcc-release-ninja-static
- arch: arm64v8
dist: ubuntu
build_type: gcc-release-ninja-static
- arch: amd64
dist: ubuntu
build_type: gcc-release-ninja-O2-static
- arch: arm64v8
dist: ubuntu
build_type: gcc-release-ninja-O2-static
- arch: amd64
dist: ubuntu
build_type: clang-release-ninja-static
- arch: arm64v8
dist: ubuntu
build_type: clang-release-ninja-static
- arch: amd64
dist: ubuntu
build_type: clang-release-ninja-O2-static
- arch: arm64v8
dist: ubuntu
build_type: clang-release-ninja-O2-static
- arch: amd64
dist: ubuntu
build_type: clang-reldbg-ninja-static
- arch: arm64v8
dist: ubuntu
build_type: clang-reldbg-ninja-static
- arch: amd64
dist: ubuntu
build_type: clang-debug-ninja-static
- arch: arm64v8
dist: ubuntu
build_type: clang-debug-ninja-static
- arch: arm64v8
dist: ubuntu-2204
build_type: gcc-release-shared-ninja
- arch: arm64v8
dist: ubuntu-2204
build_type: gcc-debug-shared-ninja
- arch: arm64v8
dist: ubuntu-2204
build_type: clang-release-ninja
runs-on:
- self-hosted
- Linux
- ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: '0'
ref: ${{ github.ref }}
- name: Build Docker Image
run: |
docker build \
-f .docker/Dockerfile.${{ matrix.dist }} \
-t dwarfs-linux-build-${{ matrix.dist }} \
--build-arg ARCH=${{ matrix.arch }} \
--build-arg SCRIPT=build-linux.sh \
.docker
- name: Run Build (${{ matrix.build_type }})
run: |
docker run --rm \
--cap-add SYS_ADMIN --device /dev/fuse --privileged \
--mount type=bind,source=${GITHUB_WORKSPACE},target=/workspace,readonly \
--mount type=bind,source=${{ runner.temp }},target=/tmp-runner \
--mount type=bind,source=/home/mhx/github-ccache,target=/ccache \
--mount type=bind,source=/home/mhx/github-local,target=/local \
--mount type=bind,source=/mnt/opensource/artifacts/dwarfs,target=/artifacts \
--env BUILD_TYPE=${{ matrix.build_type }} \
--env BUILD_ARCH=${{ matrix.arch }} \
--env BUILD_DIST=${{ matrix.dist }} \
--env GITHUB_REF_NAME \
--env GITHUB_REF_TYPE \
--env GITHUB_RUN_ID \
--env GITHUB_RUN_NUMBER \
--env GITHUB_RUN_ATTEMPT \
dwarfs-linux-build-${{ matrix.dist }}
- name: Upload Coverage Data
if: matrix.build_type == 'clang-debug-coverage-ninja'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ runner.temp }}/dwarfs-coverage.txt
fail_ci_if_error: false
- name: Prepare Artifact Upload
run: cat ${{ runner.temp }}/artifacts.env >> $GITHUB_ENV
if: ${{ endsWith(matrix.build_type, '-static') }}
- name: Upload Binary Tarball
uses: actions/upload-artifact@v4
with:
name: ${{ env.binary_tarball }}
path: ${{ runner.temp }}/artifacts/${{ env.binary_tarball }}
if-no-files-found: error
compression-level: 0
if: ${{ endsWith(matrix.build_type, '-static') }}
- name: Upload Universal Binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.universal_binary }}
path: ${{ runner.temp }}/artifacts/${{ env.universal_binary }}
if-no-files-found: error
compression-level: 0
if: ${{ endsWith(matrix.build_type, '-static') }}
macos:
needs: package-source
runs-on:
- self-hosted
- macOS
strategy:
matrix:
arch:
- ARM64
build_mode:
- Release
- Debug
steps:
- name: Unpack Source Tarball
run: |
rm -rf dwarfs-*/
rm -f dwarfs-source-*.tar.zst
rm -f dwarfs
tar xf /Volumes/opensource/artifacts/dwarfs/cache/dwarfs-source-${{ github.run_number }}.tar.zst
ln -s dwarfs-* dwarfs
- name: Configure Full Build
run: |
cmake -B${{ runner.temp }}/build-full -S${{ runner.workspace }}/dwarfs/dwarfs -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -DWITH_TESTS=ON -DWITH_BENCHMARKS=ON -DWITH_PXATTR=ON
- name: Run Full Build
run: |
cmake --build ${{ runner.temp }}/build-full
- name: Run Full Test
run: |
ctest --test-dir ${{ runner.temp }}/build-full --output-on-failure -j
- name: Configure Library Build
run: |
cmake -B${{ runner.temp }}/build-library -S${{ runner.workspace }}/dwarfs/dwarfs -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -DWITH_TESTS=ON -DWITH_LIBDWARFS=ON -DWITH_TOOLS=OFF -DWITH_FUSE_DRIVER=OFF
- name: Run Library Build
run: |
cmake --build ${{ runner.temp }}/build-library
- name: Run Library Test
run: |
ctest --test-dir ${{ runner.temp }}/build-library --output-on-failure -j
- name: Install Library
run: |
cmake --install ${{ runner.temp }}/build-library --prefix ${{ runner.temp }}/install
- name: Configure Tools Build
run: |
cmake -B${{ runner.temp }}/build-tools -S${{ runner.workspace }}/dwarfs/dwarfs -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -DWITH_TESTS=ON -DWITH_LIBDWARFS=OFF -DWITH_TOOLS=ON -DWITH_FUSE_DRIVER=OFF -DCMAKE_PREFIX_PATH=${{ runner.temp }}/install
- name: Run Tools Build
run: |
cmake --build ${{ runner.temp }}/build-tools
- name: Run Tools Test
run: |
ctest --test-dir ${{ runner.temp }}/build-tools --output-on-failure -j
- name: Install Tools
run: |
cmake --install ${{ runner.temp }}/build-tools --prefix ${{ runner.temp }}/install
- name: Configure FUSE Driver Build
run: |
cmake -B${{ runner.temp }}/build-driver -S${{ runner.workspace }}/dwarfs/dwarfs -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_mode }} -DWITH_TESTS=ON -DWITH_LIBDWARFS=OFF -DWITH_TOOLS=OFF -DWITH_FUSE_DRIVER=ON -DCMAKE_PREFIX_PATH=${{ runner.temp }}/install
- name: Run FUSE Driver Build
run: |
cmake --build ${{ runner.temp }}/build-driver
- name: Run FUSE Driver Test
run: |
ctest --test-dir ${{ runner.temp }}/build-driver --output-on-failure -j
- name: Install FUSE Driver
run: |
cmake --install ${{ runner.temp }}/build-driver --prefix ${{ runner.temp }}/install
- name: Cleanup
run: |
rm -rf dwarfs-*/
rm -f dwarfs-source-*.tar.zst
rm -f dwarfs