Skip to contentSkip to conversation

gitlab-ci: Test compilation on Windows with MSYS2

PATCH In review Thomas Huth 5 participants 6 messages Nov 15, 2021 – Nov 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab-ci: Test compilation on Windows with MSYS2

Gitlab also provides runners with Windows, we can use them to test compilation with MSYS2, in both, 64-bit and 32-bit.

However, it takes quite a long time to set up the VM, so to stay in the 1h time frame, we can only compile and check one target here.

---
"make check" recently broke on MSYS2, and nobody noticed since apparently hardly anybody looks at the cirrus-CI output ... so here's another try to get some more test coverage in this area in the gitlab-CI instead. Patch needs to be applied after the "tests/unit/test-smp-parse:
Make an unified name for the tested machine" patch to get "make check" fixed first.

RFC -> v1:
- Use cache to speed up installation a little bit
- Add a 32-bit builder, too

 .gitlab-ci.d/qemu-project.yml |  1 +
 .gitlab-ci.d/windows.yml      | 98 +++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 .gitlab-ci.d/windows.yml
.gitlab-ci.d/qemu-project.yml +1 -0
index b3d79bc429..871262fe0e 100644
@@ -11,3 +11,4 @@ include:
   - local: '/.gitlab-ci.d/static_checks.yml'
   - local: '/.gitlab-ci.d/custom-runners.yml'
   - local: '/.gitlab-ci.d/cirrus.yml'
+  - local: '/.gitlab-ci.d/windows.yml'
.gitlab-ci.d/windows.yml new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 40 lines · Thomas Huth

Gitlab also provides runners with Windows, we can use them to test compilation with MSYS2, in both, 64-bit and 32-bit.

However, it takes quite a long time to set up the VM, so to stay in the 1h time frame, we can only compile and check one target here.

---
"make check" recently broke on MSYS2, and nobody noticed since apparently hardly anybody looks at the cirrus-CI output ... so here's another try to get some more test coverage in this area in the gitlab-CI instead. Patch needs to be applied after the "tests/unit/test-smp-parse:
Make an unified name for the tested machine" patch to get "make check" fixed first.

RFC -> v1:
- Use cache to speed up installation a little bit
- Add a 32-bit builder, too

 .gitlab-ci.d/qemu-project.yml |  1 +
 .gitlab-ci.d/windows.yml      | 98 +++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 .gitlab-ci.d/windows.yml
.gitlab-ci.d/qemu-project.yml +1 -0
index b3d79bc429..871262fe0e 100644
@@ -11,3 +11,4 @@ include:
   - local: '/.gitlab-ci.d/static_checks.yml'
   - local: '/.gitlab-ci.d/custom-runners.yml'
   - local: '/.gitlab-ci.d/cirrus.yml'
+  - local: '/.gitlab-ci.d/windows.yml'
.gitlab-ci.d/windows.yml new file +0 -0
new file mode 100644
index 0000000000..309f7e7fb8

.gitlab-ci.d/windows.yml line 7

Quoted 7 lines
.gitlab-ci.d/windows.yml new file +7 -0
@@ -0,0 +1,98 @@
+.shared_msys2_builder:
+  tags:
+  - shared-windows
+  - windows
+  - windows-1809
+  cache:
+    key: "${CI_JOB_NAME}-cache"

It would be nice to cache the shared 'before_script' part, but it doesn't seems trivial; meanwhile this patch works and is KISS, so:

