xref: /openbmc/qemu/.gitlab-ci.d/windows.yml (revision 3c4a8a8f)
1.shared_msys2_builder:
2  extends: .base_job_template
3  tags:
4  - shared-windows
5  - windows
6  - windows-1809
7  cache:
8    key: "${CI_JOB_NAME}-cache"
9    paths:
10      - msys64/var/cache
11    when: always
12  needs: []
13  stage: build
14  timeout: 80m
15  variables:
16    # This feature doesn't (currently) work with PowerShell, it stops
17    # the echo'ing of commands being run and doesn't show any timing
18    FF_SCRIPT_SECTIONS: 0
19  artifacts:
20    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
21    expire_in: 7 days
22    paths:
23      - build/meson-logs/testlog.txt
24    reports:
25      junit: "build/meson-logs/testlog.junit.xml"
26  before_script:
27  - Write-Output "Acquiring msys2.exe installer at $(Get-Date -Format u)"
28  - If ( !(Test-Path -Path msys64\var\cache ) ) {
29      mkdir msys64\var\cache
30    }
31  - Invoke-WebRequest
32    "https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe.sig"
33    -outfile "msys2.exe.sig"
34  - if ( Test-Path -Path msys64\var\cache\msys2.exe.sig ) {
35      Write-Output "Cached installer sig" ;
36      if ( ((Get-FileHash msys2.exe.sig).Hash -ne (Get-FileHash msys64\var\cache\msys2.exe.sig).Hash) ) {
37        Write-Output "Mis-matched installer sig, new installer download required" ;
38        Remove-Item -Path msys64\var\cache\msys2.exe.sig ;
39        if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
40          Remove-Item -Path msys64\var\cache\msys2.exe
41        }
42      } else {
43        Write-Output "Matched installer sig, cached installer still valid"
44      }
45    } else {
46      Write-Output "No cached installer sig, new installer download required" ;
47      if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
48        Remove-Item -Path msys64\var\cache\msys2.exe
49      }
50    }
51  - if ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) {
52      Write-Output "Fetching latest installer" ;
53      Invoke-WebRequest
54      "https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe"
55      -outfile "msys64\var\cache\msys2.exe" ;
56      Copy-Item -Path msys2.exe.sig -Destination msys64\var\cache\msys2.exe.sig
57    } else {
58      Write-Output "Using cached installer"
59    }
60  - Write-Output "Invoking msys2.exe installer at $(Get-Date -Format u)"
61  - msys64\var\cache\msys2.exe -y
62  - ((Get-Content -path .\msys64\etc\\post-install\\07-pacman-key.post -Raw)
63      -replace '--refresh-keys', '--version') |
64     Set-Content -Path ${CI_PROJECT_DIR}\msys64\etc\\post-install\\07-pacman-key.post
65  - .\msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
66  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Core update
67  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Normal update
68  - taskkill /F /FI "MODULES eq msys-2.0.dll"
69  script:
70  - Write-Output "Installing mingw packages at $(Get-Date -Format u)"
71  - .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
72      bison diffutils flex
73      git grep make sed
74      $MINGW_TARGET-capstone
75      $MINGW_TARGET-curl
76      $MINGW_TARGET-cyrus-sasl
77      $MINGW_TARGET-dtc
78      $MINGW_TARGET-gcc
79      $MINGW_TARGET-glib2
80      $MINGW_TARGET-gnutls
81      $MINGW_TARGET-gtk3
82      $MINGW_TARGET-libgcrypt
83      $MINGW_TARGET-libjpeg-turbo
84      $MINGW_TARGET-libnfs
85      $MINGW_TARGET-libpng
86      $MINGW_TARGET-libssh
87      $MINGW_TARGET-libtasn1
88      $MINGW_TARGET-libusb
89      $MINGW_TARGET-lzo2
90      $MINGW_TARGET-nettle
91      $MINGW_TARGET-ninja
92      $MINGW_TARGET-pixman
93      $MINGW_TARGET-pkgconf
94      $MINGW_TARGET-python
95      $MINGW_TARGET-SDL2
96      $MINGW_TARGET-SDL2_image
97      $MINGW_TARGET-snappy
98      $MINGW_TARGET-spice
99      $MINGW_TARGET-usbredir
100      $MINGW_TARGET-zstd "
101  - Write-Output "Running build at $(Get-Date -Format u)"
102  - $env:CHERE_INVOKING = 'yes'  # Preserve the current working directory
103  - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
104  - mkdir build
105  - cd build
106  - ..\msys64\usr\bin\bash -lc "../configure --enable-fdt=system $CONFIGURE_ARGS"
107  - ..\msys64\usr\bin\bash -lc "make"
108  - ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;"
109  - Write-Output "Finished build at $(Get-Date -Format u)"
110
111msys2-64bit:
112  extends: .shared_msys2_builder
113  variables:
114    MINGW_TARGET: mingw-w64-x86_64
115    MSYSTEM: MINGW64
116    # do not remove "--without-default-devices"!
117    # commit 9f8e6cad65a6 ("gitlab-ci: Speed up the msys2-64bit job by using --without-default-devices"
118    # changed to compile QEMU with the --without-default-devices switch
119    # for the msys2 64-bit job, due to the build could not complete within
120    CONFIGURE_ARGS:  --target-list=x86_64-softmmu --without-default-devices -Ddebug=false -Doptimization=0
121    # qTests don't run successfully with "--without-default-devices",
122    # so let's exclude the qtests from CI for now.
123    TEST_ARGS: --no-suite qtest
124
125msys2-32bit:
126  extends: .shared_msys2_builder
127  variables:
128    MINGW_TARGET: mingw-w64-i686
129    MSYSTEM: MINGW32
130    CONFIGURE_ARGS:  --target-list=ppc64-softmmu -Ddebug=false -Doptimization=0
131    TEST_ARGS: --no-suite qtest
132