summaryrefslogtreecommitdiffstats
path: root/.github/workflows/windows.yml
blob: 5f39d490dc447e2666300132e8a49b5f37786578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Windows Build

on: [push, pull_request]

jobs:
  build_mingw:
    name: CLI / LibHB
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@master
    
    - name: Environment Setup
      run: |
        sudo apt-get install automake autoconf build-essential cmake curl gcc git intltool libtool libtool-bin m4 make nasm patch pkg-config python tar yasm zlib1g-dev ninja-build zip
        sudo apt-get install bison bzip2 flex g++ gzip pax
        sudo apt-get install python3-pip
        sudo apt-get install python3-setuptools
        sudo pip3 install meson
        
    - name: Toolchain Cache
      id: mingw-toolchain
      uses: actions/cache@v1
      with:
        path: /home/runner/toolchains/
        key: mingw-toolchain
    
    - name: Compile Toolchain
      if: steps.mingw-toolchain.outputs.cache-hit != 'true'
      run: |
        ./scripts/mingw-w64-build --disable-gdb x86_64 ~/toolchains
        ./scripts/mingw-w64-build x86_64.clean
        ./scripts/mingw-w64-build pkgclean
        cd /home/runner/toolchains/
        rm -rf build-mingw-w64-x86_64.noindex
        rm -rf source.noindex
        rm -rf pkg
          
    - name: Build CLI and LibHB
      run: |
        export PATH="/home/runner/toolchains/mingw-w64-x86_64/bin:${PATH}"
        ./configure --cross=x86_64-w64-mingw32 --enable-qsv --enable-vce --enable-nvenc --launch-jobs=$(nproc) --launch
        cd build
        make pkg.create.zip
    
    - name: Upload HandBrakeCLI
      uses: actions/upload-artifact@v2
      with:
        name: HandBrakeCLI
        path: ./build/HandBrakeCLI.exe
    
    - name: Upload LibHB
      uses: actions/upload-artifact@v2
      with:
        name: LibHandBrake
        path: ./build/libhb/hb.dll

  build_gui:
    name: Windows UI
    runs-on: windows-latest
    needs: build_mingw
    env:
      SigningCertificate: ${{ secrets.HandBrakeTeam_SignFile }}
       
    steps:
    - uses: actions/checkout@master
        
    - name: Environment Setup
      run: |
        choco install wget
        wget https://nsis.sourceforge.io/mediawiki/images/c/c9/Inetc.zip
        mkdir plugins
        move Inetc.zip plugins
        cd plugins        
        7z x Inetc.zip
          
    - name: NuGet Restore
      run: |
         choco install nuget.commandline
         cd win/CS/
         nuget restore HandBrake.sln
   
    - name: Download LibHandBrake
      uses: actions/download-artifact@v1.0.0
      with:
       name: LibHandBrake
       path: win/CS/HandBrakeWPF/bin/x64/Release
         
    - name: Import the Signing Cert
      run: |
        $ErrorView = "NormalView"
        if (-NOT ($env:SigningCertificate -eq '')) {        
          $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.HandBrakeTeam_Pfx }}")
          $currentDirectory = Get-Location
          $certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:SigningCertificate
          $certPassword = ConvertTo-SecureString -String ${{ secrets.HandBrakeTeam_pfx_pwd }} -Force –AsPlainText
          [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
          cp $certificatePath win\cs\
        }
        
    - name: Build Windows GUI
      run: |      
        $env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin"
        msbuild win\cs\build.xml /t:Nightly /p:PfxFile=$env:SigningCertificate /p:PfxPwd=${{ secrets.HandBrakeTeam_pfx_pwd }} /p:SignTimestampServer=http://time.certum.pl/

    - name: Upload HandBrake exe Installer
      uses: actions/upload-artifact@v2
      with:
        name: HandBrake-x86_64-Win_GUI-EXE
        path: win/CS/HandBrakeWPF/bin/x64/Release/HandBrake-Nightly-x86_64-Win_GUI.exe
    
    - name: Upload HandBrake msi Installer
      uses: actions/upload-artifact@v2
      with:
        name:  HandBrake-x86_64-Win_GUI-MSI
        path: win/CS/HandBrakeWPF/bin/x64/Release/HandBrake-Nightly-x86_64-Win_GUI.msi
        
    - name: Tidy up past artifacts
      uses: kolpav/purge-artifacts-action@v1
      if: github.repository == 'HandBrake/HandBrake'
      with:
          token: ${{ secrets.GITHUB_TOKEN }}
          expire-in: 3days