Skip to content

Commit edece60

Browse files
ci: Switch from gsvbuild to MSVC
Allows testing main of the libraries we provide bindings for
1 parent 182a397 commit edece60

File tree

1 file changed

+134
-62
lines changed

1 file changed

+134
-62
lines changed

.github/workflows/windows.yml

Lines changed: 134 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,142 @@ on:
77
name: Windows
88

99
jobs:
10-
11-
gvsbuild:
12-
name: build GTK binaries with gvsbuild
13-
runs-on: windows-2022
14-
15-
env:
16-
# git revision of gvsbuild we use for to build GLib and the other dependencies
17-
gvsbuildref: 230e1074047b9654b76217c5d48b10c726fbe0f6
18-
19-
# bump this number if you want to force a rebuild of gvsbuild with the same revision
20-
gvsbuildupdate: 1
21-
22-
outputs:
23-
cachekey: ${{ steps.output.outputs.cachekey }}
10+
build-deps:
11+
name: Build dependencies with MSVC
12+
runs-on: windows-latest
2413

2514
steps:
26-
# this is needed for the cache restore to work
27-
- name: (GTK binaries) create dir
28-
run: mkdir C:\gtk-build\gtk\x64\release
29-
30-
- name: (GTK binaries) get from cache
31-
uses: actions/cache@v4
15+
- uses: actions/cache@v4
3216
id: cache
3317
with:
34-
path: C:\gtk-build\gtk\x64\release\**
35-
key: gvsbuild-${{ env.gvsbuildupdate }}-${{ env.gvsbuildref }}
18+
path: c:/gnome
19+
key: ${{ runner.os }}-gtk-rs-core-msvc-20
20+
restore-keys: |
21+
${{ runner.os }}-gtk-rs-core-msvc-20
3622
37-
- name: (GTK binaries) checkout gvsbuild
38-
if: steps.cache.outputs.cache-hit != 'true'
39-
uses: actions/checkout@v6
40-
with:
41-
repository: wingtk/gvsbuild
42-
ref: ${{ env.gvsbuildref }}
43-
path: gvsbuild
23+
- name: Set up the PATH environment
24+
run: |
25+
echo "C:\pkg-config-lite-0.28-1\bin" >> $GITHUB_PATH
26+
echo "C:\gnome\bin" >> $GITHUB_PATH
27+
shell: bash
4428

45-
# Temporarily move the preinstalled git, it causes errors related to cygwin.
46-
- name: (GTK binaries) move git binary
47-
if: steps.cache.outputs.cache-hit != 'true'
29+
- name: Install pkgconfig-lite
4830
run: |
49-
move "C:\Program Files\Git\usr\bin" "C:\Program Files\Git\usr\notbin"
50-
move "C:\Program Files\Git\bin" "C:\Program Files\Git\notbin"
51-
shell: cmd
31+
Invoke-WebRequest -UserAgent "Wget" -Uri https://downloads.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip -OutFile /pkg_config_lite.zip -MaximumRetryCount 5
32+
Expand-Archive /pkg_config_lite.zip -DestinationPath C:\
33+
pkg-config --version
5234
53-
- name: (GTK binaries) install gvsbuild
35+
- name: Clone dependencies
5436
if: steps.cache.outputs.cache-hit != 'true'
55-
working-directory: gvsbuild
56-
run: python -m pip install .
37+
shell: bash
38+
run: |
39+
cd /c
40+
git clone https://github.com/madler/zlib.git --depth 1
41+
git clone https://github.com/pnggroup/libpng.git --depth 1 --branch libpng16
42+
git clone https://gitlab.freedesktop.org/pixman/pixman.git --depth 1
43+
git clone https://gitlab.freedesktop.org/freetype/freetype.git --depth 1
44+
git clone https://gitlab.gnome.org/GNOME/glib.git --depth 1
45+
git clone https://github.com/harfbuzz/harfbuzz.git --depth 1
46+
git clone https://gitlab.freedesktop.org/cairo/cairo.git --depth 1
47+
git clone https://github.com/fribidi/fribidi.git --depth 1
48+
git clone https://gitlab.gnome.org/GNOME/pango.git --depth 1
49+
git clone https://gitlab.gnome.org/GNOME/gdk-pixbuf.git --depth 1
50+
git clone https://github.com/ebassi/graphene.git --depth 1
51+
52+
- name: Setup Python
53+
uses: actions/setup-python@v6
54+
with:
55+
python-version: "3.x"
5756

58-
- name: (GTK binaries) run gvsbuild
59-
if: steps.cache.outputs.cache-hit != 'true'
60-
run: gvsbuild build --platform=x64 --vs-ver=17 --msys-dir=C:\msys64 gtk3 graphene
57+
- name: Install Python Dependencies
58+
run: pip install meson ninja setuptools packaging
6159

