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