Skip to content

Commit 3d2231c

Browse files
kleisaukelu-zero
authored andcommittedJan 9, 2025·
Unbreak the CI
1 parent c4e6c08 commit 3d2231c

File tree

1 file changed

+49
-70
lines changed

1 file changed

+49
-70
lines changed
 

‎.github/workflows/example-project.yml

+49-70
Original file line numberDiff line numberDiff line change
@@ -33,84 +33,56 @@ jobs:
3333
with:
3434
toolchain: stable${{ matrix.toolchain-suffix }}
3535

36+
- name: Install pkgconf
37+
if: runner.os == 'Windows'
38+
uses: msys2/setup-msys2@v2
39+
id: msys2
40+
with:
41+
msystem: ucrt64
42+
install: mingw-w64-ucrt-x86_64-pkgconf
43+
44+
- name: Put pkgconf on PATH
45+
if: runner.os == 'Windows'
46+
run: Add-Content $env:GITHUB_PATH "${{ steps.msys2.outputs.msys2-location }}\ucrt64\bin"
47+
3648
- name: Install cargo-c applet
37-
run: |
38-
cargo install --path .
49+
run: cargo install --path .
3950

4051
- name: Test example project
4152
working-directory: example-project
42-
run: |
43-
cargo test --verbose
53+
run: cargo test --verbose
4454

4555
- name: Build C API for example project
4656
working-directory: example-project
47-
run: |
48-
cargo cbuild --verbose --release
57+
run: cargo cbuild --verbose --release
4958

5059
- name: Run C API tests for example project
5160
working-directory: example-project
52-
run: |
53-
cargo ctest --verbose --release
61+
run: cargo ctest --verbose --release
5462

55-
- name: Install into temporary location
63+
- name: Install into /usr/local
64+
if: runner.os != 'Windows'
5665
working-directory: example-project
57-
run: |
58-
cargo cinstall --verbose --release --destdir=temp
66+
run: sudo -E env PATH=$PATH cargo cinstall --verbose --release --prefix=/usr/local
5967

60-
- name: Copy installed files to /usr/local
61-
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
62-
working-directory: example-project
63-
run: |
64-
sudo cp -r temp/usr/local/* /usr/local/
65-
66-
- name: Install into Cargo root
67-
if: startsWith(matrix.os, 'windows')
68-
shell: bash
68+
- name: Install into MSYS2 root
69+
if: runner.os == 'Windows'
6970
working-directory: example-project
70-
run: |
71-
cargo cinstall --verbose --release --prefix=$CARGO_HOME
71+
run: cargo cinstall --verbose --release --prefix="${{ steps.msys2.outputs.msys2-location }}\ucrt64"
7272

73-
- name: Test pkg-config
74-
if: startsWith(matrix.os, 'macos')
73+
- name: Test pkgconf
74+
if: runner.os == 'macOS'
7575
run: |
7676
set -x
77-
test "$(pkg-config --cflags example_project)" = "-I/usr/local/include/example-project-0.1"
78-
test "$(pkg-config --libs example_project)" = "-L/usr/local/lib -lexample-project"
79-
80-
- name: Install pkgconf
81-
if: startsWith(matrix.os, 'ubuntu')
82-
uses: awalsh128/cache-apt-pkgs-action@latest
83-
with:
84-
packages: pkgconf
85-
86-
- name: Setup Meson + Ninja
87-
if: startsWith(matrix.os, 'windows')
88-
run: |
89-
python3 -m pip install --upgrade pip setuptools wheel
90-
python3 -m pip install meson ninja
91-
92-
- name: Setup MSVC for test
93-
if: startsWith(matrix.os, 'windows')
94-
uses: ilammy/msvc-dev-cmd@v1
95-
with:
96-
arch: x86_64
97-
98-
# https://github.com/pkgconf/pkgconf/issues/364
99-
- name: Install pkgconf
100-
if: startsWith(matrix.os, 'windows')
101-
run: |
102-
git clone https://github.com/amyspark/pkgconf --branch msvc
103-
cd pkgconf
104-
meson setup build --prefix=$env:CARGO_HOME
105-
meson compile -C build
106-
meson install -C build
77+
pkgconf --version
78+
test "$(pkgconf --cflags example_project)" = "-I/usr/local/include/example-project-0.1"
79+
test "$(pkgconf --libs example_project)" = "-L/usr/local/lib -lexample-project"
10780
10881
- name: Test pkgconf
109-
if: startsWith(matrix.os, 'ubuntu')
82+
if: runner.os == 'Linux'
11083
run: |
11184
set -x
11285
pkgconf --version
113-
pkg-config --version
11486
ARCHDIR=`dpkg-architecture -qDEB_HOST_MULTIARCH`
11587
# ubuntu seems to add trailing spaces for no specific reasons.
11688
CFLAGS=$(pkgconf --cflags example_project)
@@ -120,34 +92,41 @@ jobs:
12092
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
12193
12294
- name: Test pkgconf
123-
if: startsWith(matrix.os, 'windows')
95+
if: runner.os == 'Windows'
12496
shell: bash
12597
run: |
12698
set -x
12799
pkgconf --version
128-
CFLAGS=$(pkgconf --cflags example_project)
129-
LIBS=$(pkgconf --libs example_project)
130-
131-
test "${CFLAGS%% }" = "-I${CARGO_HOME//\\//}/bin/../include/example-project-0.1"
132-
test "${LIBS%% }" = "-L${CARGO_HOME//\\//}/bin/../lib -lexample-project"
100+
# use --define-variable=prefix=C:/foo to test relative libdir/includedir generation
101+
# https://github.com/lu-zero/cargo-c/commit/76a66cd72eb4271501557eebea7060821e63b702
102+
test "$(pkgconf --define-variable=prefix=C:/foo --cflags example_project)" = "-IC:/foo/include/example-project-0.1"
103+
test "$(pkgconf --define-variable=prefix=C:/foo --libs example_project)" = "-LC:/foo/lib -lexample-project"
133104
134105
- name: Update dynamic linker cache
135-
if: startsWith(matrix.os, 'ubuntu')
136-
run: |
137-
sudo ldconfig
106+
if: runner.os == 'Linux'
107+
run: sudo ldconfig
138108

139109
- name: Test usage from C (using Makefile)
140-
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
110+
if: runner.os != 'Windows'
141111
working-directory: example-project/usage-from-c
112+
run: make
113+
114+
- name: Setup Meson + Ninja
115+
if: runner.os == 'Windows' && matrix.toolchain-suffix == '-msvc'
142116
run: |
143-
make
117+
python3 -m pip install --upgrade pip setuptools wheel
118+
python3 -m pip install meson ninja
119+
120+
- name: Setup MSVC for test
121+
if: runner.os == 'Windows' && matrix.toolchain-suffix == '-msvc'
122+
uses: ilammy/msvc-dev-cmd@v1
123+
with:
124+
arch: x86_64
144125

145126
- name: Test usage from C (Meson)
146-
if: startsWith(matrix.os, 'windows') && matrix.toolchain-suffix == '-msvc'
127+
if: runner.os == 'Windows' && matrix.toolchain-suffix == '-msvc'
147128
working-directory: example-project/usage-from-c
148-
shell: pwsh
149129
run: |
150-
$env:PKG_CONFIG="$env:CARGO_HOME/bin/pkgconf.exe"
151130
meson setup build
152131
meson compile -C build
153132
meson test -C build

0 commit comments

Comments
 (0)
Please sign in to comment.