|
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-22.04, macos-12, macos-14, windows-2022] |
| 10 | + build: |
| 11 | + name: Build (OS=${{ matrix.os }}, Arch=${{ matrix.arch }}) |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [ ubuntu-24.04, ubuntu-22.04, macos-15 ] |
| 17 | + arch: [ x86_64 ] |
| 18 | + include: |
| 19 | + - os: ubuntu-24.04-arm |
| 20 | + arch: aarch64 |
| 21 | + - os: ubuntu-22.04-arm |
| 22 | + arch: aarch64 |
| 23 | + - os: macos-15 |
| 24 | + arch: arm64 |
| 25 | + - os: windows-2025 |
| 26 | + arch: amd64 |
16 | 27 |
|
17 |
| - runs-on: ${{ matrix.os }} |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
18 | 31 |
|
19 |
| - steps: |
20 |
| - - uses: actions/checkout@v4 |
| 32 | + ##################################### |
| 33 | + # Dependencies Installation (Optional) |
| 34 | + ##################################### |
21 | 35 |
|
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 |
| 36 | + # Linux dependencies |
| 37 | + - name: Install dependencies (Linux) |
| 38 | + if: startsWith(matrix.os, 'ubuntu') |
| 39 | + run: | |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install -y build-essential ninja-build cmake git |
| 42 | + # If you need system LLVM for something else: |
| 43 | + # sudo apt-get install -y clang lld llvm-dev libclang-dev |
31 | 44 |
|
32 |
| - - name: Build |
33 |
| - if: matrix.os != 'windows-2022' |
34 |
| - run: | |
35 |
| - cmake -Bbuild -S. -GNinja |
36 |
| - ninja -Cbuild |
| 45 | + # macOS dependencies |
| 46 | + - name: Install dependencies (macOS) |
| 47 | + if: startsWith(matrix.os, 'macos') |
| 48 | + run: | |
| 49 | + brew update |
| 50 | + brew install ninja cmake git |
37 | 51 |
|
38 |
| - - name: Build |
39 |
| - if: matrix.os == 'windows-2022' |
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 |
| 52 | + # Windows dependencies |
| 53 | + - name: Install dependencies (Windows) |
| 54 | + if: startsWith(matrix.os, 'windows') |
| 55 | + shell: pwsh |
| 56 | + run: | |
| 57 | + choco install ninja cmake git -y |
| 58 | + - name: Setup MSBuild (Windows) |
| 59 | + if: startsWith(matrix.os, 'windows') |
| 60 | + uses: microsoft/setup-msbuild@v2 |
45 | 61 |
|
46 |
| - - name: Test |
47 |
| - run: | |
48 |
| - cd build/castxml-prefix/src/castxml-build |
49 |
| - ctest --output-on-failure |
| 62 | + ##################################### |
| 63 | + # Configure the Superbuild |
| 64 | + ##################################### |
| 65 | + - name: Configure |
| 66 | + run: | |
| 67 | + cmake -B build -S . -GNinja -DCMAKE_BUILD_TYPE=Release |
| 68 | + shell: bash |
50 | 69 |
|
51 |
| - - name: Create archive for Windows |
52 |
| - if: matrix.os == 'windows-2022' |
53 |
| - shell: cmd |
54 |
| - run: | |
55 |
| - cd build |
56 |
| - 7z a castxml-${{ matrix.os }}.zip castxml |
57 |
| - move castxml-${{ matrix.os }}.zip .. |
| 70 | + ##################################### |
| 71 | + # Build the Superbuild |
| 72 | + ##################################### |
| 73 | + - name: Build |
| 74 | + run: cmake --build build --config Release |
58 | 75 |
|
59 |
| - - name: Create archive for macOS and Ubuntu |
60 |
| - if: matrix.os != 'windows-2022' |
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 .. |
| 76 | + ##################################### |
| 77 | + # [Optional] Run Tests |
| 78 | + ##################################### |
| 79 | + - name: Test |
| 80 | + run: | |
| 81 | + cd build/castxml-prefix/src/castxml-build |
| 82 | + ctest --output-on-failure |
67 | 83 |
|
68 |
| - - name: Upload artifact |
69 |
| - uses: actions/upload-artifact@v4 |
70 |
| - with: |
71 |
| - name: ${{ matrix.os }}-archive |
72 |
| - path: ./castxml-${{ matrix.os }}.* |
| 84 | + ##################################### |
| 85 | + # Package the resulting castxml binary |
| 86 | + ##################################### |
| 87 | + - name: Create Artifact (Windows) |
| 88 | + if: startsWith(matrix.os, 'windows') |
| 89 | + shell: cmd |
| 90 | + run: | |
| 91 | + cd build\castxml\bin |
| 92 | + 7z a ..\..\castxml-${{ matrix.os }}-${{ matrix.arch }}.zip castxml.exe |
| 93 | +
|
| 94 | + - name: Create Artifact (Non-Windows) |
| 95 | + if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') |
| 96 | + shell: bash |
| 97 | + run: | |
| 98 | + cd build/castxml/bin |
| 99 | + tar czvf ../../castxml-${{ matrix.os }}-${{ matrix.arch }}.tar.gz castxml |
| 100 | +
|
| 101 | + - name: Upload Artifact |
| 102 | + uses: actions/upload-artifact@v4 |
| 103 | + with: |
| 104 | + name: castxml-${{ matrix.os }}-${{ matrix.arch }} |
| 105 | + path: | |
| 106 | + build/castxml-*.tar.gz |
| 107 | + build/castxml-*.zip |
0 commit comments