TGLMAN

Setup Gitlab shared runner for run tests on windows

Today in one of my projects, I discovered a bug that happened only on Windows, I personally have no machines that run Windows so had some trouble to reproduce the problem, so the first thing that came to my mind was try to set up the Continuous Integration to run on Windows, for the specific project I use GitLab and the relative GitLab-CI, I went to search what was the support for Windows in the shared runners and I got a good surprise, GitLab provide shared runners with the support of windows you just need to specify some tags:

Example of reusable configuration:

.shared_windows_runners:
  tags:
  - shared-windows
  - windows
  - windows-1809

done this I went to the hunt of how to install rust on the machine to run the tests, was thinking to go ahead with rustup, but it felt a bit of an overkill, so a searched a bit for possible solution and on my surprise as well I discovered that also Windows has finally entered the twenty-first century, and have a package manager called Chocolatey that is already install in the GitLab shared runner, and there is a package rust that seems to work pretty fine so I could do a .gitlab-ci.yaml that look more or less like this:

.shared_windows_runners:
  tags:
  - shared-windows
  - windows
  - windows-1809

tests_windows:
  extends:
  - .shared_windows_runners
  script:
    - choco install rust -y -f
    - rustc --version   # Print version info for debugging
    - cargo --version   # Print version info for debugging
    - cargo test --all-features

I'm posting because I've been surprised how this has been easy, I guess has been too many years that I do not do anything meaningful on a Windows machine, and I missed a lot of catch-up that Windows has done.

Posts

New host for the blog with new tools
30-01-2022
Tags: rust, self_hosting

First Week Librem 5
09-11-2021
Tags: librem5

Rust lib error management, multiple enum approach
10-04-2021
Tags: rust

Setup Gitlab runner for run ci tests locally
18-01-2020
Tags: self_hosting

Setup Gitlab shared runner for run tests on windows
18-01-2020
Tags: rust

Refs

Mastodon
GitLab
Github
StackOverflow

Projects

tglman.org
Structsy
Persy
URL Freezer