xref: /openbmc/qemu/.gitlab-ci.d/windows.yml (revision a158c63b)
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    # The Windows git is a bit older so override the default
32    GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet
33  artifacts:
34    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
35    expire_in: 7 days
36    paths:
37      - build/meson-logs/testlog.txt
38    reports:
39      junit: "build/meson-logs/testlog.junit.xml"
40  before_script:
41  - Write-Output "Acquiring msys2.exe installer at $(Get-Date -Format u)"
42  - If ( !(Test-Path -Path msys64\var\cache ) ) {
43      mkdir msys64\var\cache
44    }
45  - Invoke-WebRequest
46    "https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe.sig"
47    -outfile "msys2.exe.sig"
48  - if ( Test-Path -Path msys64\var\cache\msys2.exe.sig ) {
49      Write-Output "Cached installer sig" ;
50      if ( ((Get-FileHash msys2.exe.sig).Hash -ne (Get-FileHash msys64\var\cache\msys2.exe.sig).Hash) ) {
51        Write-Output "Mis-matched installer sig, new installer download required" ;
52        Remove-Item -Path msys64\var\cache\msys2.exe.sig ;
53        if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
54          Remove-Item -Path msys64\var\cache\msys2.exe
55        }
56      } else {
57        Write-Output "Matched installer sig, cached installer still valid"
58      }
59    } else {
60      Write-Output "No cached installer sig, new installer download required" ;
61      if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
62        Remove-Item -Path msys64\var\cache\msys2.exe
63      }
64    }
65  - if ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) {
66      Write-Output "Fetching latest installer" ;
67      Invoke-WebRequest
68      "https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe"
69      -outfile "msys64\var\cache\msys2.exe" ;
70      Copy-Item -Path msys2.exe.sig -Destination msys64\var\cache\msys2.exe.sig
71    } else {
72      Write-Output "Using cached installer"
73    }
74  - Write-Output "Invoking msys2.exe installer at $(Get-Date -Format u)"
75  - msys64\var\cache\msys2.exe -y
76  - ((Get-Content -path .\msys64\etc\\post-install\\07-pacman-key.post -Raw)
77      -replace '--refresh-keys', '--version') |
78     Set-Content -Path ${CI_PROJECT_DIR}\msys64\etc\\post-install\\07-pacman-key.post
79  - .\msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
80  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Core update
81  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Normal update
82  - taskkill /F /FI "MODULES eq msys-2.0.dll"
83  script:
84  - Write-Output "Installing mingw packages at $(Get-Date -Format u)"
85  - .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
86      bison diffutils flex
87      git grep make sed
88      mingw-w64-x86_64-binutils
89      mingw-w64-x86_64-capstone
90      mingw-w64-x86_64-ccache
91      mingw-w64-x86_64-curl
92      mingw-w64-x86_64-cyrus-sasl
93      mingw-w64-x86_64-dtc
94      mingw-w64-x86_64-gcc
95      mingw-w64-x86_64-glib2
96      mingw-w64-x86_64-gnutls
97      mingw-w64-x86_64-gtk3
98      mingw-w64-x86_64-libgcrypt
99      mingw-w64-x86_64-libjpeg-turbo
100      mingw-w64-x86_64-libnfs
101      mingw-w64-x86_64-libpng
102      mingw-w64-x86_64-libssh
103      mingw-w64-x86_64-libtasn1
104      mingw-w64-x86_64-libusb
105      mingw-w64-x86_64-lzo2
106      mingw-w64-x86_64-nettle
107      mingw-w64-x86_64-ninja
108      mingw-w64-x86_64-pixman
109      mingw-w64-x86_64-pkgconf
110      mingw-w64-x86_64-python
111      mingw-w64-x86_64-SDL2
112      mingw-w64-x86_64-SDL2_image
113      mingw-w64-x86_64-snappy
114      mingw-w64-x86_64-spice
115      mingw-w64-x86_64-usbredir
116      mingw-w64-x86_64-zstd"
117  - Write-Output "Running build at $(Get-Date -Format u)"
118  - $env:CHERE_INVOKING = 'yes'  # Preserve the current working directory
119  - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
120  - $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR"
121  - $env:CCACHE_DIR = "$env:CCACHE_BASEDIR/ccache"
122  - $env:CCACHE_MAXSIZE = "500M"
123  - $env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode
124  - $env:CC = "ccache gcc"
125  - mkdir build
126  - cd build
127  - ..\msys64\usr\bin\bash -lc "ccache --zero-stats"
128  - ..\msys64\usr\bin\bash -lc "../configure --enable-fdt=system $CONFIGURE_ARGS"
129  - ..\msys64\usr\bin\bash -lc "make"
130  - ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;"
131  - ..\msys64\usr\bin\bash -lc "ccache --show-stats"
132  - Write-Output "Finished build at $(Get-Date -Format u)"
133