Quoted 29 lines
.gitlab-ci.d/windows.yml new file +29 -0
+    paths:
+      - ${CI_PROJECT_DIR}/msys64/var/cache
+  needs: []
+  stage: build
+  timeout: 70m
+  before_script:
+  - If ( !(Test-Path -Path msys64\var\cache ) ) {
+      mkdir msys64\var\cache
+    }
+  - If ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) {
+      Invoke-WebRequest
+      "https://github.com/msys2/msys2-installer/releases/download/2021-07-25/msys2-base-x86_64-20210725.sfx.exe"
+      -outfile "msys64\var\cache\msys2.exe"
+    }
+  - msys64\var\cache\msys2.exe -y
+  - ((Get-Content -path .\msys64\etc\\post-install\\07-pacman-key.post -Raw)
+      -replace '--refresh-keys', '--version') |
+     Set-Content -Path ${CI_PROJECT_DIR}\msys64\etc\\post-install\\07-pacman-key.post
+  - .\msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
+  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Core update
+  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Normal update
+  - taskkill /F /FI "MODULES eq msys-2.0.dll"
+
+msys2-64bit:
+  extends: .shared_msys2_builder
+  script:
+  - .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
+      diffutils git grep make sed
+      mingw-w64-x86_64-capstone

[...]

#2 lore raw

Hi

Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Thomas Huth

Gitlab also provides runners with Windows, we can use them to test compilation with MSYS2, in both, 64-bit and 32-bit.

However, it takes quite a long time to set up the VM, so to stay in the 1h time frame, we can only compile and check one target here.

I wonder why gitlab does not offer the docker executor. On the freedesktop gitlab instance, they have windows docker executor, which speeds up the build time. Maybe we could also have our own Windows runner for qemu?

Quoted 88 lines
Quoted 4 lines

---
"make check" recently broke on MSYS2, and nobody noticed since

apparently

Quoted 10 lines

hardly anybody looks at the cirrus-CI output ... so here's another try to get some more test coverage in this area in the gitlab-CI instead. Patch needs to be applied after the "tests/unit/test-smp-parse:
Make an unified name for the tested machine" patch to get "make check" fixed first.

RFC -> v1:
- Use cache to speed up installation a little bit
- Add a 32-bit builder, too

Review

Quoted 6 lines
 .gitlab-ci.d/qemu-project.yml |  1 +
 .gitlab-ci.d/windows.yml      | 98 +++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 .gitlab-ci.d/windows.yml
(quoted diff) +0 -0

b/.gitlab-ci.d/qemu-project.yml

Quoted 14 lines

index b3d79bc429..871262fe0e 100644

.gitlab-ci.d/qemu-project.yml +1 -0
@@ -11,3 +11,4 @@ include:
   - local: '/.gitlab-ci.d/static_checks.yml'
   - local: '/.gitlab-ci.d/custom-runners.yml'
   - local: '/.gitlab-ci.d/cirrus.yml'
+  - local: '/.gitlab-ci.d/windows.yml'
.gitlab-ci.d/windows.yml new file +0 -0
new file mode 100644
index 0000000000..309f7e7fb8

.gitlab-ci.d/windows.yml line 7

Quoted 7 lines
.gitlab-ci.d/windows.yml new file +7 -0
@@ -0,0 +1,98 @@
+.shared_msys2_builder:
+  tags:
+  - shared-windows
+  - windows
+  - windows-1809
+  cache:
+    key: "${CI_JOB_NAME}-cache"

It would be nice to cache the shared 'before_script' part, but it doesn't seems trivial; meanwhile this patch works and is KISS, so:

.gitlab-ci.d/windows.yml

Quoted 12 lines
.gitlab-ci.d/windows.yml new file +12 -0
+    paths:
+      - ${CI_PROJECT_DIR}/msys64/var/cache
+  needs: []
+  stage: build
+  timeout: 70m
+  before_script:
+  - If ( !(Test-Path -Path msys64\var\cache ) ) {
+      mkdir msys64\var\cache
+    }
+  - If ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) {
+      Invoke-WebRequest
+      "

https://github.com/msys2/msys2-installer/releases/download/2021-07-25/msys2-base-x86_64-20210725.sfx.exe
"

.gitlab-ci.d/windows.yml

Quoted 4 lines
.gitlab-ci.d/windows.yml new file +4 -0
+      -outfile "msys64\var\cache\msys2.exe"
+    }
+  - msys64\var\cache\msys2.exe -y
+  - ((Get-Content -path .\msys64\etc\\post-install\\07-pacman-key.post

-Raw)

.gitlab-ci.d/windows.yml line 25

Quoted 2 lines
.gitlab-ci.d/windows.yml new file +2 -0
+      -replace '--refresh-keys', '--version') |
+     Set-Content -Path ${CI_PROJECT_DIR}\msys64\etc\\post-install\\

