remove `#!/usr/bin/env sh`
[liba.git] / .github / workflows / macos.yml
blobc7de8e63966ff8019ba65ae944e4b5ed9869abde
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++ },
11           { cc: clang, cxx: clang++ },
12         ]
13     runs-on: macos-latest
14     steps:
15       - uses: actions/checkout@v4
16         with:
17           lfs: true
18           submodules: true
19       - uses: actions/checkout@v4
20         with:
21           repository: emscripten-core/emsdk
22           path: _/emsdk
23       - name: Run emsdk
24         run: |
25           _/emsdk/emsdk install latest
26           _/emsdk/emsdk activate latest
27           . _/emsdk/emsdk_env.sh
28           pushd _/emsdk/upstream/emscripten
29           $(dirname $EMSDK_NODE)/npm install
30       - name: Run setup
31         env:
32           CC: ${{ matrix.cc }}
33           CXX: ${{ matrix.cxx }}
34         run: |
35           python3 -m venv _
36           . _/bin/activate
37           python3 -m pip install ninja
38           python3 -m pip install -r requirements.txt
39           env
40       - name: Run cmake
41         env:
42           EMSDK_QUIET: 1
43           CC: ${{ matrix.cc }}
44           CXX: ${{ matrix.cxx }}
45           CMAKE_PREFIX_PATH: ${{ github.workspace }}/_
46         run: |
47           . _/bin/activate
48           . _/emsdk/emsdk_env.sh
49           set -x
50           cmake -S . -B build -G "Ninja Multi-Config" \
51             -DCMAKE_INSTALL_PREFIX=_ \
52             -DBUILD_TESTING=1 \
53             -DLIBA_WARNINGS=1 \
54             -DLIBA_ANALYZER=1 \
55             -DLIBA_SANITIZE=1 \
56             -DLIBA_JAVASCRIPT=1 \
57             -DLIBA_JAVASCRIPT_TSGEN=1 \
58             -DLIBA_JAVASCRIPT_BIGINT=1 \
59             -DLIBA_WITH_LUA=1 \
60             -DLIBA_PYTHON=1 \
61             -DLIBA_JAVA=1 \
62             -DLIBA_WITH_QUICKJS=1 \
63             -DLIBA_LIBTOOL=1 \
64             -DLIBA_PKGCONFIG=1
65       - name: Run ninja
66         env:
67           CC: ${{ matrix.cc }}
68           CXX: ${{ matrix.cxx }}
69           LIBA_OPENMP: ${{ startsWith(matrix.cc, 'gcc') }}
70         run: |
71           set -x
72           cmake --build build --config Debug --target package
73       - name: Run ctest
74         env:
75           CTEST_OUTPUT_ON_FAILURE: 1
76         run: |
77           set -x
78           cmake --build build --config Debug --target test
79       - name: Run ninja
80         env:
81           CC: ${{ matrix.cc }}
82           CXX: ${{ matrix.cxx }}
83           LIBA_OPENMP: ${{ startsWith(matrix.cc, 'gcc') }}
84         run: |
85           set -x
86           cmake --build build --config RelWithDebInfo --target package
87       - name: Run ctest
88         env:
89           CTEST_OUTPUT_ON_FAILURE: 1
90         run: |
91           set -x
92           cmake --build build --config RelWithDebInfo --target test
93       - name: Run demo
94         env:
95           CC: ${{ matrix.cc }}
96           CXX: ${{ matrix.cxx }}
97           CMAKE_PREFIX_PATH: ${{ github.workspace }}/_
98         run: |
99           set -x
100           cmake --build build --config RelWithDebInfo --target install
101           cmake -S demo -B demo/build
102           cmake --build demo/build -v
103       - uses: actions/checkout@v4
104         with:
105           repository: microsoft/vcpkg
106           path: _/vcpkg
107       - name: Run vcpkg
108         env:
109           CC: ${{ matrix.cc }}
110           CXX: ${{ matrix.cxx }}
111         run: |
112           set -x
113           cmake -B build -DLIBA_VCPKG=_/vcpkg
114           _/vcpkg/bootstrap-vcpkg.sh -disableMetrics
115           _/vcpkg/vcpkg install liba[ipo,pkgconfig]