62-
- name: (GTK binaries) restore git binary
60+
- name: Setup MSVC
61+
uses: bus1/cabuild/action/msdevshell@v1
62+
with:
63+
architecture: x64
64+
65+
- name: Set PKG_CONFIG_PATH
66+
shell: bash
67+
run: |
68+
echo "PKG_CONFIG_PATH=C:/gnome/lib/pkgconfig" >> $GITHUB_ENV
69+
70+
- name: Remove conflicting link.exe from Git
6371
if: steps.cache.outputs.cache-hit != 'true'
72+
shell: bash
6473
run: |
65-
move "C:\Program Files\Git\usr\notbin" "C:\Program Files\Git\usr\bin"
66-
move "C:\Program Files\Git\notbin" "C:\Program Files\Git\bin"
67-
shell: cmd
74+
rm -f "/c/Program Files/Git/usr/bin/link.exe"
6875
69-
- name: (GTK binaries) output cache key
70-
id: output
71-
run: echo "::set-output name=cachekey::gvsbuild-${{ env.gvsbuildupdate }}-${{ env.gvsbuildref }}"
76+
- name: Build and install dependencies
77+
if: steps.cache.outputs.cache-hit != 'true'
78+
shell: bash
79+
run: |
80+
# Build zlib
81+
cd /c/zlib
82+
cmake -S . -B builddir -DCMAKE_INSTALL_PREFIX=C:/gnome -DCMAKE_BUILD_TYPE=Release
83+
cmake --build builddir --config Release
84+
cmake --install builddir --config Release
85+
86+
# Build libpng
87+
cd /c/libpng
88+
cmake -S . -B builddir -DCMAKE_INSTALL_PREFIX=C:/gnome -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:/gnome -DPNG_TESTS=OFF
89+
cmake --build builddir --config Release
90+
cmake --install builddir --config Release
91+
92+
# Build pixman
93+
cd /c/pixman
94+
meson setup builddir --prefix=C:/gnome -Dtests=disabled
95+
meson install -C builddir
96+
97+
# Build FreeType (without HarfBuzz first)
98+
cd /c/freetype
99+
meson setup builddir --prefix=C:/gnome -Dharfbuzz=disabled -Dpng=enabled -Dzlib=enabled
100+
meson install -C builddir
101+
102+
# Build GLib
103+
cd /c/glib
104+
meson setup builddir --prefix=C:/gnome -Dtests=false -Dsysprof=disabled
105+
meson install -C builddir
106+
107+
# Build HarfBuzz
108+
cd /c/harfbuzz
109+
meson setup builddir --prefix=C:/gnome -Dtests=disabled -Ddocs=disabled -Dcairo=disabled -Dglib=enabled -Dfreetype=enabled
110+
meson install -C builddir
111+
112+
# Rebuild FreeType with HarfBuzz
113+
cd /c/freetype
114+
meson setup builddir --prefix=C:/gnome -Dharfbuzz=enabled -Dpng=enabled -Dzlib=enabled --wipe
115+
meson install -C builddir
116+
117+
# Build cairo
118+
cd /c/cairo
119+
meson setup builddir --prefix=C:/gnome -Dtests=disabled -Dglib=enabled
120+
meson install -C builddir
121+
122+
# Build Fribidi
123+
cd /c/fribidi
124+
meson setup builddir --prefix=C:/gnome -Dtests=false -Ddocs=false
125+
meson install -C builddir
126+
127+
# Build Pango
128+
cd /c/pango
129+
meson setup builddir --prefix=C:/gnome -Dintrospection=disabled -Dbuild-testsuite=false -Dbuild-examples=false
130+
meson install -C builddir
131+
132+
# Build gdk-pixbuf
133+
cd /c/gdk-pixbuf
134+
meson setup builddir --prefix=C:/gnome -Dtests=false -Dintrospection=disabled -Dman=false
135+
meson install -C builddir
136+
137+
# Build graphene
138+
cd /c/graphene
139+
meson setup builddir --prefix=C:/gnome -Dtests=false -Dintrospection=disabled
140+
meson install -C builddir
72141
73142
build:
74-
name: build gtk-rs on Windows
75-
runs-on: windows-2022
76-
needs: gvsbuild
143+
name: Build gtk-rs on Windows
144+
runs-on: windows-latest
145+
needs: build-deps
77146

78147
strategy:
79148
matrix:
@@ -89,25 +158,28 @@ jobs:
89158
- { name: "examples", test: false, args: "--bins --examples --all-features" }
90159

91160
steps:
161+
- uses: actions/checkout@v6
92162

93-
# this is needed for the cache restore to work
94-
- name: Create GTK binaries dir
95-
run: mkdir C:\gtk-build\gtk\x64\release
96-
97-
- name: Get GTK binaries from cache
98-
uses: actions/cache@v4
163+
- uses: actions/cache@v4
99164
id: cache
100165
with:
101-
path: C:\gtk-build\gtk\x64\release\**
102-
key: ${{needs.gvsbuild.outputs.cachekey}}
166+
path: c:/gnome
167+
key: ${{ runner.os }}-gtk-rs-core-msvc-20
168+
restore-keys: |
169+
${{ runner.os }}-gtk-rs-core-msvc-20
103170
104171
- name: Set up env
105172
run: |
106-
echo "PKG_CONFIG=C:\gtk-build\gtk\x64\release\bin\pkgconf.exe" >> $GITHUB_ENV
107-
echo "C:\gtk-build\gtk\x64\release\bin" >> $GITHUB_PATH
173+
echo "PKG_CONFIG=C:\pkg-config-lite-0.28-1\bin\pkg-config.exe" >> $GITHUB_ENV
174+
echo "PKG_CONFIG_PATH=C:/gnome/lib/pkgconfig" >> $GITHUB_ENV
175+
echo "C:\pkg-config-lite-0.28-1\bin" >> $GITHUB_PATH
176+
echo "C:\gnome\bin" >> $GITHUB_PATH
108177
shell: bash
109178

110-
- uses: actions/checkout@v6
179+
- name: Install pkgconfig-lite
180+
run: |
181+
Invoke-WebRequest -UserAgent "Wget" -Uri https://downloads.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip -OutFile /pkg_config_lite.zip -MaximumRetryCount 5
182+
Expand-Archive /pkg_config_lite.zip -DestinationPath C:\
111183
112184
- uses: actions-rs/toolchain@v1
113185
with:

0 commit comments

Comments
 (0)