makefile: fix built timestamp in main #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clang | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: dnsforwarder-${{matrix.env}}-${{matrix.os}} | |
runs-on: ${{matrix.os}} # run native test | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
env: x86_64 | |
sys: clang64 | |
bin: codeblocks_win/bin/Release/dnsforwarder.exe | |
shell: msys2 {0} | |
- os: windows-latest | |
env: i686 | |
sys: clang32 | |
bin: codeblocks_win/bin/Release/dnsforwarder.exe | |
shell: msys2 {0} | |
- os: ubuntu-latest | |
env: amd64 | |
bin: dnsforwarder | |
shell: bash | |
- os: ubuntu-latest | |
env: i386 | |
bin: dnsforwarder | |
shell: bash | |
fail-fast: false | |
defaults: | |
run: | |
shell: ${{matrix.shell}} | |
steps: | |
- uses: actions/checkout@v4 | |
# https://github.com/msys2/setup-msys2 | |
- name: "${{matrix.os}}: Set up MSYS2" | |
if: runner.os == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
release: false | |
# pacman group: https://packages.msys2.org/group/ | |
install: >- | |
mingw-w64-clang-${{matrix.env}}-gcc-compat | |
mingw-w64-clang-${{matrix.env}}-clang-analyzer | |
make | |
- name: "${{matrix.os}}: Setup and Config" | |
if: runner.os == 'Linux' | |
run: | | |
echo Setting up clang ${{matrix.env}} ... | |
sudo dpkg --add-architecture ${{matrix.env}} | |
sudo apt-get update | |
if [ "${{matrix.env}}" = "i386" ]; then | |
# 20230520: Seems these dependencies have conflicts that can't be solved with the existing amd64 version. | |
sudo apt-get install -y libgcc-s1:${{matrix.env}} libgomp1:${{matrix.env}} libitm1:${{matrix.env}} \ | |
libatomic1:${{matrix.env}} libubsan1:${{matrix.env}} libquadmath0:${{matrix.env}} \ | |
libstdc++6:${{matrix.env}} | |
fi | |
sudo apt-get install -y "libc6-dev:${{matrix.env}}" "lib$(readlink /usr/bin/gcc)-dev:${{matrix.env}}" "libcurl4-openssl-dev:${{matrix.env}}" "clang-tools" | |
CLANG="$(readlink -f /usr/bin/clang)" | |
LLD=${CLANG/clang/lld} | |
sudo update-alternatives --install /usr/bin/lld lld ${LLD} 100 | |
export CC=clang | |
export LD=lld | |
echo CC="clang" >> $GITHUB_ENV | |
echo LD="lld" >> $GITHUB_ENV | |
echo Configuring ... | |
aclocal | |
autoheader | |
autoconf | |
automake -a | |
if [ "${{matrix.env}}" = "i386" ]; then | |
export CFLAGS="-m32" | |
fi | |
CFLAGS+=" -O2" ./configure | |
- name: Build | |
run: | | |
if [ "${{runner.os}}" = "Windows" ]; then | |
cd codeblocks_win | |
fi | |
# scan-build overwrites `CC` and `CXX`, but adopts `CCC_CC` and `CCC_CXX`. | |
CCC_CC=clang scan-build -k -v make | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dnsforwarder-${{github.head_ref || github.ref_name}}-${{matrix.env}}-${{matrix.os}}-clang | |
path: | | |
${{matrix.bin}} |