Skip to content

Commit 156b094

Browse files
committed
CI: Add MSVC build action
1 parent b4a1e02 commit 156b094

1 file changed

Lines changed: 51 additions & 55 deletions

File tree

.github/workflows/windows.yml

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,74 @@ on:
44
pull_request:
55

66
jobs:
7-
build:
7+
build-windows:
88
runs-on: windows-latest
9+
910
strategy:
1011
fail-fast: false
1112
matrix:
12-
include:
13-
# Disabled 32-bit job due to vmaf score mismatch
14-
#- msystem: MINGW32
15-
# MINGW_PACKAGE_PREFIX: mingw-w64-i686
16-
# CFLAGS: -msse2 -mfpmath=sse -mstackrealign
17-
- msystem: MINGW64
18-
MINGW_PACKAGE_PREFIX: mingw-w64-x86_64
19-
env:
20-
CC: ccache gcc
21-
CXX: ccache g++
22-
CFLAGS: -pipe -static -O3 -mtune=generic -D_FILE_OFFSET_BITS=64 -mthreads ${{ matrix.CFLAGS }}
23-
CXXFLAGS: -pipe -static -O3 -mtune=generic -D_FILE_OFFSET_BITS=64 -mthreads ${{ matrix.CXXFLAGS }}
24-
LDFLAGS: -pipe -static -static-libgcc -static-libstdc++ ${{ matrix.LDFLAGS }}
25-
defaults:
26-
run:
27-
shell: msys2 {0}
13+
build:
14+
- type: mingw
15+
msystem: MINGW64
16+
prefix: mingw-w64-x86_64
17+
- type: msvc
18+
2819
steps:
2920
- uses: actions/checkout@v6
3021
with:
22+
submodules: true
3123
fetch-depth: 0
32-
- name: Cache ccache files
33-
uses: actions/cache@v4
34-
with:
35-
path: |
36-
.ccache
37-
key: ${{ runner.os }}-${{ matrix.msystem }}-0-${{ hashFiles('**/*.c') }}
38-
restore-keys: |
39-
${{ runner.os }}-${{ matrix.msystem }}-0-
40-
${{ runner.os }}-${{ matrix.msystem }}-
4124

42-
- uses: msys2/setup-msys2@v2
25+
- name: Setup MSYS2
26+
if: matrix.build.type == 'mingw'
27+
uses: msys2/setup-msys2@v2
4328
with:
44-
msystem: ${{ matrix.msystem }}
45-
install: ${{ matrix.MINGW_PACKAGE_PREFIX }}-ccache ${{ matrix.MINGW_PACKAGE_PREFIX }}-nasm ${{ matrix.MINGW_PACKAGE_PREFIX }}-pkg-config ${{ matrix.MINGW_PACKAGE_PREFIX }}-gcc ${{ matrix.MINGW_PACKAGE_PREFIX }}-meson ${{ matrix.MINGW_PACKAGE_PREFIX }}-ninja vim make diffutils
29+
msystem: ${{ matrix.build.msystem }}
30+
install: ${{ matrix.build.prefix }}-ccache ${{ matrix.build.prefix }}-nasm ${{ matrix.build.prefix }}-pkg-config ${{ matrix.build.prefix }}-gcc ${{ matrix.build.prefix }}-meson ${{ matrix.build.prefix }}-ninja vim make diffutils
4631
update: true
4732
path-type: inherit
4833

49-
- name: Set ccache dir
50-
run: echo "name=CCACHE_DIR::$PWD/.ccache" >> $GITHUB_ENV
34+
- name: Build (MINGW)
35+
if: matrix.build.type == 'mingw'
36+
shell: msys2 {0}
37+
run: |
38+
echo "name=CCACHE_DIR::$PWD/.ccache" >> $GITHUB_ENV
39+
meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix "$MINGW_PREFIX"
40+
meson install -C libvmaf/build
41+
meson test -C libvmaf/build --num-processes $(nproc)
5142
52-
- name: Configure vmaf
53-
run: meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix "$MINGW_PREFIX"
54-
- name: Build vmaf
55-
run: meson install -C libvmaf/build
43+
- name: Upload MINGW build
44+
if: matrix.build.type == 'mingw'
45+
uses: actions/upload-artifact@v5
46+
with:
47+
name: mingw-vmaf
48+
path: ${{ env.MINGW_PREFIX }}/bin/vmaf.exe
49+
50+
- name: Setup MSVC environment
51+
if: matrix.build.type == 'msvc'
52+
uses: ilammy/msvc-dev-cmd@v1
53+
54+
- name: Install Meson and Ninja
55+
if: matrix.build.type == 'msvc'
56+
run: |
57+
pip install meson ninja
5658
57-
- name: Test vmaf
58-
run: meson test -C libvmaf/build --num-processes $(nproc)
59+
- name: Install build tools
60+
if: matrix.build.type == 'msvc'
61+
run: |
62+
choco install xxd -y
5963
60-
- name: Get binary path & Current Release
61-
id: get_info
64+
- name: Build (MSVC)
65+
if: matrix.build.type == 'msvc'
66+
shell: cmd
6267
run: |
63-
ldd "$MINGW_PREFIX/bin/vmaf.exe" || true
64-
echo "path=$(cygpath -m "$(command -v vmaf)")" >> $GITHUB_OUTPUT
65-
echo "upload_url=$(curl -L https://api.github.com/repos/${{ github.repository }}/releases/tags/$(cut -d/ -f3 <<< ${{ github.ref }}) | jq -r ."upload_url")" >> $GITHUB_OUTPUT
68+
meson setup libvmaf libvmaf/build-msvc --buildtype release --default-library static --prefix C:/vmaf-install-msvc
69+
meson install -C libvmaf/build-msvc
70+
meson test -C libvmaf/build-msvc
6671
67-
- name: Upload vmaf
72+
- name: Upload MSVC build
73+
if: matrix.build.type == 'msvc'
6874
uses: actions/upload-artifact@v5
6975
with:
70-
name: ${{ matrix.msystem }}-vmaf
71-
path: ${{ steps.get_info.outputs.path }}
72-
- name: Upload vmaf
73-
if: steps.get_info.outputs.upload_url != 'null' && matrix.msystem == 'MINGW64'
74-
uses: actions/upload-release-asset@v1
75-
env:
76-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
with:
78-
upload_url: ${{ steps.get_info.outputs.upload_url }}
79-
asset_path: ${{ steps.get_info.outputs.path }}
80-
asset_name: vmaf.exe
81-
asset_content_type: application/vnd.microsoft.portable-executable
76+
name: msvc-vmaf
77+
path: C:/vmaf-install-msvc/bin

0 commit comments

Comments
 (0)