diff --git a/.github/workflows/xmake.yml b/.github/workflows/xmake.yml index 9494091b..3b8d68b3 100644 --- a/.github/workflows/xmake.yml +++ b/.github/workflows/xmake.yml @@ -14,24 +14,16 @@ on: - '.github/workflows/cmake.yml' jobs: - build: + linux: strategy: matrix: - os: [ubuntu-24.04, windows-2022] + os: [ubuntu-24.04] build_type: [release, debug] runs-on: ${{ matrix.os }} steps: - - name: Setup llvm - if: matrix.os == 'windows-2022' - uses: MinoruSekine/setup-scoop@v4.0.1 - with: - buckets: main - apps: llvm - - name: Setup llvm & libstdc++ & cmake & ninja - if: matrix.os == 'ubuntu-24.04' run: | sudo apt update sudo apt install -y software-properties-common @@ -64,12 +56,45 @@ jobs: build-cache-key: ${{ matrix.os }}-${{ matrix.build_type }} - name: Xmake configure - if: matrix.os == 'ubuntu-24.04' run: | xmake config --yes --mode=${{ matrix.build_type }} --toolchain=clang-20 + - name: Build clice + run: | + xmake build --verbose --diagnosis --all + + - name: Run tests + run: xmake test --verbose + + windows: + strategy: + matrix: + os: [windows-2022] + + runs-on: ${{ matrix.os }} + + steps: + - name: Setup llvm + uses: MinoruSekine/setup-scoop@v4.0.1 + with: + buckets: main + apps: llvm + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: branch@master + actions-cache-folder: '.xmake-cache' + actions-cache-key: ${{ matrix.os }} + package-cache: true + package-cache-key: ${{ matrix.os }} + build-cache: true + build-cache-key: ${{ matrix.os }}-${{ matrix.build_type }} + - name: Xmake configure - if: matrix.os == 'windows-2022' run: | xmake config --yes --toolchain=clang diff --git a/xmake.lua b/xmake.lua index 6e9a385b..41d00ee4 100644 --- a/xmake.lua +++ b/xmake.lua @@ -37,9 +37,8 @@ target("clice-core") add_files("src/**.cpp|Driver/*.cpp") add_includedirs("include", {public = true}) - add_packages("libuv", {public = true}) - add_packages("toml++", {public = true}) - add_defines("CLANG_BUILD_STATIC", {public = true}) + add_packages("libuv", "toml++", {public = true}) + if is_mode("debug") then add_packages("llvm", { public = true, @@ -124,7 +123,7 @@ package("llvm") add_urls("https://github.com/clice-project/llvm-binary/releases/download/$(version)/x64-windows-msvc-release.7z") add_versions("20.0.0", "4ef335845ebb52f8237bda3bcc7246b06085fdf5edc5cc6cf7f3a7c9ef655c09") else - end + end elseif is_plat("linux") then if is_mode("debug") then add_urls("https://github.com/clice-project/llvm-binary/releases/download/$(version)/x86_64-linux-gnu-debug.tar.xz") @@ -148,6 +147,10 @@ package("llvm") end on_install(function (package) + if not package:config("shared") then + package:add("defines", "CLANG_BUILD_STATIC") + end + os.mv("bin", package:installdir()) os.mv("lib", package:installdir()) os.mv("include", package:installdir())