From d6a63f8158b214fc0b115d77b45c5f424341668c Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Sat, 2 Nov 2024 15:23:53 +0100 Subject: [PATCH] [CI] fix macOS CI --- .github/workflows/macOS.yml | 214 +++++++++++++++++------------------- .yamlfix.toml | 3 + xmake.lua | 2 +- 3 files changed, 103 insertions(+), 116 deletions(-) create mode 100644 .yamlfix.toml diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 5a09bd72..740ca018 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -1,115 +1,99 @@ -name: macOS - -on: - pull_request: - branches: [main, develop] - paths-ignore: - - '.github/workflows/Linux.yml' - - '.github/workflows/Windows-LLVM.yml' - - '.github/workflows/Windows-MSVC.yml' - - '.github/workflows/iOS.yml' - - '.github/workflows/Android.yml' - - '.github/workflows/AutoMerger.yml' - - '.gitignore' - - 'LICENSE' - - 'README.md' - - push: - branches: [develop] - paths-ignore: - - '.github/workflows/Windows-MSVC.yml' - - '.github/workflows/Linux.yml' - - '.github/workflows/macOS.yml' - - '.github/workflows/iOS.yml' - - '.github/workflows/Android.yml' - - '.github/workflows/AutoMerger.yml' - - '.gitignore' - - 'LICENSE' - - 'README.md' - -jobs: - build: - name: ${{ matrix.os }}-x64 ( ${{ matrix.kind }}-${{ matrix.mode }} ) - - strategy: - fail-fast: false - matrix: - os: [macOS-latest] - kind: [static, shared] - mode: [release, debug, asan] - - runs-on: ${{ matrix.os }} - - concurrency: - group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-macOS-${{ matrix.kind }}-${{ matrix.mode }} - - steps: - - name: Get current date as package key - id: cache_key - run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT - - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Cache LLVM - id: cache_llvm - uses: actions/cache@v4 - with: - path: ${{ runner.workspace }}/StormKit/llvm - key: ${{ matrix.os }}-llvm - save-always: true - restore-keys: | - ${{ matrix.os }}-llvm - - - name: Download and Uncompress LLVM - if: ${{ steps.cache_llvm.outputs.cache-hit != 'true' }} - run: | - wget 'https://github.com/Arthapz/llvm-prebuilt/raw/main/macOS/llvm.7z.001' - 7z x llvm.7z.001 - rm llvm.7z.001 - - - name: Set xmake env - run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV - - - name: Install XMake - uses: xmake-io/github-action-setup-xmake@v1 - with: - xmake-version: branch@dev - actions-cache-folder: .xmake-cache-${{ steps.cache_key.outputs.key }} - - - name: Update xmake to patched xmake - run: xmake update -s https://github.com/Arthapz/xmake.git#modules - - - name: Update xmake repository - run: xmake repo --update -v - - - name: Retrieve dependencies hash - id: dep_hash - run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT - - - name: Retrieve cached xmake dependencies - uses: actions/cache@v4 - with: - path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages - key: macOS-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-${{ steps.cache_key.outputs.key }} - - - name: Configure & Build - id: build - run: | - xmake f -v --yes -m ${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }} -k ${{ matrix.kind }} --sanitizers=${{ matrix.mode == 'asan' && 'y' || 'n' }} --examples=y --tests=y --toolchain=llvm --sdk="${{ runner.workspace }}/StormKit/llvm/" --runtimes="c++_shared" - xmake b -v - - - name: Tests - run: DYLD_LIBRARY_PATH="${{ runner.workspace }}/StormKit/llvm/lib" xmake test -v - - - name: Installation - run: xmake install -v --installdir="${{ runner.workspace }}/output" - - - name: Upload artifacts - id: upload - uses: actions/upload-artifact@v1 - with: - name: macOS-x64-${{ matrix.kind }}-${{ matrix.mode }} - path: ${{ runner.workspace }}/output +--- +name: macOS + +on: + pull_request: + branches: [main, develop] + paths-ignore: + - .github/workflows/Linux.yml + - .github/workflows/Windows-LLVM.yml + - .github/workflows/Windows-MSVC.yml + - .github/workflows/iOS.yml + - .github/workflows/Android.yml + - .github/workflows/AutoMerger.yml + - .gitignore + - LICENSE + - README.md + push: + branches: [develop] + paths-ignore: + - .github/workflows/Windows-LLVM.yml + - .github/workflows/Windows-MSVC.yml + - .github/workflows/Linux.yml + - .github/workflows/iOS.yml + - .github/workflows/Android.yml + - .github/workflows/AutoMerger.yml + - .gitignore + - LICENSE + - README.md + +jobs: + build: + name: ${{ matrix.os }}-x64 ( ${{ matrix.kind }}-${{ matrix.mode }} ) + strategy: + fail-fast: false + matrix: + os: [macOS-latest] + kind: [static, shared] + mode: [release, debug] + + runs-on: ${{ matrix.os }} + + concurrency: + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-macOS-${{ matrix.kind }}-${{ matrix.mode }} + + steps: + - name: Get current date as package key + id: cache_key + run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: tecolicom/actions-use-homebrew-tools@v1 + with: + tools: llvm + + - name: Set xmake env + run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV + + - name: Install XMake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: Arthapz/xmake#branch@fix-xlinker-rpath-deduplication + actions-cache-folder: .xmake-cache + actions-cache-key: macos-ci + + - name: Update xmake repository + run: xmake repo --update -v + + - name: Retrieve dependencies hash + id: dep_hash + run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT + + - name: Retrieve cached xmake dependencies + uses: actions/cache@v4 + with: + path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages + key: macOS-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-${{ steps.cache_key.outputs.key }} + + - name: Configure & Build + id: build + run: | + xmake f -v --yes -m ${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }} -k ${{ matrix.kind }} --sanitizers=${{ matrix.mode == 'debug' && 'y' || 'n' }} --examples=y --tests=y --toolchain=llvm --sdk="$(brew --prefix)/opt/llvm/" --runtimes="c++_shared" + xmake b -v + + - name: Tests + run: xmake test -v + + - name: Installation + run: xmake install -v --installdir="${{ runner.workspace }}/output" + + - name: Upload artifacts + id: upload + uses: actions/upload-artifact@v4 + with: + name: macOS-x64-${{ matrix.kind }}-${{ matrix.mode }} + path: ${{ runner.workspace }}/output diff --git a/.yamlfix.toml b/.yamlfix.toml new file mode 100644 index 00000000..f6e3aaa2 --- /dev/null +++ b/.yamlfix.toml @@ -0,0 +1,3 @@ +line_length = 120 +whitelines = 1 +section_whitelines = 1 diff --git a/xmake.lua b/xmake.lua index 38f12625..a6cd5cf2 100644 --- a/xmake.lua +++ b/xmake.lua @@ -287,7 +287,7 @@ option("vsxmake", { default = false, category = "root menu/support" }) ---------------------------- global configs ---------------------------- set_allowedmodes(allowedmodes) set_allowedplats("windows", "mingw", "linux", "macosx", "wasm") -set_allowedarchs("windows|x64", "mingw|x86_64", "linux|x86_64", "macosx|x86_64") +set_allowedarchs("windows|x64", "mingw|x86_64", "linux|x86_64", "linux|aarch64", "macosx|x86_64", "macosx|arm64") -- set_runtimes(is_mode("debug") and "MDd" or "MD") add_cxxflags(