Skip to content

Commit 4fa7817

Browse files
committed
gh actions: add compilation with mingw (cross-compilation with CMake).
1 parent 8ca38de commit 4fa7817

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: cmake-cross-mingw
2+
3+
on:
4+
push:
5+
branches: [
6+
"master",
7+
"devel",
8+
"citest",
9+
"citest-cmake",
10+
"citest-cmake-cross-mingw" ]
11+
tags:
12+
- '**'
13+
pull_request:
14+
branches: [ "master", "devel" ]
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
# build_type: [ x86_64, i686 ]
22+
build_type: [ x86_64 ]
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: install prereq.
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y check gcc-mingw-w64-x86-64-win32
29+
- name: cmake_shared_configure
30+
run: |
31+
CC=${{ matrix.build_type }}-w64-mingw32-gcc \
32+
util/cmake_shared_configure \
33+
-DADFLIB_ENABLE_TESTS=OFF
34+
- name: cmake_shared_build
35+
run: util/cmake_shared_build
36+
# - name: cmake_shared_test
37+
# run: util/cmake_shared_test
38+
# - name: cmake_shared_install
39+
# run: sudo bash util/cmake_shared_install
40+
# - name: check installation
41+
# run: find /usr/local -iname '*adf*'
42+
# - name: update ldconfig
43+
# run: sudo ldconfig
44+
# - name: test command-line utils
45+
# run: ./tests/examples/test_all_examples.sh /usr/local/bin
46+
- name: check build output files
47+
run: find build/
48+
- name: prepare artifact
49+
run: |
50+
mkdir -vp artifacts/bin
51+
cp -v build/shared/src/libadf* artifacts/bin/
52+
cp -v build/shared/examples/*.exe artifacts/bin/
53+
mkdir -v artifacts/include
54+
cp -vR src/*.h artifacts/include
55+
cp -vR README.md \
56+
COPYING* \
57+
AUTHORS \
58+
ChangeLog \
59+
doc \
60+
artifacts/
61+
pwd
62+
cd artifacts ; \
63+
pwd
64+
cd ..
65+
pwd
66+
tar cvzf adflib-mingw-${{ matrix.build_type }}-cmake.tgz \
67+
bin include README.md COPYING* AUTHORS ChangeLog doc
68+
echo "Testing tar archive"
69+
pwd
70+
# tar tzf adflib-mingw-${{ matrix.build_type }}-cmake.tgz
71+
- uses: actions/upload-artifact@v4
72+
with:
73+
# name: adflib-${{ env.ADFLIB_TAG }}-windows
74+
name: adflib-mingw-${{ matrix.build_type }}
75+
path: |
76+
adflib-mingw-${{ matrix.build_type }}.tgz
77+
- name: archive tests/examples
78+
run: |
79+
mkdir -v artifact-tests
80+
tar cvzf artifact-tests/tests_examples.tgz \
81+
tests/config* \
82+
tests/examples/ \
83+
tests/examples2/ \
84+
tests/data
85+
- uses: actions/upload-artifact@v4
86+
with:
87+
name: adflib-mingw-${{ matrix.build_type }}-tests-examples
88+
path: |
89+
artifact-tests
90+
91+
test:
92+
needs: build
93+
runs-on: windows-latest
94+
strategy:
95+
matrix:
96+
# build_type: [ x64_64, i686 ]
97+
build_type: [ x64_64 ]
98+
steps:
99+
- uses: actions/download-artifact@v4
100+
with:
101+
# name: adflib-${{ env.ADFLIB_TAG }}-ubuntu
102+
name: adflib-mingw-${{ matrix.build_type }}
103+
path: .
104+
- name: extract file from the artifact
105+
run: sudo tar xzv -C / -f adflib-mingw-${{ matrix.build_type }}.tgz
106+
- name: list files extracted from the artifact
107+
run: find /usr/local -name "*adf*"
108+
# - name: list installed library files
109+
# run: ls -l /usr/local/lib/*adf*
110+
# - name: update ldconfig
111+
# run: sudo ldconfig
112+
- name: show properties of binaries (installed)
113+
shell: bash
114+
run: ldd /usr/local/bin/unadf
115+
- uses: actions/download-artifact@v4
116+
with:
117+
name: adflib-mingw-${{ matrix.build_type }}-tests-examples
118+
path: .
119+
- name: extract tests/examples
120+
run: tar xzvf tests_examples.tgz
121+
- name: test command-line utils
122+
shell: bash
123+
run: |
124+
tests/examples/test_examples_basic.sh /usr/local/bin/
125+
tests/examples/test_all_examples.sh /usr/local/bin/
126+
- name: test installed command-line utils (2)
127+
shell: bash
128+
run: |
129+
cat tests/config.sh.in_cmake | \
130+
sed -e 's@\${PROJECT_BINARY_DIR}@'"$GITHUB_WORKSPACE"'@' \
131+
-e 's@\${PROJECT_SOURCE_DIR}@'"$GITHUB_WORKSPACE"'@' \
132+
> tests/config.sh
133+
cat tests/config.sh
134+
./tests/examples2/run_all_tests.sh /usr/local/bin
135+
- name: store logs from failed tests
136+
if: failure()
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: cmake_cross_mingw_${{ matrix.build_type }}_logs_failed_tests
140+
path: |
141+
cmake/shared/Testing/

0 commit comments

Comments
 (0)