1- name : Github CI
1+ name : Multi-Platform CI
22on :
33 push :
44 branches :
88 tags :
99 - ' 0.*.*'
1010 - ' 0.*'
11+ - ' nightly-*'
1112 pull_request :
1213 branches :
1314 - ' *'
15+ workflow_dispatch :
16+ inputs :
17+ build_artifacts :
18+ description : ' Build and upload artifacts'
19+ required : false
20+ default : true
21+ type : boolean
1422
1523concurrency :
1624 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -21,12 +29,14 @@ concurrency:
2129# os: [ubuntu-14.04, ubuntu-18.04, ubuntu-20.04, ubuntu-latest]
2230
2331jobs :
24- linux :
25- runs-on : ubuntu-latest
32+ # Ubuntu builds for multiple versions
33+ ubuntu :
34+ runs-on : ${{ matrix.os }}
2635 timeout-minutes : 50
2736 strategy :
28- fail-fast : true
37+ fail-fast : false
2938 matrix :
39+ os : [ubuntu-22.04, ubuntu-latest]
3040 CONFIGURE_ARGS :
3141 - CFLAGS="-O1 -fno-omit-frame-pointer -fsanitize=address -fno-var-tracking" --disable-bindings --disable-docs
3242 - CC="clang"
7787 - uses : hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
7888 with :
7989 create-symlink : true
80- key : ${{ github.job }}-${{ matrix.CONFIGURE_ARGS }}
90+ key : ${{ github.job }}-${{ matrix.os }}-${{ matrix. CONFIGURE_ARGS }}
8191 - run : sh autogen.sh
8292 - if : contains(matrix.CONFIGURE_ARGS, '-fsanitize=address')
8393 name : Fix kernel mmap rnd bits for -fsanitize=address
@@ -96,6 +106,18 @@ jobs:
96106 !contains(matrix.CONFIGURE_ARGS, '--enable-debug') &&
97107 startsWith(github.ref, 'refs/heads/') }}
98108 run : make -j check
109+ # Create Ubuntu artifacts for release config
110+ - if : contains(matrix.CONFIGURE_ARGS, '--enable-release') && matrix.os == 'ubuntu-latest'
111+ name : Create Linux artifact
112+ run : |
113+ make install DESTDIR=$PWD/install_dir
114+ tar czf libredwg-linux-x86_64.tar.gz -C install_dir .
115+ - if : contains(matrix.CONFIGURE_ARGS, '--enable-release') && matrix.os == 'ubuntu-latest'
116+ name : Upload Linux artifact
117+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
118+ with :
119+ name : libredwg-linux-x86_64
120+ path : libredwg-linux-x86_64.tar.gz
99121 # run: |
100122 # python -m pip install cpp-coveralls
101123 # make gcov
@@ -191,9 +213,130 @@ jobs:
191213 with :
192214 name : cmake-failure.tgz
193215 path : cmake-failure.tgz
216+ # Fedora build using container
217+ fedora :
218+ runs-on : ubuntu-latest
219+ container : fedora:latest
220+ timeout-minutes : 30
221+ steps :
222+ - name : Install dependencies
223+ run : |
224+ dnf install -y git gcc gcc-c++ make autoconf automake libtool \
225+ texinfo libxml2-devel pcre2-devel python3-devel swig \
226+ redhat-rpm-config ccache which perl glibc-langpack-en
227+ - name : checkout
228+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
229+ with :
230+ fetch-depth : 1
231+ submodules : recursive
232+ - name : Configure git safe directory
233+ run : git config --global --add safe.directory $GITHUB_WORKSPACE
234+ - uses : hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
235+ with :
236+ create-symlink : true
237+ key : ${{ github.job }}
238+ - run : sh autogen.sh
239+ - name : Configure with FORTIFY_SOURCE disabled
240+ run : CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" ./configure --disable-werror
241+ - run : make -j
242+ - run : |
243+ # Run tests with more verbose output and continue on error
244+ make -j check VERBOSE=1 || {
245+ echo "Tests failed, checking test logs..."
246+ find . -name "*.log" -type f -exec echo "=== {} ===" \; -exec tail -20 {} \;
247+ exit 1
248+ }
249+
250+ # Debian build using container
251+ debian :
252+ runs-on : ubuntu-latest
253+ container : debian:latest
254+ timeout-minutes : 30
255+ steps :
256+ - name : Install dependencies
257+ run : |
258+ apt-get update
259+ apt-get install -y git gcc g++ make autoconf automake libtool \
260+ texinfo libxml2-dev libpcre2-dev python3-dev swig ccache
261+ - name : checkout
262+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
263+ with :
264+ fetch-depth : 1
265+ submodules : recursive
266+ - name : Configure git safe directory
267+ run : git config --global --add safe.directory $GITHUB_WORKSPACE
268+ - uses : hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
269+ with :
270+ create-symlink : true
271+ key : ${{ github.job }}
272+ - run : sh autogen.sh
273+ - run : ./configure --disable-werror
274+ - run : make -j
275+ - run : make -j check
276+
277+ # CentOS/RHEL build using container
278+ centos :
279+ runs-on : ubuntu-latest
280+ container : rockylinux:9
281+ timeout-minutes : 30
282+ steps :
283+ - name : Install dependencies
284+ run : |
285+ dnf install -y epel-release
286+ dnf config-manager --set-enabled crb
287+ dnf install -y git gcc gcc-c++ make autoconf automake libtool \
288+ texinfo libxml2-devel pcre2-devel python3-devel \
289+ ccache which perl
290+ - name : checkout
291+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
292+ with :
293+ fetch-depth : 1
294+ submodules : recursive
295+ - name : Configure git safe directory
296+ run : git config --global --add safe.directory $GITHUB_WORKSPACE
297+ - uses : hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
298+ with :
299+ create-symlink : true
300+ key : ${{ github.job }}
301+ - run : sh autogen.sh
302+ - run : ./configure --disable-werror
303+ - run : make -j
304+ - run : make -j check
305+
306+ # Alpine Linux build (musl libc)
307+ alpine :
308+ runs-on : ubuntu-latest
309+ container : alpine:latest
310+ timeout-minutes : 30
311+ steps :
312+ - name : Install dependencies
313+ run : |
314+ apk add --no-cache git gcc g++ make autoconf automake libtool \
315+ texinfo libxml2-dev pcre2-dev python3-dev swig ccache bash perl
316+ - name : checkout
317+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
318+ with :
319+ fetch-depth : 1
320+ submodules : recursive
321+ - name : Configure git safe directory
322+ run : git config --global --add safe.directory $GITHUB_WORKSPACE
323+ - uses : hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
324+ with :
325+ create-symlink : true
326+ key : ${{ github.job }}
327+ - run : sh autogen.sh
328+ - run : ./configure --disable-werror --disable-python
329+ - run : make -j
330+ - run : make -j check
331+
194332 macOS :
195333 name : macOS
196- runs-on : macOS-latest
334+ runs-on : ${{ matrix.os }}
335+ strategy :
336+ fail-fast : false
337+ matrix :
338+ os : [macos-13, macos-latest]
339+ compiler : [gcc, clang]
197340 steps :
198341 - name : init
199342 run : brew install autoconf automake libtool texinfo
@@ -211,12 +354,24 @@ jobs:
211354 - uses : hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
212355 with :
213356 create-symlink : true
214- key : ${{ github.job }}
357+ key : ${{ github.job }}-${{ matrix.os }}-${{ matrix.compiler }}
215358 - run : sh autogen.sh
216- - run : ./configure --disable-bindings --disable-werror
359+ - run : CC="${{ matrix.compiler }}" ./configure --disable-bindings --disable-werror
217360 - run : PATH="/usr/local/opt/texinfo/bin:$PATH" make
218361 - run : PATH="/usr/local/opt/texinfo/bin:$PATH" make check
219362 # - run: make distcheck
363+ # Create macOS artifacts
364+ - if : matrix.compiler == 'clang' && matrix.os == 'macos-latest'
365+ name : Create macOS artifact
366+ run : |
367+ make install DESTDIR=$PWD/install_dir
368+ tar czf libredwg-macos-${{ matrix.os }}.tar.gz -C install_dir .
369+ - if : matrix.compiler == 'clang' && matrix.os == 'macos-latest'
370+ name : Upload macOS artifact
371+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
372+ with :
373+ name : libredwg-macos-${{ matrix.os }}
374+ path : libredwg-macos-${{ matrix.os }}.tar.gz
220375 mingw :
221376 name : mingw
222377 runs-on : windows-latest
@@ -273,6 +428,19 @@ jobs:
273428 path : mingw-failure.tgz
274429 - shell : msys2 {0}
275430 run : make -j check
431+ # Create Windows MinGW artifacts
432+ - if : success()
433+ shell : msys2 {0}
434+ name : Create Windows MinGW artifact
435+ run : |
436+ make install DESTDIR=$PWD/install_dir
437+ tar czf libredwg-win64-mingw.tar.gz -C install_dir .
438+ - if : success()
439+ name : Upload Windows MinGW artifact
440+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
441+ with :
442+ name : libredwg-win64-mingw
443+ path : libredwg-win64-mingw.tar.gz
276444 mingw-cmake :
277445 runs-on : windows-latest
278446 timeout-minutes : 20
@@ -311,6 +479,21 @@ jobs:
311479 - run : cmake --build . --config Release
312480 - run : copy Release/libredwg.dll test/unit-testing/Release/
313481 - run : ctest . --output-on-failure
482+ # Create Windows MSVC artifacts
483+ - if : success()
484+ name : Create Windows MSVC artifact
485+ run : |
486+ mkdir msvc-build
487+ copy Release\*.dll msvc-build\
488+ copy Release\*.exe msvc-build\
489+ copy Release\*.lib msvc-build\
490+ tar czf libredwg-win64-msvc.tar.gz msvc-build
491+ - if : success()
492+ name : Upload Windows MSVC artifact
493+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
494+ with :
495+ name : libredwg-win64-msvc
496+ path : libredwg-win64-msvc.tar.gz
314497 - if : failure()
315498 run : tar cfz msvc-failure.tgz Testing/Temporary/LastTest.log src/config.h
316499 - if : failure()
@@ -352,3 +535,73 @@ jobs:
352535 - run : ninja
353536 - run : copy libredwg.dll test\unit-testing\
354537 - run : ctest . --output-on-failure
538+
539+ # Aggregate all platform artifacts for releases
540+ release-artifacts :
541+ name : Release Artifacts
542+ # Run on tags or successful master builds
543+ if : |
544+ always() &&
545+ (startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/master' && github.event_name == 'push')) &&
546+ !cancelled()
547+ needs : [ubuntu, fedora, debian, alpine, centos, macOS, mingw, vs2019]
548+ runs-on : ubuntu-latest
549+ steps :
550+ - name : Checkout for version info
551+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
552+ with :
553+ fetch-depth : 0 # Need full history for git-version-gen
554+
555+ - name : Get version and build number
556+ id : version
557+ run : |
558+ VERSION=$(./build-aux/git-version-gen .tarball-version)
559+ BUILD_NUM=$(git rev-list --count HEAD)
560+ SHORT_SHA=$(git rev-parse --short HEAD)
561+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
562+ TAG_NAME="${GITHUB_REF#refs/tags/}"
563+ RELEASE_NAME="Release $TAG_NAME"
564+ PRERELEASE=false
565+ else
566+ TAG_NAME="$VERSION.$BUILD_NUM"
567+ RELEASE_NAME="Nightly Build $VERSION.$BUILD_NUM ($SHORT_SHA)"
568+ PRERELEASE=true
569+ fi
570+ echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
571+ echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT
572+ echo "prerelease=$PRERELEASE" >> $GITHUB_OUTPUT
573+ echo "Creating release: $RELEASE_NAME (tag: $TAG_NAME)"
574+
575+ - name : Download all artifacts
576+ uses : actions/download-artifact@v4
577+ with :
578+ path : artifacts
579+
580+ - name : Create release checksums
581+ run : |
582+ cd artifacts
583+ sha256sum */*.tar.gz > checksums.sha256
584+ cat checksums.sha256
585+
586+ - name : Create Release
587+ uses : softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
588+ with :
589+ tag_name : ${{ steps.version.outputs.tag_name }}
590+ name : ${{ steps.version.outputs.release_name }}
591+ prerelease : ${{ steps.version.outputs.prerelease }}
592+ body : |
593+ LibreDWG ${{ steps.version.outputs.release_name }}
594+
595+ Multi-platform builds for Linux, macOS, and Windows.
596+
597+ ## Downloads
598+ - Linux builds: libredwg-linux-*.tar.gz
599+ - macOS builds: libredwg-macos-*.tar.gz
600+ - Windows MinGW: libredwg-win64-mingw.tar.gz
601+ - Windows MSVC: libredwg-win64-msvc.tar.gz
602+
603+ See checksums.sha256 for file integrity verification.
604+ files : |
605+ artifacts/*/*.tar.gz
606+ artifacts/checksums.sha256
607+ fail_on_unmatched_files : false
0 commit comments