07-pacman-key.post

.gitlab-ci.d/windows.yml line 26

Quoted 1 line
.gitlab-ci.d/windows.yml new file +1 -0
+  - .\msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g'

/etc/pacman.conf"

.gitlab-ci.d/windows.yml line 28

Quoted 2 lines
.gitlab-ci.d/windows.yml new file +2 -0
+  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Core update
+  - .\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu'  # Normal

update

Quoted 8 lines
.gitlab-ci.d/windows.yml new file +8 -0
+  - taskkill /F /FI "MODULES eq msys-2.0.dll"
+
+msys2-64bit:
+  extends: .shared_msys2_builder
+  script:
+  - .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
+      diffutils git grep make sed
+      mingw-w64-x86_64-capstone

[...]

Signature · 1 line
Marc-André Lureau
#3 lore raw
Quoted 14 lines · Marc-André Lureau

Hi

On Mon, Nov 15, 2021 at 6:31 PM Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:

On 11/15/21 15:06, Thomas Huth wrote:
> Gitlab also provides runners with Windows, we can use them to > test compilation with MSYS2, in both, 64-bit and 32-bit. >
> However, it takes quite a long time to set up the VM, so to > stay in the 1h time frame, we can only compile and check one > target here.

Quoted 4 lines

I wonder why gitlab does not offer the docker executor. On the freedesktop gitlab instance, they have windows docker executor, which speeds up the build time. Maybe we could also have our own Windows runner for qemu?

We could, foss.org provides the QEMU project with x86 VMs resources we are not using. What we miss is a sysadmin willing to setup & maintain a such runner.

#4 lore raw
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Marc-André Lureau

Hi

On Mon, Nov 15, 2021 at 6:31 PM Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:

On 11/15/21 15:06, Thomas Huth wrote:
> Gitlab also provides runners with Windows, we can use them to > test compilation with MSYS2, in both, 64-bit and 32-bit. >
> However, it takes quite a long time to set up the VM, so to > stay in the 1h time frame, we can only compile and check one > target here.

Quoted 8 lines
Quoted 4 lines

I wonder why gitlab does not offer the docker executor. On the freedesktop gitlab instance, they have windows docker executor, which speeds up the build time. Maybe we could also have our own Windows runner for qemu?

We could, foss.org provides the QEMU project with x86 VMs resources we are not using. What we miss is a sysadmin willing to setup & maintain a such runner.

I think we might also have Azure credits from MS, but the same issues about admin and setup probably exist.

Signature · 1 line
Alex Bennée
#5 lore raw
Quoted 23 lines · Alex Bennée
Quoted 20 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Marc-André Lureau

Hi

On Mon, Nov 15, 2021 at 6:31 PM Philippe Mathieu-Daudé <[email protected] <mailto:[email protected]>> wrote:

On 11/15/21 15:06, Thomas Huth wrote:
> Gitlab also provides runners with Windows, we can use them to > test compilation with MSYS2, in both, 64-bit and 32-bit. >
> However, it takes quite a long time to set up the VM, so to > stay in the 1h time frame, we can only compile and check one > target here.

I wonder why gitlab does not offer the docker executor. On the freedesktop gitlab instance, they have windows docker executor, which speeds up the build time. Maybe we could also have our own Windows runner for qemu?

Quoted 6 lines
Quoted 3 lines

We could, foss.org provides the QEMU project with x86 VMs resources we are not using. What we miss is a sysadmin willing to setup & maintain a such runner.

I think we might also have Azure credits from MS, but the same issues about admin and setup probably exist.

I've never explored this in any way, but IIUC, Azure should have ability to run *windows* containers. If that's possible, then we could avoid the admin burden of a VM and just use throwaway windows containers as we do for Linux.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|