Skip to content

Linux - Clang

Linux - Clang #520

Workflow file for this run

# GitHub Actions Workflow
# Build with Clang on Linux
# Copyright 2019-2024 kaoru https://www.tetengo.org/
name: Linux - Clang
on:
workflow_dispatch:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]
env:
CONCURRENT_BUILD: 4
CLANG_COMMAND: clang-14
CLANGXX_COMMAND: clang++-14
DOXYGEN_VER: 1.12.0
DOXYGEN_CACHE_REV: 0
BOOST_VER: 1_86_0
BOOST_VER_DOT: 1.86.0
BOOST_BOOTSTRAP_TOOLSET: clang
BOOST_TOOLSET: clang-14
BOOST_CACHE_REV: 0
jobs:
doxygen_build:
name: Doxygen Build
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
shell: bash
run: |
if [ ! -e .doxygen_build/doxygen-${{ env.DOXYGEN_VER }}/build/.build_finished ];
then
sudo apt-get -y update
sudo apt-get -y install \
bison \
cmake \
flex
fi
- name: Cache Doxygen build
uses: actions/cache@v4
with:
path: .doxygen_build
key: Linux-Clang-Doxygen-${{ env.DOXYGEN_VER }}-${{ env.DOXYGEN_CACHE_REV }}
- name: Build Doxygen
shell: bash
run: |
if [ ! -e .doxygen_build/doxygen-${{ env.DOXYGEN_VER }}/build/.build_finished ];
then
mkdir -p .doxygen_build
cd .doxygen_build
wget http://doxygen.nl/files/doxygen-${{ env.DOXYGEN_VER }}.src.tar.gz
tar -xf doxygen-${{ env.DOXYGEN_VER }}.src.tar.gz
mkdir -p doxygen-${{ env.DOXYGEN_VER }}/build
cd doxygen-${{ env.DOXYGEN_VER }}/build
cmake -G "Unix Makefiles" ..
make -j ${{ env.CONCURRENT_BUILD }}
touch .build_finished
fi
boost_build:
name: Boost Build
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install \
clang-14
- name: Cache Boost build
uses: actions/cache@v4
with:
path: .boost_build
key: Linux-Clang-Boost-${{ env.BOOST_VER }}-${{ env.BOOST_CACHE_REV }}
- name: Build Boost
shell: bash
run: |
if [ ! -e .boost_build/boost_${{ env.BOOST_VER }}/.build_finished ];
then
mkdir -p .boost_build
cd .boost_build
curl -L -o boost_${{ env.BOOST_VER }}.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/${{ env.BOOST_VER_DOT }}/source/boost_${{ env.BOOST_VER }}.tar.bz2
tar -xf boost_${{ env.BOOST_VER }}.tar.bz2
cd boost_${{ env.BOOST_VER }}
./bootstrap.sh --with-toolset=${{ env.BOOST_BOOTSTRAP_TOOLSET }}
(./b2 -j ${{ env.CONCURRENT_BUILD }} toolset=${{ env.BOOST_TOOLSET }} variant=release link=static || :)
touch .build_finished
fi
doxygen:
name: Doxygen
runs-on: ubuntu-22.04
needs: doxygen_build
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install \
autoconf-archive \
clang-13 \
clang-14 \
dos2unix \
graphviz \
iwyu
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Doxygen build
uses: actions/cache@v4
with:
path: .doxygen_build
key: Linux-Clang-Doxygen-${{ env.DOXYGEN_VER }}-${{ env.DOXYGEN_CACHE_REV }}
- name: Install Doxygen
shell: bash
run: |
cd .doxygen_build/doxygen-${{ env.DOXYGEN_VER }}/build
sudo make -j ${{ env.CONCURRENT_BUILD }} install
- name: Configure
shell: bash
run: |
export DISTCHECK_CONFIGURE_FLAGS=" \
CC=${{ env.CLANG_COMMAND }} \
CXX=${{ env.CLANGXX_COMMAND }} \
"
./bootstrap.sh
mkdir -p .doxygen
cd .doxygen
../configure $DISTCHECK_CONFIGURE_FLAGS
- name: Cache documents
uses: actions/cache@v4
with:
path: .doxygen/doc
key: Linux-Clang-documents-${{ github.run_number }}
- name: Make documents
shell: bash
run: |
cd .doxygen
make doc
lint:
name: Lint
runs-on: ubuntu-22.04
needs: boost_build
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install \
autoconf-archive \
clang-13 \
clang-14 \
dos2unix \
graphviz \
iwyu
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Boost build
uses: actions/cache@v4
with:
path: .boost_build
key: Linux-Clang-Boost-${{ env.BOOST_VER }}-${{ env.BOOST_CACHE_REV }}
- name: Install Boost
shell: bash
run: |
cd .boost_build/boost_${{ env.BOOST_VER }}
(sudo ./b2 -j ${{ env.CONCURRENT_BUILD }} toolset=${{ env.BOOST_TOOLSET }} variant=release link=static install --prefix=/usr/local || :)
- name: Configure
shell: bash
run: |
export DISTCHECK_CONFIGURE_FLAGS=" \
CC=${{ env.CLANG_COMMAND }} \
CXX=${{ env.CLANGXX_COMMAND }} \
"
./bootstrap.sh
mkdir -p .lint
cd .lint
../configure $DISTCHECK_CONFIGURE_FLAGS
- name: Lint
shell: bash
run: |
cd .lint
make -j ${{ env.CONCURRENT_BUILD }} iwyu
build:
name: Build
runs-on: ubuntu-22.04
needs: boost_build
steps:
- name: Install dependencies
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install \
autoconf-archive \
clang-13 \
clang-14 \
dos2unix \
graphviz \
iwyu
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Restore Boost build
uses: actions/cache@v4
with:
path: .boost_build
key: Linux-Clang-Boost-${{ env.BOOST_VER }}-${{ env.BOOST_CACHE_REV }}
- name: Install Boost
shell: bash
run: |
cd .boost_build/boost_${{ env.BOOST_VER }}
(sudo ./b2 -j ${{ env.CONCURRENT_BUILD }} toolset=${{ env.BOOST_TOOLSET }} variant=release link=static install --prefix=/usr/local || :)
- name: Configure
shell: bash
run: |
export DISTCHECK_CONFIGURE_FLAGS=" \
CC=${{ env.CLANG_COMMAND }} \
CXX=${{ env.CLANGXX_COMMAND }} \
"
./bootstrap.sh
mkdir -p .build
cd .build
../configure $DISTCHECK_CONFIGURE_FLAGS
- name: Cache archives
uses: actions/cache@v4
with:
path: .build/tetengo-*
key: Linux-Clang-archives-${{ github.run_number }}
- name: Build and make archives
shell: bash
run: |
export DISTCHECK_CONFIGURE_FLAGS=" \
CC=${{ env.CLANG_COMMAND }} \
CXX=${{ env.CLANGXX_COMMAND }} \
"
export BOOST_TEST_LOG_LEVEL=warning
cd .build
make -j ${{ env.CONCURRENT_BUILD }} distcheck
make -j ${{ env.CONCURRENT_BUILD }} dist-bzip2
make -j ${{ env.CONCURRENT_BUILD }} dist-zip
artifact:
name: Artifact Collection
runs-on: ubuntu-22.04
needs: [ doxygen, build ]
steps:
- name: Restore documents
uses: actions/cache@v4
with:
path: .doxygen/doc
key: Linux-Clang-documents-${{ github.run_number }}
- name: Restore archives
uses: actions/cache@v4
with:
path: .build/tetengo-*
key: Linux-Clang-archives-${{ github.run_number }}
- name: Move artifacts
shell: bash
run: |
mkdir .artifacts
mv .doxygen/doc .artifacts
mv .build/tetengo-* .artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-linux
path: .artifacts