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