Skip to content

Commit

Permalink
CI: Add Build-on-macOS
Browse files Browse the repository at this point in the history
Co-authored-by: xiaoleGun <[email protected]>
Signed-off-by: sekaiacg <[email protected]>
  • Loading branch information
sekaiacg and xiaoleGun committed Mar 21, 2023
1 parent ff7aa45 commit 9a57526
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion .github/workflows/build-erofs-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/[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@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 }}/*'

0 comments on commit 9a57526

Please sign in to comment.