aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/build-and-test.yml
blob: 729bcea72e95c7d74c41f7f33cca2d4a5ec3318d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build and Test

on: [push, pull_request]

env:
  BUILD_TYPE: Release

jobs:
  build:
    strategy:
      matrix:
        os: [windows-latest, ubuntu-latest, macos-latest]
        cpu_detection: [0, 1]
      fail-fast: false

    runs-on: ${{matrix.os}}

    steps:

    - name: Install build dependencies
      if: ${{matrix.os == 'ubuntu-latest'}}
      run: sudo apt-get install llvm ninja-build

    - name: Install build dependencies
      if: ${{matrix.os == 'macos-latest'}}
      run: |
        brew install llvm ninja
        echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
    
    - name: Checkout dynarmic repo
      uses: actions/checkout@v2

    - name: Checkout ext-boost repo
      uses: actions/checkout@v2
      with:
        repository: MerryMage/ext-boost
        path: externals/ext-boost

    - name: Checkout unicorn repo
      if: ${{matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'}}
      uses: actions/checkout@v2
      with:
        repository: MerryMage/unicorn
        path: externals/unicorn

    - name: Build unicorn
      if: ${{matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'}}
      working-directory: externals/unicorn
      run: UNICORN_ARCHS=aarch64,arm ./make.sh

    - name: Configure CMake
      if: ${{matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'}}
      run: >
        cmake 
        -B ${{github.workspace}}/build
        -DBoost_INCLUDE_DIRS=${{github.workspace}}/externals/ext-boost
        -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
        -DDYNARMIC_ENABLE_CPU_FEATURE_DETECTION=${{matrix.cpu_detection}}
        -DDYNARMIC_TESTS_USE_UNICORN=1
        -DDYNARMIC_USE_LLVM=1
        -DLIBUNICORN_INCLUDE_DIR=${{github.workspace}}/externals/unicorn/include
        -DLIBUNICORN_LIBRARY=${{github.workspace}}/externals/unicorn/libunicorn.a
        -G Ninja

    - name: Configure CMake
      if: ${{matrix.os == 'windows-latest'}}
      run: >
        cmake
        -B ${{github.workspace}}/build
        -DBoost_INCLUDE_DIRS=${{github.workspace}}/externals/ext-boost
        -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
        -DDYNARMIC_ENABLE_CPU_FEATURE_DETECTION=${{matrix.cpu_detection}}
        -G "Visual Studio 17 2022"
        -A x64

    - name: Build
      working-directory: ${{github.workspace}}/build
      run: cmake --build . --config Release

    - name: Test
      env:
        DYLD_FALLBACK_LIBRARY_PATH: ${{github.workspace}}/externals/unicorn
      working-directory: ${{github.workspace}}/build
      run: ctest --extra-verbose -C ${{env.BUILD_TYPE}}