Skip to content

Commit

Permalink
ci: build libvlc using github actions (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
huynhsontung authored Dec 5, 2023
1 parent 5804358 commit 6efa505
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 29 deletions.
99 changes: 74 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,66 @@ name: CI

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:

env:
VLC_VERSION: 3.0.20
UWP_LIBVLC_BUILD_FLAGS: -z -r -u -w

jobs:
libvlc:
runs-on: ubuntu-latest
container:
image: registry.videolan.org/vlc-debian-llvm-uwp:20211020111246
options: -u root
strategy:
matrix:
arch: [x86, x64, arm]
include:
- arch: x86
short-arch: win32
host-arch: i686
- arch: x64
short-arch: win64
host-arch: x86_64
- arch: arm
short-arch: winarm
host-arch: armv7
env:
SHORTARCH: ${{ matrix.short-arch }}
HOST_ARCH: ${{ matrix.host-arch }}
TRIPLET: ${{ matrix.host-arch }}-w64-mingw32
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Apply patches
run: |
cd vlc
git config --global user.email "cone@example.com"
git config --global user.name "Cony Cone"
git am -3 ../patches/*.patch
if [ $? -ne 0 ]; then
git am --abort
echo "Applying the patches failed, aborting git-am"
exit 1
fi
- name: Build
run: vlc/extras/package/win32/build.sh -c -a ${{ matrix.host-arch }} $UWP_LIBVLC_BUILD_FLAGS
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libvlc-${{ matrix.arch }}
path: ${{ matrix.short-arch }}-uwp/vlc-${{ env.VLC_VERSION }}-*.7z
if-no-files-found: error

UWP_access_v3:
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
strategy:
matrix:
arch: [x64, x86, arm]
Expand All @@ -18,18 +73,14 @@ jobs:
git clone https://code.videolan.org/mfkl/vlc-winrt && cd vlc-winrt && git checkout uwp-access-v3
mkdir -p libvlc/Universal/vlc-${{ matrix.arch }}/Release
- name: Download VLC headers
uses: azure/powershell@v1
with:
inlineScript: |
Invoke-WebRequest -Uri "https://code.videolan.org/videolan/vlc/-/archive/3.0.x/vlc-3.0.x.zip" -OutFile "vlc-3.0.x.zip"
azPSVersion : '3.1.0'
run: Invoke-WebRequest -Uri "https://code.videolan.org/videolan/vlc/-/archive/3.0.x/vlc-3.0.x.zip" -OutFile "vlc-3.0.x.zip"
- name: Extract LibVLC
shell: bash
run: |
7z x vlc-3.0.x.zip -ovlc
mv vlc/vlc-3.0.x/include vlc-winrt/libvlc/Universal/vlc-${{ matrix.arch }}/Release
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.3
uses: microsoft/setup-msbuild@v1.3
- name: MSBuild x64/ARM
if: matrix.arch != 'x86'
working-directory: vlc-winrt/modules/libaccess_winrt_plugin.UWP
Expand All @@ -39,44 +90,39 @@ jobs:
working-directory: vlc-winrt/modules/libaccess_winrt_plugin.UWP
run: msbuild libaccess_winrt_plugin.UWP.vcxproj /p:Configuration=Release /p:Platform=Win32
- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: libvlc-uwp-access-build-${{ matrix.arch }}
path: vlc-winrt/modules/libaccess_winrt_plugin.UWP/Release/libaccess_winrt_plugin.UWP
if-no-files-found: error

UWP_NuGet:
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
runs-on: ubuntu-latest
needs: UWP_access_v3
needs:
- UWP_access_v3
- libvlc
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: NuGet/setup-nuget@v1.2.0
with:
nuget-version: '5.x'
- name: Authenticate to GitHub Packages
run: nuget sources add -Username ${{ github.actor }} -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText -Name github -Source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
- name: Create NuGet folders
shell: bash
run: |
mkdir -p build/win10-arm/native
mkdir -p build/win10-x64/native
mkdir -p build/win10-x86/native
- name: Download and extract UWP builds
env:
VLC_VERSION: 3.0.20
shell: bash
run: |
wget -O arm.zip https://code.videolan.org/huynhsontung/libvlc-nuget/-/jobs/artifacts/master/download?job=uwp-arm
wget -O x86.zip https://code.videolan.org/huynhsontung/libvlc-nuget/-/jobs/artifacts/master/download?job=uwp-x86
wget -O x64.zip https://code.videolan.org/huynhsontung/libvlc-nuget/-/jobs/artifacts/master/download?job=uwp-x64
7z x arm.zip -oarm -y
7z x arm/vlc/winarm-uwp/vlc-$VLC_VERSION-win32.7z -oarm/vlc/winarm-uwp -y
7z x libvlc-arm/vlc-$VLC_VERSION-win32.7z -oarm/vlc/winarm-uwp -y
7z x x86.zip -ox86 -y
7z x x86/vlc/win32-uwp/vlc-$VLC_VERSION-win32.7z -ox86/vlc/win32-uwp -y
7z x libvlc-x86/vlc-$VLC_VERSION-win32.7z -ox86/vlc/win32-uwp -y
7z x x64.zip -ox64 -y
7z x x64/vlc/win64-uwp/vlc-$VLC_VERSION-win64.7z -ox64/vlc/win64-uwp -y
7z x libvlc-x64/vlc-$VLC_VERSION-win64.7z -ox64/vlc/win64-uwp -y
mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/lua build/win10-arm/native
mv arm/vlc/winarm-uwp/vlc-$VLC_VERSION/plugins build/win10-arm/native
Expand All @@ -103,7 +149,10 @@ jobs:
run: |
nuget pack VideoLAN.LibVLC.UWP.nuspec
- name: Upload NuGet package
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: libvlc-uwp
path: '*.nupkg'
- name: Push to GitHub Packages
if: github.ref_type == 'tag'
run: nuget push *.nupkg -Source github -ApiKey ${{ secrets.GITHUB_TOKEN }}
7 changes: 3 additions & 4 deletions VideoLAN.LibVLC.UWP.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
<metadata>
<id>VideoLAN.LibVLC.UWP</id>
<title>VideoLAN.LibVLC.UWP</title>
<version>3.3.2-open</version>
<authors>VideoLAN</authors>
<owners>VideoLAN</owners>
<version>3.3.3-alpha</version>
<authors>huynhsontung</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>LibVLC is a modular multimedia framework</summary>
<description>LibVLC is a modular multimedia framework that can render video and output audio as well as encode and stream. As it is native code, you will need to use a wrapper library such as LibVLCSharp to use it from .NET.

Use this LibVLC build for Windows Universal projects (UAP) on Windows 10 Desktop, Mobile and Xbox.
</description>
<tags>libvlc;vlc;videolan;native;c/c++;video;audio;player;media;mediaplayer;codec;ffmpeg;xamarin;graphics;ios;android;linux;windows;macos;cross-platform</tags>
<projectUrl>https://code.videolan.org/videolan/libvlc-nuget</projectUrl>
<projectUrl>https://github.com/huynhsontung/libvlc-nuget</projectUrl>
<license type="expression">LGPL-2.1-or-later</license>
<releaseNotes>https://code.videolan.org/videolan/vlc/blob/master/NEWS</releaseNotes>
<icon>icon.png</icon>
Expand Down

0 comments on commit 6efa505

Please sign in to comment.