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