[200_6] Github Action支持macOS的构建和测试 #1107
This file contains hidden or 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 and Test on macOS arm64 | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'src/**' | |
| - '!src/Plugins/Windows/**' | |
| - 'tests/**' | |
| - 'xmake.lua' | |
| - 'xmake/packages.lua' | |
| - 'xmake/research.lua' | |
| - 'xmake/packages/**' | |
| - 'xmake-requires.lock' | |
| - '.github/workflows/ci-macos-arm64.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'src/**' | |
| - '!src/Plugins/Windows/**' | |
| - 'tests/**' | |
| - 'xmake.lua' | |
| - 'xmake/packages.lua' | |
| - 'xmake/research.lua' | |
| - 'xmake/packages/**' | |
| - 'xmake-requires.lock' | |
| - '.github/workflows/ci-macos-arm64.yml' | |
| jobs: | |
| macosbuild: | |
| strategy: | |
| matrix: | |
| os: [macos-13] | |
| arch: [arm64] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 45 | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: cache xmake | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{github.workspace}}/build/.build_cache | |
| /Users/runner/.xmake | |
| key: xmake-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }} | |
| - name: Install Qt | |
| uses: jurplel/install-qt-action@v3 | |
| with: | |
| version: 6.5.3 | |
| target: 'desktop' | |
| cache: 'true' | |
| - name: set XMAKE_GLOBALDIR | |
| run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV | |
| - uses: xmake-io/github-action-setup-xmake@v1 | |
| with: | |
| xmake-version: v2.8.7 | |
| actions-cache-folder: '.xmake-cache' | |
| - name: xmake repo --update | |
| run: xmake repo --update | |
| - name: cache packages from xrepo | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | |
| key: xrepo-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }} | |
| - name: cache xmake | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ${{ runner.workspace }}/build/.build_cache | |
| key: xmake-build-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('xmake-requires.lock') }} | |
| - name: config | |
| run: xmake config --policies=build.ccache -o ${{ runner.workspace }}/build -m releasedbg -a ${{ matrix.arch }} --yes | |
| - name: build | |
| run: xmake build --yes -vD research && xmake build --yes -vD --group=tests | |
| - name: C++ tests | |
| run: xmake run --yes --verbose --diagnosis --group=tests | |
| env: | |
| QT_QPA_PLATFORM: offscreen | |
| - name: Scheme tests | |
| run: xmake run --yes -vD --group=scheme_tests | |
| - name: integration test | |
| run: xmake run --yes -vD --group=integration_tests | |
| env: | |
| QT_QPA_PLATFORM: offscreen |