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