.gitlab-ci.yml 4.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
stages:
  - build
  - build_gui

variables:
  SIGNINSTALLER: "false"
  SIGNTHUMBPRINT: ""
  SIGNTOOLLOCATION: ""
  SIGNTIMESTAMP: ""
  SIGNTIMESTAMPSERVER: ""
  SIGNFLATPAK: "false"
  SIGNPGPKEY: "" # set in secret variables; passphrase not supported
13
  BUILDFDK: "false"
14
  WINDOWS_VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"
15 16

.fedora_flatpak: &using_fedora_flatpak
17
  image: fedora:30
18 19 20 21 22 23
  tags:
    - linux
  allow_failure: true
  before_script:
    - uname -a && cat /etc/os-release && lscpu
    - dnf update -y
24
    - dnf install -y autoconf automake bzip2 cmake flatpak flatpak-builder fuse gcc-c++ git libtool m4 make nasm python numactl-devel
25
    - flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
26 27
    - flatpak install -y --noninteractive flathub org.freedesktop.Sdk//18.08
    - flatpak install -y --noninteractive flathub org.freedesktop.Platform//18.08
28 29 30 31
    - test -n "$SIGNPGPKEY" && (echo "$SIGNPGPKEY" | gpg2 --batch --import) && gpg2 --list-secret-keys
    - test $SIGNFLATPAK = "true" && export PGP_ID=$(gpg2 --list-secret-keys --with-colons 2>/dev/null | grep -E '(sec|ssb)[^#]+$' | head -n1 | cut -d ':' -f5) && printf "Do sign flatpak with key ID %s \n" "$PGP_ID"

.fedora_mingw: &using_fedora_mingw
32
  image: fedora:29
33 34 35 36 37 38 39 40 41 42
  tags:
    - linux
  before_script:
    - uname -a && cat /etc/os-release && lscpu
    - dnf update -y
    - dnf groupinstall -y "Development Tools" "Development Libraries"
    - dnf install -y bison bzip2 cmake flex gcc-c++ intltool lbzip2 libtool nasm pax perl-Digest-SHA python tar yasm zlib-devel
    - test -d $CI_PROJECT_DIR/toolchains/mingw-w64-x86_64/bin || scripts/mingw-w64-build x86_64 $CI_PROJECT_DIR/toolchains
    - ls $CI_PROJECT_DIR/toolchains/mingw-w64-x86_64/bin

43 44
# "prebuilt" just means that we build the mingw-w64-x86_64 cross compilation toolchain 
# separately and reuse that toolchain, saving time and computation here
45
.fedora_mingw_prebuilt: &using_fedora_mingw_prebuilt
46
  image: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/handbrake-builder:master
47 48 49 50
  tags:
    - linux
  before_script:
    - test -d $TOOLCHAIN_PATH && ls $TOOLCHAIN_PATH
51
    - env | grep VERSION
52 53 54 55 56

build_linux:
  <<: *using_fedora_flatpak
  stage: build
  script:
57 58
    - scripts/repo-info.sh | tee version.txt
    - test $BUILDFDK = "true" && echo "Building with FDK (license warning)" || echo "Building default configuration"
59
    - test $BUILDFDK = "true" && ./configure --enable-fdk-aac --flatpak --enable-qsv || ./configure --flatpak --enable-qsv
60
    - test $BUILDFDK = "true" && sed -i 's|"--flatpak"|\0, "--enable-fdk-aac"|' pkg/linux/flatpak/*.json
61 62 63 64 65
    - cd build
    - make pkg.create.flatpak
  artifacts:
    paths:
      - build/
66
    when: always
67 68
  except: # prevents Flatpak build from running on public GitLab project
    - //@frederickding/HandBrake
69

70 71
# to eliminate dependency on the prebuilt Docker image, change the line below to
# <<: *using_fedora_mingw
72 73 74 75
build_windows:
  <<: *using_fedora_mingw_prebuilt
  stage: build
  script:
76 77
    - test $BUILDFDK = "true" && echo "Building with FDK (license warning)" || echo "Building default configuration"
    - test $BUILDFDK = "true" && export FDK="--enable-fdk-aac"
78
    - ./configure --cross=x86_64-w64-mingw32 --enable-qsv $FDK --launch-jobs=$(nproc) --launch
79 80 81
  dependencies: []
  artifacts:
    paths:
82 83
      - build/
    when: always
84 85 86

build_windows_gui:
  stage: build_gui
Frederick Ding's avatar
Frederick Ding committed
87
  needs: [build_windows]
88 89
  dependencies:
    - build_windows
90 91 92 93 94 95 96 97 98
  tags:
    - msbuild
    - windows
  before_script:
    - cd win\CS
    - nuget restore
  script:
    - mkdir HandBrakeWPF\bin\x64\Release
    - copy ..\..\build\libhb\hb.dll HandBrakeWPF\bin\x64\Release\hb.dll
99
    - ..\..\scripts\Invoke-CmdScript.ps1 "$env:WINDOWS_VCVARS"
100
    - If($env:SIGNINSTALLER) { msbuild build.xml /p:Platform=x64 /t:Nightly /p:SignToolLocation="$env:SIGNTOOLLOCATION" /p:SignThumbprint=$env:SIGNTHUMBPRINT /p:SignTimestamp=$env:SIGNTIMESTAMP% /p:SignTimestampServer="$env:SIGNTIMESTAMPSERVER" } else { msbuild build.xml /p:Platform=x64 /t:Nightly }
101 102 103 104
    - move HandBrakeWPF\bin\x64\Release\HandBrake-*Win_GUI.exe ..\..
  artifacts:
    paths:
      - HandBrake-*Win_GUI.exe