Skip to content

Commit

Permalink
ci(windows): don't use a container
Browse files Browse the repository at this point in the history
Windows containers in GitHub Actions are simply bad. While it is
possible to use them, it is a horrible hack with terrible usability.

It was a fun experiment, but I don't want anybody to maintain this mess,
especially when you can use a normal Windows image (less cool, bloated,
but well supported).
  • Loading branch information
Tachi107 authored and marzer committed Feb 17, 2022
1 parent a35c7bc commit 7306fd2
Showing 1 changed file with 20 additions and 47 deletions.
67 changes: 20 additions & 47 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ jobs:
- name: Install dependencies
run: |
apt-get -y update
apt-get -y install --no-install-recommends ${{ matrix.compiler }} lld meson pkgconf git ca-certificates locales-all python3-pip
apt-get -y install --no-install-recommends ${{ matrix.compiler }} lld meson pkgconf git ca-certificates locales-all python3-pip catch2 nlohmann-json3-dev
- uses: actions/checkout@v2
with:
submodules: true

- name: Check toml.hpp
run: |
Expand All @@ -50,18 +48,6 @@ jobs:
- name: Test
run: meson test -C build --verbose

# The Windows job is a mess, but it's a mess with some advantages.
# The job is ran in a clean Docker container, and we have full control on
# the software present there. This also means that every single program
# needs to be manually installed, and since Windows doesn't have a
# package manager installing stuff in scripts is pure pain.
# Also, GitHub's support for Windows containers is really, really bad,
# and the only way of running a job in Docker is by passing everything to
# `docker run`, as a single cmd.exe command.
# Lastly, altering the PATH is almost impossible, and as far as I know
# the only thing that does that reliably is vcvars64.bat; so to make an
# executable available it is necessary to manually move it in a directory
# already in Path, like C:\vs\Common7\Tools\
windows:
strategy:
fail-fast: false
Expand All @@ -75,35 +61,22 @@ jobs:
shell: cmd

steps:
# When the job is triggered by a pull request, we need to fetch the
# "test" merge commit with this command. More info here:
# https://docs.github.com/en/rest/reference/pulls#get-a-pull-request
- name: pull_request fetch command
if: github.event_name == 'pull_request'
run: echo pull_request_fetch_command=git fetch origin +${{ github.event.pull_request.merge_commit_sha }}:${{ github.ref_name }} ^&^& >> %GITHUB_ENV%

- name: Docker
run: docker run mcr.microsoft.com/windows/servercore:ltsc2022 cmd.exe /c "
mkdir C:\dev &&
cd C:\dev &&
curl -LO https://aka.ms/vs/17/release.ltsc.17.0/vs_buildtools.exe &&
.\vs_buildtools.exe --installPath C:\vs --quiet --norestart --wait --nocache --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 &&
C:\vs\VC\Auxiliary\Build\vcvars64.bat &&
curl -Lo meson.msi https://github.com/mesonbuild/meson/releases/download/0.61.1/meson-0.61.1-64.msi &&
msiexec /a meson.msi TARGETDIR=C:\meson /quiet /qn &&
move C:\meson\Meson\* C:\vs\Common7\Tools\ &&
curl -Lo git.zip https://github.com/git-for-windows/git/releases/download/v2.35.1.windows.2/MinGit-2.35.1.2-busybox-64-bit.zip &&
mkdir git &&
cd git &&
tar -xf ..\git.zip &&
cd .. &&
move git\cmd\* C:\vs\Common7\Tools\ &&
move git\etc C:\vs\Common7\ &&
move git\mingw64 C:\vs\Common7\ &&
move git\usr C:\vs\Common7\ &&
git clone ${{ github.repositoryUrl }} &&
cd tomlplusplus && ${{ env.pull_request_fetch_command }}
git checkout ${{ github.ref_name }} &&
meson setup -Dcompile_library=${{ matrix.compile }} -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false build &&
meson compile -C build &&
meson test -C build"
- name: Install dependencies
run: |
python3 -m pip install -U pip==21.3.1
pip3 install meson ninja
- uses: actions/checkout@v2
with:
submodules: true

- uses: ilammy/msvc-dev-cmd@v1

- name: Configure Meson
run: meson setup --vsenv -Dcompile_library=${{ matrix.compile }} -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false build

- name: Build
run: meson compile -C build

- name: Test
run: meson test -C build --verbose

0 comments on commit 7306fd2

Please sign in to comment.