Workflow file for this run
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-tools-static-amd64 | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_rqeuest: | ||
branches: [ master ] | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
clang-version: [ 3.9, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12.0.1, 13, 14, 15, 16, 17, 18 ] | ||
os: [ linux, macosx ] | ||
include: | ||
- clang-version: 13 | ||
release: llvm-project-13.0.0.src | ||
- clang-version: 14 | ||
release: llvm-project-14.0.0.src | ||
- os: linux | ||
runner: ubuntu-20.04 | ||
os-cmake-args: '-DLLVM_BUILD_STATIC=ON -DCMAKE_CXX_FLAGS="-s -flto" ${POSIX_CMAKE_ARGS}' | ||
build-args: '-j$(nproc)' | ||
bindir: '/build/bin' | ||
dotexe: '' | ||
shacmd: 'sha512sum' | ||
- os: macosx | ||
runner: macos-13 | ||
os-cmake-args: '-DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -flto" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 ${POSIX_CMAKE_ARGS}' | ||
build-args: '-j$(sysctl -n hw.ncpu)' | ||
bindir: '/build/bin' | ||
dotexe: '' | ||
shacmd: 'shasum -a512' | ||
runs-on: ${{ matrix.runner }} | ||
env: | ||
COMMON_CMAKE_ARGS: '-DBUILD_SHARED_LIBS=OFF -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra"' | ||
POSIX_CMAKE_ARGS: '-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_C_COMPILER=p-10' | ||
RELEASE: '${{ matrix.release }}' | ||
suffix: '${{ matrix.clang-version }}_${{ matrix.os }}-amd64' | ||
steps: | ||
- name: print compilers | ||
shell: bash | ||
run: | | ||
g++-10 --version || true | ||
g++-11 --version || true | ||
g++-12 --version || true | ||
g++-13 --version || true | ||
g++-14 --version || true | ||
- name: download patches | ||
# we download a tarball of this repo, as the presence of a .git directory leaks | ||
# the commit hash of this repository into the clang binaries | ||
shell: bash | ||
run: curl -L https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz | tar xvz --strip 1 | ||
- name: get llvm-project | ||
if: ${{ matrix.clang-version < 7 }} | ||
shell: bash | ||
run: | | ||
version=${RELEASE##llvm-project-} | ||
curl -LO https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz | ||
curl -LO https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz | ||
curl -LO https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz | ||
- name: get llvm-project | ||
if: ${{ matrix.clang-version == 7 || matrix.clang-version == 8 }} | ||
shell: bash | ||
run: | | ||
version=${RELEASE##llvm-project-} | ||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz | ||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/cfe-${version}.src.tar.xz | ||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz | ||
- name: get llvm-project | ||
if: ${{ matrix.clang-version >= 9 || matrix.clang-version == '12.0.1' }} | ||
shell: bash | ||
run: | | ||
version=${RELEASE##llvm-project-}; version=${version%.src} | ||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/${{ matrix.release }}.tar.xz | ||
- name: unpack llvm-project | ||
if: ${{ matrix.clang-version < 9 }} | ||
shell: bash | ||
run: | | ||
version=${RELEASE##llvm-project-} | ||
tar xf llvm-${version}.src.tar.xz | ||
tar xf cfe-${version}.src.tar.xz ${{ matrix.extra-tar-args-cfe }} | ||
tar xf clang-tools-extra-${version}.src.tar.xz | ||
mkdir ${{ matrix.release }} | ||
mv llvm-${version}.src ${{ matrix.release }}/llvm | ||
mv cfe-${version}.src ${{ matrix.release }}/clang | ||
mv clang-tools-extra-${version}.src ${{ matrix.release }}/clang-tools-extra | ||
- name: move clang 3.9 sources | ||
if: ${{ matrix.clang-version == 3.9 }} | ||
run: | | ||
mv ${{ matrix.release }}/clang ${{ matrix.release }}/llvm/tools/clang | ||
mv ${{ matrix.release }}/clang-tools-extra ${{ matrix.release }}/llvm/tools/clang/tools/extra | ||
- name: unpack llvm-project | ||
if: ${{ matrix.clang-version >= 9 || matrix.clang-version == '12.0.1' }} | ||
shell: bash | ||
run: | | ||
tar xf ${{ matrix.release }}.tar.xz ${{ matrix.extra-tar-args }} | ||
- name: patch clang-3.9 constify operator | ||
if: ${{ matrix.clang-version == 3.9 && matrix.os == 'windows' }} | ||
shell: bash | ||
run: patch ${{ matrix.release }}/llvm/utils/TableGen/AsmWriterEmitter.cpp windows-clang-3.9_constify-operator.patch | ||
- name: patch clang-8 includes | ||
if: ${{ matrix.clang-version == 8 }} | ||
shell: bash | ||
run: patch ${{ matrix.release }}/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h include-cstdint-string-prior-to-using-uint8_t.patch | ||
- name: patch trivially-copyable clang 9/10 | ||
if: ${{ ( matrix.clang-version == 9 || matrix.clang-version == 10 ) && matrix.os == 'windows' }} | ||
shell: bash | ||
run: patch ${{ matrix.release }}/llvm/cmake/config-ix.cmake windows-clang-9-10-trivially-copyable-mismatch.patch | ||
- name: patch cmake implicit link libraries on macosx | ||
if: ${{ matrix.os == 'macosx' }} | ||
shell: bash | ||
run: sed -i.backup 's/gcc_eh.\*|/gcc_eh.*|gcc_ext.*|/g' $(find /usr/local/Cellar -name CMakeParseImplicitLinkInfo.cmake) | ||
- name: cmake | ||
run: cmake -S ${{ matrix.release }}/llvm -B ${{ matrix.release }}/build ${{ env.COMMON_CMAKE_ARGS }} ${{ matrix.os-cmake-args }} ${{ matrix.extra-cmake-args }} | ||
- name: build | ||
run: cmake --build ${{ matrix.release }}/build ${{ matrix.build-args }} --target clang-format clang-query clang-tidy clang-apply-replacements | ||
- name: print dependencies | ||
if: ${{ matrix.os == 'macosx' }} | ||
run: otool -L ${{ matrix.release }}/build/bin/clang-format | ||
- name: rename output binary | ||
run: | | ||
cd ${{ matrix.release }}${{ matrix.bindir }} | ||
mv clang-format${{ matrix.dotexe }} clang-format-${{ env.suffix }}${{ matrix.dotexe }} | ||
mv clang-query${{ matrix.dotexe }} clang-query-${{ env.suffix }}${{ matrix.dotexe }} | ||
mv clang-tidy${{ matrix.dotexe }} clang-tidy-${{ env.suffix }}${{ matrix.dotexe }} | ||
mv clang-apply-replacements${{ matrix.dotexe }} clang-apply-replacements-${{ env.suffix }}${{ matrix.dotexe }} | ||
- name: create and print sha512sum | ||
shell: bash | ||
run: | | ||
cd ${{ matrix.release }}${{ matrix.bindir }} | ||
${{ matrix.shacmd }} clang-format-${{ env.suffix }} > clang-format-${{ env.suffix }}.sha512sum | ||
${{ matrix.shacmd }} clang-query-${{ env.suffix }} > clang-query-${{ env.suffix }}.sha512sum | ||
${{ matrix.shacmd }} clang-tidy-${{ env.suffix }} > clang-tidy-${{ env.suffix }}.sha512sum | ||
${{ matrix.shacmd }} clang-apply-replacements-${{ env.suffix }} > clang-apply-replacements-${{ env.suffix }}.sha512sum | ||
echo "Checksums are: " | ||
cat clang-format-${{ env.suffix }}.sha512sum | ||
cat clang-query-${{ env.suffix }}.sha512sum | ||
cat clang-tidy-${{ env.suffix }}.sha512sum | ||
cat clang-apply-replacements-${{ env.suffix }}.sha512sum | ||
- name: upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: clang-tools | ||
path: "${{ matrix.release }}${{ matrix.bindir }}/clang-*-${{ env.suffix }}*" | ||
retention-days: 1 | ||
draft-release: | ||
runs-on: ubuntu-20.04 | ||
needs: build | ||
steps: | ||
- name: download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: clang-tools | ||
- name: list files | ||
run: ls -laR . | ||
- name: draft release | ||
uses: xresloader/upload-to-github-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
file: "clang-*" | ||
draft: true |