fix installation for QuickJS in CI
[liba.git] / .github / workflows / macos.yml
blobb29d4e91b39134da9cfe412b5985c0b1b3450410
1 name: macos
2 on:
3   workflow_dispatch:
4 jobs:
5   MacOS:
6     strategy:
7       fail-fast: false
8       matrix:
9         include: [
10           { cc: gcc, cxx: g++, type: Debug },
11           { cc: clang, cxx: clang++, type: Debug },
12           { cc: gcc, cxx: g++, type: Release },
13           { cc: clang, cxx: clang++, type: Release },
14         ]
15     runs-on: macos-latest
16     steps:
17       - uses: mymindstorm/setup-emsdk@v13
18       - uses: actions/checkout@v4
19         with:
20           lfs: true
21           submodules: true
22       - name: Run setup
23         env:
24           CC: ${{ matrix.cc }}
25           CXX: ${{ matrix.cxx }}
26         run: |
27           python3 -m venv venv
28           source venv/bin/activate
29           python3 -m pip install -r requirements.txt
30           curl https://bellard.org/quickjs/quickjs-2024-01-13.tar.xz | tar -xJf -
31           make -C quickjs-2024-01-13 && sudo make install -C quickjs-2024-01-13
32           env
33       - name: Run cmake
34         env:
35           LIBA_OPENMP: 1
36           CC: ${{ matrix.cc }}
37           CXX: ${{ matrix.cxx }}
38         run: |
39           source venv/bin/activate
40           set -x
41           cmake -S . -B build.${{ matrix.cc }} -DCMAKE_BUILD_TYPE=${{ matrix.type }} \
42             -DBUILD_TESTING=1 \
43             -DLIBA_WARNINGS=1 \
44             -DLIBA_SANITIZE=1 \
45             -DLIBA_JAVASCRIPT=1 \
46             -DLIBA_JAVASCRIPT_BIGINT=1 \
47             -DLIBA_JAVASCRIPT_DEBUG=1 \
48             -DLIBA_JAVASCRIPT_TSGEN=1 \
49             -DLIBA_WITH_LUA=1 \
50             -DLIBA_PYTHON=1 \
51             -DLIBA_VCPKG=1 \
52             -DLIBA_JAVA=1 \
53             -DLIBA_QUICKJS=1 \
54             -DLIBA_LIBTOOL=1 \
55             -DLIBA_PKGCONFIG=1
56           cmake --build build.${{ matrix.cc }} --config ${{ matrix.type }} --target package
57       - name: Run vcpkg
58         if: ${{ matrix.type == 'Release' }}
59         env:
60           CC: ${{ matrix.cc }}
61           CXX: ${{ matrix.cxx }}
62         run: |
63           set -x
64           cp -r build.${{ matrix.cc }}/vcpkg/* $VCPKG_INSTALLATION_ROOT
65           vcpkg install liba[ipo,pkgconfig]
66       - name: Run ctest
67         env:
68           CTEST_OUTPUT_ON_FAILURE: 1
69         run: |
70           set -x
71           cmake --build build.${{ matrix.cc }} --target test