llvm toolchain #29
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: llvm toolchain | |
defaults: | |
run: | |
shell: bash | |
on: | |
workflow_dispatch: | |
inputs: | |
command: | |
description: 'Run custom command before building' | |
required: false | |
type: string | |
jobs: | |
build_llvm: | |
name: Building LLVM and Clang | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
container: | |
image: docker://ghcr.io/shinchiro/archlinux:latest | |
steps: | |
- name: Setup git config | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global pull.rebase true | |
git config --global rebase.autoStash true | |
git config --global fetch.prune true | |
git config --global --add safe.directory $PWD | |
- uses: actions/checkout@main | |
with: | |
ref: master | |
- name: Loading clang root | |
id: clang_root_cache | |
uses: actions/cache/restore@main | |
with: | |
path: clang_root | |
key: ${{ secrets.CACHE_VERSION }}-clang_root-${{ github.run_id }} | |
restore-keys: ${{ secrets.CACHE_VERSION }}-clang_root | |
- name: Loading x86_64 toolchain | |
id: x86_64_cache | |
uses: actions/cache/restore@main | |
with: | |
path: build_x86_64 | |
key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_toolchain-${{ github.run_id }} | |
restore-keys: ${{ secrets.CACHE_VERSION }}-clang-x86_64_toolchain | |
- name: Loading x86_64_v3 toolchain | |
id: x86_64_v3_cache | |
uses: actions/cache/restore@main | |
with: | |
path: build_x86_64_v3 | |
key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_v3_toolchain-${{ github.run_id }} | |
restore-keys: ${{ secrets.CACHE_VERSION }}-clang-x86_64_v3_toolchain | |
- name: Loading i686 toolchain | |
id: i686_cache | |
uses: actions/cache/restore@main | |
with: | |
path: build_i686 | |
key: ${{ secrets.CACHE_VERSION }}-clang-i686_toolchain-${{ github.run_id }} | |
restore-keys: ${{ secrets.CACHE_VERSION }}-clang-i686_toolchain | |
- name: Loading aarch64 toolchain | |
id: aarch64_cache | |
if: false | |
uses: actions/cache/restore@main | |
with: | |
path: build_aarch64 | |
key: ${{ secrets.CACHE_VERSION }}-clang-aarch64_toolchain-${{ github.run_id }} | |
restore-keys: ${{ secrets.CACHE_VERSION }}-clang-aarch64_toolchain | |
- name: Loading repository cache | |
id: repository_cache | |
if: false | |
uses: actions/cache/restore@main | |
with: | |
path: src_packages | |
key: ${{ secrets.CACHE_VERSION }}-repository-${{ github.run_id }} | |
restore-keys: ${{ secrets.CACHE_VERSION }}-repository | |
- name: Running custom command | |
if: ${{ github.event.inputs.command != '' }} | |
continue-on-error: true | |
run: ${{ github.event.inputs.command }} | |
- name: Building LLVM | |
if: ${{ steps.clang_root_cache.outputs.cache-matched-key == '' }} | |
run: | | |
cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DALWAYS_REMOVE_BUILDFILES=ON -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD | |
ninja -C build_x86_64 llvm | |
ninja -C build_x86_64 rustup | |
ninja -C build_x86_64 cargo-clean | |
- name: Building x86_64 toolchain | |
if: ${{ steps.x86_64_cache.outputs.cache-matched-key == '' }} | |
run: | | |
cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DALWAYS_REMOVE_BUILDFILES=ON -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD | |
ninja -C build_x86_64 llvm-clang | |
- name: Building x86_64-v3 toolchain | |
if: ${{ steps.x86_64_v3_cache.outputs.cache-matched-key == '' }} | |
run: | | |
cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DGCC_ARCH=x86-64-v3 -DALWAYS_REMOVE_BUILDFILES=ON -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64_v3/x86_64_v3-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64_v3 -S $PWD | |
ninja -C build_x86_64_v3 llvm-clang | |
- name: Building i686 toolchain | |
if: ${{ steps.i686_cache.outputs.cache-matched-key == '' }} | |
run: | | |
cmake -DTARGET_ARCH=i686-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DALWAYS_REMOVE_BUILDFILES=ON -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_i686/i686-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_i686 -S $PWD | |
ninja -C build_i686 llvm-clang | |
- name: Building aarch64 toolchain | |
if: false | |
run: | | |
cmake -DTARGET_ARCH=aarch64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DALWAYS_REMOVE_BUILDFILES=ON -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_aarch64/aarch64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_aarch64 -S $PWD | |
ninja -C build_aarch64 llvm-clang | |
- name: Cleanup | |
run: | | |
rm -rf {build_i686,build_x86_64,build_x86_64_v3,build_aarch64}/{toolchain,packages} || true | |
- name: Collecting logs | |
if: always() | |
run: | | |
mkdir -p build_x86_64_logs build_i686_logs build_aarch64_logs | |
cp -fr $(find build_x86_64 -type f -iname "*-*.log") build_x86_64_logs || true | |
cp -fr $(find build_i686 -type f -iname "*-*.log") build_i686_logs || true | |
cp -fr $(find build_aarch64 -type f -iname "*-*.log") build_aarch64_logs || true | |
7z a -m0=lzma2 -mx=9 -ms=on logs.7z build*logs | |
- name: Uploading logs | |
uses: actions/upload-artifact@master | |
if: always() | |
with: | |
name: logs | |
path: logs.7z | |
retention-days: 1 | |
- name: Saving clang root | |
uses: actions/cache/save@main | |
with: | |
path: clang_root | |
key: ${{ secrets.CACHE_VERSION }}-clang_root-${{ github.run_id }} | |
- name: Saving x86_64 toolchain | |
uses: actions/cache/save@main | |
with: | |
path: build_x86_64 | |
key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_toolchain-${{ github.run_id }} | |
- name: Saving x86_64_v3 toolchain | |
uses: actions/cache/save@main | |
with: | |
path: build_x86_64_v3 | |
key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_v3_toolchain-${{ github.run_id }} | |
- name: Saving i686 toolchain | |
uses: actions/cache/save@main | |
with: | |
path: build_i686 | |
key: ${{ secrets.CACHE_VERSION }}-clang-i686_toolchain-${{ github.run_id }} | |
- name: Saving aarch64 toolchain | |
if: false | |
uses: actions/cache/save@main | |
with: | |
path: build_aarch64 | |
key: ${{ secrets.CACHE_VERSION }}-clang-aarch64_toolchain-${{ github.run_id }} | |
- name: Saving repository cache | |
if: false | |
uses: actions/cache/save@main | |
with: | |
path: src_packages | |
key: ${{ secrets.CACHE_VERSION }}-repository-${{ github.run_id }} | |
call_workflow: | |
name: Run mpv_clang | |
runs-on: ubuntu-latest | |
needs: build_llvm | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- name: Run mpv_clang.yml | |
run: | | |
curl -u shinchiro:$GH_TOKEN -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/workflows/mpv_clang.yml/dispatches -d @- <<EOF | |
{ | |
"ref": "master", | |
"inputs": { | |
"sourceforge": "false", | |
"github_release": "false", | |
"mpv_tarball": "false" | |
} | |
} | |
EOF |