remove `#!/usr/bin/env sh`
[liba.git] / .github / workflows / msvc.yml
blobf3d0951bb977bfa294d01ac88279237c595d4575
1 name: msvc
2 on:
3   workflow_dispatch:
4 jobs:
5   MSVC:
6     strategy:
7       fail-fast: false
8       matrix:
9         include: [
10           { triple: x64, arch: x64 },
11           { triple: x86, arch: win32 },
12           { triple: arm64, arch: ARM64 },
13         ]
14     runs-on: windows-latest
15     steps:
16       - uses: actions/checkout@v4
17         with:
18           lfs: true
19           submodules: true
20       - name: Run setup
21         run: |
22           python -m venv _
23           _/Scripts/Activate.ps1
24           python -m pip install ninja
25           python -m pip install -r requirements.txt
26           Get-ChildItem Env: | Sort Name
27       - name: Run cmake
28         run: |
29           _/Scripts/Activate.ps1
30           Set-PSDebug -Trace 1
31           cmake -S . -B build -A ${{ matrix.arch }} `
32             -DCMAKE_INSTALL_PREFIX=_ `
33             -DBUILD_TESTING=1 `
34             -DLIBA_WARNINGS=1 `
35             -DLIBA_ANALYZER=1 `
36             -DLIBA_SANITIZE=1 `
37             -DLIBA_WITH_LUA=1 `
38             -DLIBA_PYTHON=${{ matrix.arch == 'x64' }} `
39             -DLIBA_JAVA=1
40       - name: Run build
41         env:
42           LIBA_OPENMP: 1
43         run: |
44           Set-PSDebug -Trace 1
45           cmake --build build --config Debug --target package -- -noLogo
46       - name: Run ctest
47         if: ${{ startsWith(matrix.triple, 'x') }}
48         env:
49           CTEST_OUTPUT_ON_FAILURE: 1
50         run: |
51           Set-PSDebug -Trace 1
52           cmake --build build --config Debug --target run_tests -- -noLogo
53       - name: Run build
54         env:
55           LIBA_OPENMP: 1
56         run: |
57           Set-PSDebug -Trace 1
58           cmake --build build --config RelWithDebInfo --target package -- -noLogo
59       - name: Run ctest
60         if: ${{ startsWith(matrix.triple, 'x') }}
61         env:
62           CTEST_OUTPUT_ON_FAILURE: 1
63         run: |
64           Set-PSDebug -Trace 1
65           cmake --build build --config RelWithDebInfo --target run_tests -- -noLogo
66       - name: Run demo
67         env:
68           CMAKE_PREFIX_PATH: ${{ github.workspace }}/_
69         run: |
70           Set-PSDebug -Trace 1
71           cmake --build build --config RelWithDebInfo --target install -- -noLogo
72           cmake -S demo -B demo/build -A ${{ matrix.arch }}
73           cmake --build demo/build -v
74       - uses: actions/checkout@v4
75         with:
76           repository: microsoft/vcpkg
77           path: _/vcpkg
78       - name: Run vcpkg
79         run: |
80           Set-PSDebug -Trace 1
81           cmake -B build -DLIBA_VCPKG=_/vcpkg
82           _/vcpkg/bootstrap-vcpkg.bat -disableMetrics
83           _/vcpkg/vcpkg install liba[ipo,pkgconfig]:${{ matrix.triple }}-windows
84           _/vcpkg/vcpkg install liba[ipo,pkgconfig]:${{ matrix.triple }}-windows-static
85       - uses: actions/checkout@v4
86         if: ${{ matrix.arch == 'x64' }}
87         with:
88           repository: emscripten-core/emsdk
89           path: _/emsdk
90       - name: Run emsdk
91         if: ${{ matrix.arch == 'x64' }}
92         run: |
93           _/emsdk/emsdk install latest
94           _/emsdk/emsdk activate latest
95           _/emsdk/emsdk_env.ps1
96           pushd _/emsdk/upstream/emscripten
97           & $ENV:EMSDK_NODE.Replace('node.exe', 'npm') install
98       - name: Run cmake
99         if: ${{ matrix.arch == 'x64' }}
100         env:
101           CMAKE_TOOLCHAIN_FILE: cmake/UseClang.cmake
102           EMSDK_QUIET: 1
103           LIBA_OPENMP: 1
104         run: |
105           _/Scripts/Activate.ps1
106           _/emsdk/emsdk_env.ps1
107           Set-PSDebug -Trace 1
108           cmake -S . -B build.llvm -G "Ninja Multi-Config" `
109             -DBUILD_TESTING=1 `
110             -DLIBA_WARNINGS=1 `
111             -DLIBA_JAVASCRIPT=1 `
112             -DLIBA_JAVASCRIPT_TSGEN=1 `
113             -DLIBA_JAVASCRIPT_BIGINT=1 `
114             -DLIBA_WITH_LUA=1 `
115             -DLIBA_PYTHON=1 `
116             -DLIBA_JAVA=1
117       - name: Run build
118         if: ${{ matrix.arch == 'x64' }}
119         env:
120           LIBA_OPENMP: 1
121         run: |
122           Set-PSDebug -Trace 1
123           cmake --build build.llvm --config Debug --target package
124       - name: Run ctest
125         if: ${{ matrix.arch == 'x64' }}
126         env:
127           CTEST_OUTPUT_ON_FAILURE: 1
128         run: |
129           Set-PSDebug -Trace 1
130           cmake --build build.llvm --config Debug --target test
131       - name: Run build
132         if: ${{ matrix.arch == 'x64' }}
133         env:
134           LIBA_OPENMP: 1
135         run: |
136           Set-PSDebug -Trace 1
137           cmake --build build.llvm --config RelWithDebInfo --target package
138       - name: Run ctest
139         if: ${{ matrix.arch == 'x64' }}
140         env:
141           CTEST_OUTPUT_ON_FAILURE: 1
142         run: |
143           Set-PSDebug -Trace 1
144           cmake --build build.llvm --config RelWithDebInfo --target test