diff --git a/.github/workflows/build-erofs-utils.yml b/.github/workflows/build-erofs-utils.yml index 8285e2b0..1401b63f 100644 --- a/.github/workflows/build-erofs-utils.yml +++ b/.github/workflows/build-erofs-utils.yml @@ -15,7 +15,7 @@ on: jobs: release: - needs: [ Build-on-Ubuntu ] + needs: [ Build-on-Ubuntu, Build-on-macOS ] runs-on: ubuntu-latest permissions: contents: write @@ -144,3 +144,56 @@ jobs: with: name: ${{ steps.Artifact.outputs.linuxX86x64Name }} path: '${{ steps.Artifact.outputs.linuxX86x64Dir }}/${{ steps.Artifact.outputs.linuxX86x64Name }}/*' + + Build-on-macOS: + runs-on: macos-latest + env: + CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" + CCACHE_NOHASHDIR: "true" + CCACHE_MAXSIZE: "50M" + CCACHE_HARDLINK: "true" + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 1 + + - name: Install dependencies + run: brew install ccache ninja + + - name: Set up ccache + uses: hendrikmuhs/ccache-action@v1.2 + 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@v3 + 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@v3 + with: + name: ${{ steps.prepareArtifact.outputs.darwinAarch64Name }} + path: '${{ steps.prepareArtifact.outputs.darwinAarch64Dir }}/${{ steps.prepareArtifact.outputs.darwinAarch64Name }}/*'