|
1 | | -name: CI |
| 1 | +name: Multi-Arch CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - master |
| 5 | + branches: ["master"] |
7 | 6 | pull_request: |
8 | | - branches: |
9 | | - - master |
| 7 | + branches: ["master"] |
10 | 8 |
|
11 | 9 | jobs: |
12 | | - build: |
13 | | - strategy: |
14 | | - matrix: |
15 | | - os: [ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm, ubuntu-22.04-arm, macos-15, macos-13, windows-2025] |
| 10 | + build: |
| 11 | + name: Build (${{ matrix.os }} - ${{ matrix.arch }}) |
| 12 | + runs-on: ${{ matrix.runs-on }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + # Linux |
| 18 | + - os: ubuntu-22.04 |
| 19 | + arch: x86_64 |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + - os: ubuntu-22.04 |
| 22 | + arch: aarch64 |
| 23 | + runs-on: ubuntu-22.04-arm |
| 24 | + - os: ubuntu-24.04 |
| 25 | + arch: x86_64 |
| 26 | + runs-on: ubuntu-24.04 |
| 27 | + - os: ubuntu-24.04 |
| 28 | + arch: aarch64 |
| 29 | + runs-on: ubuntu-24.04-arm |
| 30 | + # macOS |
| 31 | + - os: macos-13 |
| 32 | + arch: x86_64 |
| 33 | + runs-on: macos-13 |
| 34 | + - os: macos-15 |
| 35 | + arch: arm64 |
| 36 | + runs-on: macos-15 |
| 37 | + # Windows |
| 38 | + - os: windows-2022 |
| 39 | + arch: x86_64 |
| 40 | + runs-on: windows-2022 |
| 41 | + - os: windows-2025 |
| 42 | + arch: x86_64 |
| 43 | + runs-on: windows-2025 |
16 | 44 |
|
17 | | - runs-on: ${{ matrix.os }} |
| 45 | + steps: |
| 46 | + - name: Checkout code |
| 47 | + uses: actions/checkout@v4 |
18 | 48 |
|
19 | | - steps: |
20 | | - - uses: actions/checkout@v4 |
| 49 | + ######################### |
| 50 | + # Dependencies Installation |
| 51 | + ######################### |
| 52 | + - name: Install LLVM and Dependencies (Linux) |
| 53 | + if: runner.os == 'Linux' |
| 54 | + run: | |
| 55 | + sudo apt-get update |
| 56 | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - |
| 57 | + sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" |
| 58 | + sudo apt-get update |
| 59 | + sudo apt-get install -y curl clang-18 lld-18 llvm-18-dev libclang-18-dev ninja-build cmake libxml2-dev |
| 60 | + - name: Install LLVM and Dependencies (macOS) |
| 61 | + if: runner.os == 'macos' |
| 62 | + run: | |
| 63 | + brew update |
| 64 | + brew install curl llvm libxml2 cmake ninja |
| 65 | + # Add LLVM’s bin directory to PATH so that CMake and tools can find LLVM 18. |
| 66 | + echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH |
| 67 | + - name: Install LLVM and Clang (Windows) |
| 68 | + if: runner.os == 'Windows' |
| 69 | + shell: pwsh |
| 70 | + run: | |
| 71 | + choco install curl llvm cmake -y |
| 72 | + - name: 🧳 Setup MSVC (Windows) |
| 73 | + if: runner.os == 'Windows' |
| 74 | + uses: microsoft/setup-msbuild@v2 |
| 75 | + # Configure the Project with CMake |
| 76 | + ######################### |
| 77 | + - name: Configure CMake (Non-Windows) |
| 78 | + if: runner.os != 'Windows' |
| 79 | + run: | |
| 80 | + cmake -B build -S . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin |
| 81 | + - name: Configure CMake (Windows) |
| 82 | + if: runner.os == 'Windows' |
| 83 | + shell: cmd |
| 84 | + run: | |
| 85 | + cmake -B build -S . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin |
| 86 | + ninja -C build |
| 87 | + ######################### |
| 88 | + # Build and Test |
| 89 | + ######################### |
| 90 | + - name: Build Project |
| 91 | + if: runner.os != 'Windows' |
| 92 | + run: ninja -C build |
21 | 93 |
|
22 | | - - name: Install ninja |
23 | | - shell: bash |
24 | | - run: | |
25 | | - if [[ "${{ runner.os }}" == "macOS" ]]; then |
26 | | - brew install ninja |
27 | | - elif [[ "${{ runner.os }}" == "Linux" ]]; then |
28 | | - sudo apt-get -y update |
29 | | - sudo apt-get -y install ninja-build |
30 | | - fi |
| 94 | + - name: Run Tests |
| 95 | + run: ctest --test-dir build --output-on-failure |
31 | 96 |
|
32 | | - - name: Build |
33 | | - if: matrix.os != 'windows-2025' |
34 | | - run: | |
35 | | - cmake -Bbuild -S. -GNinja |
36 | | - ninja -Cbuild |
37 | | -
|
38 | | - - name: Build |
39 | | - if: matrix.os == 'windows-2025' |
40 | | - shell: cmd |
41 | | - run: | |
42 | | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
43 | | - cmake -Bbuild -S. -GNinja |
44 | | - ninja -Cbuild |
45 | | -
|
46 | | - - name: Test |
47 | | - run: | |
48 | | - cd build/castxml-prefix/src/castxml-build |
49 | | - ctest --output-on-failure |
50 | | -
|
51 | | - - name: Create archive for Windows |
52 | | - if: matrix.os == 'windows-2025' |
53 | | - shell: cmd |
54 | | - run: | |
55 | | - cd build |
56 | | - 7z a castxml-${{ matrix.os }}.zip castxml |
57 | | - move castxml-${{ matrix.os }}.zip .. |
58 | | -
|
59 | | - - name: Create archive for macOS and Ubuntu |
60 | | - if: matrix.os != 'windows-2025' |
61 | | - shell: bash |
62 | | - run: | |
63 | | - cd build |
64 | | - tar cvf castxml-${{ matrix.os }}.tar castxml |
65 | | - gzip -9 castxml-${{ matrix.os }}.tar |
66 | | - mv castxml-${{ matrix.os }}.tar.gz .. |
67 | | -
|
68 | | - - name: Upload artifact |
69 | | - uses: actions/upload-artifact@v4 |
70 | | - with: |
71 | | - name: ${{ matrix.os }}-archive |
72 | | - path: ./castxml-${{ matrix.os }}.* |
| 97 | + ######################### |
| 98 | + # Artifact Packaging |
| 99 | + ######################### |
| 100 | + - name: Create Artifact (Linux/macOS) |
| 101 | + if: runner.os != 'Windows' |
| 102 | + run: | |
| 103 | + cd build/bin |
| 104 | + tar czvf ../../castxml-${{ matrix.os }}-${{ matrix.arch }}.tar.gz castxml |
| 105 | + - name: Create Artifact (Windows) |
| 106 | + if: runner.os == 'Windows' |
| 107 | + shell: cmd |
| 108 | + run: | |
| 109 | + cd build\bin |
| 110 | + 7z a ..\..\castxml-${{ matrix.os }}-${{ matrix.arch }}.zip castxml.exe |
| 111 | + - name: Upload Artifact |
| 112 | + uses: actions/upload-artifact@v4 |
| 113 | + with: |
| 114 | + name: castxml-${{ matrix.os }}-${{ matrix.arch }} |
| 115 | + path: castxml-${{ matrix.os }}-${{ matrix.arch }}.* |
0 commit comments