Skip to content

Commit a861995

Browse files
committed
CI: Add MSVC build action
1 parent 98bd12b commit a861995

1 file changed

Lines changed: 54 additions & 55 deletions

File tree

.github/workflows/windows.yml

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,77 @@ 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)
42+
43+
# Export MINGW_PREFIX to the global environment
44+
echo "MINGW_PREFIX=$(cygpath -m "$MINGW_PREFIX")" >> $GITHUB_ENV
5145
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
46+
- name: Upload MINGW build
47+
if: matrix.build.type == 'mingw'
48+
uses: actions/upload-artifact@v5
49+
with:
50+
name: mingw-vmaf
51+
path: ${{ env.MINGW_PREFIX }}/bin/vmaf.exe
5652

57-
- name: Test vmaf
58-
run: meson test -C libvmaf/build --num-processes $(nproc)
53+
- name: Setup MSVC environment
54+
if: matrix.build.type == 'msvc'
55+
uses: ilammy/msvc-dev-cmd@v1
56+
57+
- name: Install Meson and Ninja
58+
if: matrix.build.type == 'msvc'
59+
run: |
60+
pip install meson ninja
5961
60-
- name: Get binary path & Current Release
61-
id: get_info
62+
- name: Install build tools
63+
if: matrix.build.type == 'msvc'
6264
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
65+
choco install xxd -y
6666
67-
- name: Upload vmaf
67+
- name: Build (MSVC)
68+
if: matrix.build.type == 'msvc'
69+
shell: cmd
70+
run: |
71+
meson setup libvmaf libvmaf/build-msvc --buildtype release --default-library static --prefix C:/vmaf-install-msvc
72+
meson install -C libvmaf/build-msvc
73+
meson test -C libvmaf/build-msvc
74+
75+
- name: Upload MSVC build
76+
if: matrix.build.type == 'msvc'
6877
uses: actions/upload-artifact@v5
6978
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
79+
name: msvc-vmaf
80+
path: C:/vmaf-install-msvc/bin/vmaf.exe

0 commit comments

Comments
 (0)