Skip to content

Commit 16b6f6b

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

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
tar cvzf ../adflib-mingw-${{ matrix.build_type }}-cmake.tgz \
65+
bin/ include/ README.md COPYING* AUTHORS ChangeLog doc/
66+
cd ..
67+
pwd
68+
echo "Testing tar archive"
69+
tar tzf adflib-mingw-${{ matrix.build_type }}-cmake.tgz
70+
- uses: actions/upload-artifact@v4
71+
with:
72+
# name: adflib-${{ env.ADFLIB_TAG }}-windows
73+
name: adflib-mingw-${{ matrix.build_type }}
74+
path: |
75+
adflib-mingw-${{ matrix.build_type }}.tgz
76+
- name: archive tests/examples
77+
run: |
78+
mkdir -v artifact-tests
79+
tar cvzf artifact-tests/tests_examples.tgz \
80+
tests/config* \
81+
tests/examples/ \
82+
tests/examples2/ \
83+
tests/data
84+
- uses: actions/upload-artifact@v4
85+
with:
86+
name: adflib-mingw-${{ matrix.build_type }}-tests-examples
87+
path: |
88+
artifact-tests
89+
90+
test:
91+
needs: build
92+
runs-on: windows-latest
93+
strategy:
94+
matrix:
95+
# build_type: [ x64_64, i686 ]
96+
build_type: [ x64_64 ]
97+
steps:
98+
- uses: actions/download-artifact@v4
99+
with:
100+
# name: adflib-${{ env.ADFLIB_TAG }}-ubuntu
101+
name: adflib-mingw-${{ matrix.build_type }}
102+
path: .
103+
- name: extract file from the artifact
104+
run: sudo tar xzv -C / -f adflib-mingw-${{ matrix.build_type }}.tgz
105+
- name: list files extracted from the artifact
106+
run: find /usr/local -name "*adf*"
107+
# - name: list installed library files
108+
# run: ls -l /usr/local/lib/*adf*
109+
# - name: update ldconfig
110+
# run: sudo ldconfig
111+
- name: show properties of binaries (installed)
112+
shell: bash
113+
run: ldd /usr/local/bin/unadf
114+
- uses: actions/download-artifact@v4
115+
with:
116+
name: adflib-mingw-${{ matrix.build_type }}-tests-examples
117+
path: .
118+
- name: extract tests/examples
119+
run: tar xzvf tests_examples.tgz
120+
- name: test command-line utils
121+
shell: bash
122+
run: |
123+
tests/examples/test_examples_basic.sh /usr/local/bin/
124+
tests/examples/test_all_examples.sh /usr/local/bin/
125+
- name: test installed command-line utils (2)
126+
shell: bash
127+
run: |
128+
cat tests/config.sh.in_cmake | \
129+
sed -e 's@\${PROJECT_BINARY_DIR}@'"$GITHUB_WORKSPACE"'@' \
130+
-e 's@\${PROJECT_SOURCE_DIR}@'"$GITHUB_WORKSPACE"'@' \
131+
> tests/config.sh
132+
cat tests/config.sh
133+
./tests/examples2/run_all_tests.sh /usr/local/bin
134+
- name: store logs from failed tests
135+
if: failure()
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: cmake_cross_mingw_${{ matrix.build_type }}_logs_failed_tests
139+
path: |
140+
cmake/shared/Testing/

0 commit comments

Comments
 (0)