Skip to content

Commit c1b312b

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

File tree

1 file changed

+142
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)