Files
llvm-mingw/.github/workflows/build.yml
T
Martin Storsjö e08a31fbfe github: Update to building and testing ffmpeg 9.0.2 instead of 6.1.2
This also avoids the problem with building on Ubuntu 26.04 if
building docs isn't disabled. (We're not interested in building
the docs here anyway, so keep it disabled in any case.)
2026-10-20 18:23:13 +03:00

811 lines
32 KiB
YAML

name: Builds
on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
# For scheduled builds, get the commit ids of the latest versions to build.
#
# Doing this as one single job, which then propagates the information further
# to the other jobs, so that all build jobs in one workflow builds the exact
# same version. This allows trusting builds without assertions enabled
# slightly more, when we know a separate build of the same version but with
# assertions enabled, has passed some amount of tests.
prepare:
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
runs-on: ubuntu-latest
outputs:
LLVM_VERSION: ${{steps.get-versions.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{steps.get-versions.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{steps.get-versions.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{steps.get-tag.outputs.TAG}}
COMMIT_DATE_UNIX: ${{steps.get-tag.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{steps.get-tag.outputs.BUILD_DATE}}
BUILD_DATE_UNIX: ${{steps.get-tag.outputs.BUILD_DATE_UNIX}}
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: .
- name: Select build tag
id: get-tag
run: |
if ${{github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}}; then
TAG=nightly
else
TAG=$(TZ=UTC date +%Y%m%d)
fi
echo TAG=$TAG >> $GITHUB_OUTPUT
echo COMMIT_DATE_UNIX=$(git log -1 --pretty=%ct $GITHUB_SHA) >> $GITHUB_OUTPUT
BUILD_DATE=$(date -u '+%FT%TZ')
echo BUILD_DATE=${BUILD_DATE} >> $GITHUB_OUTPUT
echo BUILD_DATE_UNIX=$(date -d "${BUILD_DATE}" +%s) >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
cat $GITHUB_OUTPUT >> parameters.txt
- name: Check latest version
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
id: get-versions
run: |
echo LLVM_VERSION=$(git ls-remote https://github.com/llvm/llvm-project.git | grep 'refs/heads/main$' | awk '{print $1}') >> $GITHUB_OUTPUT
echo MINGW_W64_VERSION=$(git ls-remote https://github.com/mingw-w64/mingw-w64.git | grep 'refs/heads/master$' | awk '{print $1}') >> $GITHUB_OUTPUT
echo PYTHON_VERSION_MINGW=$(git ls-remote https://github.com/msys2-contrib/cpython-mingw.git | grep 'refs/heads/mingw-v3.14.5$' | awk '{print $1}') >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
cat $GITHUB_OUTPUT >> parameters.txt
- uses: actions/upload-artifact@v6
with:
name: parameters
path: |
parameters.txt
retention-days: 7
linux-stage1:
needs: [prepare]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Skip dynamic library dependencies that might make it harder to
# run the binaries on other distros (and that have little use within
# llvm-mingw).
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --stage1
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
./run-tests.sh $(pwd)/install/llvm-mingw
cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-stage1-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v6
with:
name: linux-stage1-ucrt-x86_64-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
linux-profile:
needs: [prepare, linux-stage1]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: linux-stage1-ucrt-x86_64-toolchain
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
mv llvm-mingw* llvm-mingw-stage1
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Build LLVM in mostly the same way as it is going to be built in the
# final form.
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh --profile $(pwd)/llvm-mingw-stage1
- uses: actions/upload-artifact@v6
with:
name: profile
path: |
profile.profdata
retention-days: 7
# Build a cross compiler for Linux, targeting Windows.
linux:
needs: [prepare, linux-stage1, linux-profile]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: linux-stage1-ucrt-x86_64-toolchain
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
sudo mv llvm-mingw* /opt/llvm-mingw
- uses: actions/download-artifact@v8
with:
name: profile
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Skip dynamic library dependencies that might make it harder to
# run the binaries on other distros (and that have little use within
# llvm-mingw).
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw --thinlto --pgo --llvm-only
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
./run-tests.sh $(pwd)/install/llvm-mingw
cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v6
with:
name: linux-ucrt-x86_64-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
# Crosscompile the toolchain for running on Linux on a different architecture, bundle the runtime
# libraries that were built in the 'linux-stage1' step above.
linux-cross-aarch64:
needs: [linux-stage1, linux-profile, prepare]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: linux-stage1-ucrt-x86_64-toolchain
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
sudo mv llvm-mingw* /opt/llvm-mingw
- uses: actions/download-artifact@v8
with:
name: profile
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
run: |
sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu
./build-all.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw --no-runtimes --host=aarch64-linux-gnu --thinlto --pgo
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
- name: Assemble the cross-built toolchain
run: |
./prepare-cross-toolchain-unix.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw
- name: Test using the cross-built assembled toolchain
run: |
sudo apt-get update && sudo apt-get install qemu-user-static libc6-arm64-cross libstdc++6-arm64-cross
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu ./test-libcxx-module.sh $(pwd)/install/llvm-mingw
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu ./run-tests.sh $(pwd)/install/llvm-mingw
- name: Package the toolchain
env:
TAG: ${{needs.prepare.outputs.TAG}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-aarch64
NAME=llvm-mingw-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v6
with:
name: linux-ucrt-aarch64-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
# Build a cross compiler for Linux, targeting Windows, with assertions enabled.
#
# The scheduled builds are made with the latest git version of llvm-project
# and mingw-w64. When using random git snapshot builds of llvm, there's
# always a risk for bugs - thus build such versions with assertions enabled,
# to better catch such bugs early. This makes the first-stage toolchain built
# here in scheduled builds somewhat slower.
linux-asserts:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Skip dynamic library dependencies that might make it harder to
# run the binaries on other distros (and that have little use within
# llvm-mingw).
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb --enable-asserts
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./run-tests.sh $(pwd)/install/llvm-mingw
cd install
tar -Jcf ../llvm-mingw-linux.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" llvm-mingw
- uses: actions/upload-artifact@v6
with:
name: linux-asserts-x86_64-toolchain
path: |
llvm-mingw-linux.tar.xz
retention-days: 7
macos-stage1:
needs: [prepare]
runs-on: macos-14
steps:
- uses: actions/checkout@v6
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Disable zstd and python. Both are available on the runners, but
# installed with homebrew, and only available in the native (arm64)
# form.
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm --stage1 --llvm-only
.github/workflows/store-version.sh install/llvm/versions.txt
cd install
NAME=llvm-$TAG-macos-$(uname -m)
mv llvm $NAME
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v6
with:
name: macos-llvm
path: |
llvm-*.tar.xz
retention-days: 7
# Build a cross compiler for macOS, targeting Windows.
macos:
needs: [prepare, macos-stage1, linux-profile]
runs-on: macos-14
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: macos-llvm
- name: Unpack stage1 Clang
run: |
tar -Jxf llvm-*.tar.xz
rm llvm-*.tar.xz
mv llvm* $HOME/llvm
- uses: actions/download-artifact@v8
with:
name: profile
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
# Disable zstd and python. Both are available on the runners, but
# installed with homebrew, and only available in the native (arm64)
# form. Therefore, autodetection will pick them up, but linking
# universal binaries fails as those libraries are unavailable in the
# other (x86_64) architecture form.
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $HOME/llvm $(pwd)/install/llvm-mingw --thinlto --pgo
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
./run-tests.sh $(pwd)/install/llvm-mingw
cd install
NAME=llvm-mingw-$TAG-ucrt-macos-universal
mv llvm-mingw $NAME
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v6
with:
name: macos-ucrt-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
# Test building the toolchain on msys2. The binaries built here rely on the
# runtime libraries from the host environment (libstdc++ or libc++).
msys2:
needs: [prepare]
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
sys:
- clang64
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
install: >-
git
make
diffutils
tar
pacboy: >-
toolchain:p
cmake:p
ninja:p
- uses: actions/checkout@v6
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
if [ "${{matrix.sys}}" = "mingw64" ]; then
ARGS="--disable-dylib"
fi
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb $ARGS
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./copy-msys-dependencies.sh $(pwd)/install/llvm-mingw ${{matrix.sys}}
./test-libcxx-module.sh $(pwd)/install/llvm-mingw
./run-tests.sh $(pwd)/install/llvm-mingw
cd install
NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}}
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v6
with:
name: msys2-${{matrix.sys}}-toolchain
path: |
llvm-mingw-*.tar.xz
retention-days: 7
# Use the Linux cross compilers built in the first step to cross compile
# llvm and make a proper standalone toolchain for Windows (for all 4
# architectures). The binaries built here match actual releases quite closely.
linux-cross-windows:
needs: [linux-stage1, linux-profile, prepare]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { arch: i686, crt: ucrt }
- { arch: x86_64, crt: ucrt }
- { arch: armv7, crt: ucrt }
- { arch: aarch64, crt: ucrt }
steps:
- uses: actions/download-artifact@v8
with:
name: linux-stage1-${{matrix.crt}}-x86_64-toolchain
- name: Unpack cross toolchain
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
sudo mv llvm-mingw* /opt/llvm-mingw
echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: profile
- name: Cache downloads
id: cache-tarballs
uses: actions/cache@v5
with:
path: /opt/cache
key: tarballs-${{ hashFiles('build-make.sh') }}
- name: Restore cache
if: steps.cache-tarballs.outputs.cache-hit != ''
run: |
ln -s /opt/cache/*.tar.* .
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{needs.prepare.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
sudo apt-get update && sudo apt-get install libltdl-dev swig autoconf-archive
./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python --with-busybox --thinlto --pgo
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install
NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
mv llvm-mingw $NAME
zip -9rq ../$NAME.zip $NAME
- name: Save cache
if: steps.cache-tarballs.outputs.cache-hit != 'true'
run: |
mkdir -p /opt/cache
for i in make-*.tar.*; do
if [ ! -L $i ]; then cp -a $i /opt/cache; fi
done
- uses: actions/upload-artifact@v6
with:
name: windows-${{matrix.crt}}-${{matrix.arch}}-toolchain
path: |
llvm-mingw-*.zip
retention-days: 7
# Run llvm-mingw's tests with the cross-built toolchains from above.
test-toolchain:
needs: [linux-cross-windows]
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- i686
- aarch64
runs-on: ${{startsWith(matrix.arch, 'a') && 'windows-11-arm' || 'windows-latest'}}
steps:
- uses: actions/download-artifact@v8
with:
name: windows-ucrt-${{matrix.arch}}-toolchain
- name: Unpack toolchain
run: |
7z x llvm-mingw-*.zip
del llvm-mingw-*.zip
mv llvm-mingw-* c:\llvm-mingw
echo "c:\llvm-mingw\busybox\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v6
- name: Run tests
shell: sh
run: |
./test-libcxx-module.sh c:/llvm-mingw
./run-tests.sh c:/llvm-mingw
./run-lldb-tests.sh c:/llvm-mingw
# Run libcxx's tests with the cross-built toolchains from above.
# (This builds its own copy of libcxx, but it should be pretty much
# identical to the one shipped - and tests that the toolchain works
# for running the libcxx tests.)
# This also forces testing the bundled python executables.
test-libcxx:
# This test is kinda slow, and kinda redundant (libcxx does contain
# llvm-mingw configurations in its own CI, so the only difference with
# testing here is different runners with different OS setups, and
# testing with the latest compiler instead of an older release).
# Therefore, keep the test disabled by default; it's easy to enable
# temporarily on a branch for testing.
if: false
needs: [linux-cross-windows, prepare]
strategy:
fail-fast: false
matrix:
include:
- { arch: x86_64, target_arch: i686 }
- { arch: x86_64, target_arch: x86_64 }
- { arch: aarch64, target_arch: aarch64 }
runs-on: ${{startsWith(matrix.arch, 'a') && 'windows-11-arm' || 'windows-latest'}}
steps:
- uses: actions/download-artifact@v8
with:
name: windows-ucrt-${{matrix.arch}}-toolchain
- name: Unpack toolchain
run: |
7z x llvm-mingw-*.zip
del llvm-mingw-*.zip
mv llvm-mingw-* c:\llvm-mingw
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v6
- name: Checkout llvm-project
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
run: |
bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh"
- name: Build and test libcxx
run: |
cd llvm-project
mkdir build
cd build
cmake ../runtimes `
-G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DPython3_EXECUTABLE="$Env:PYTHON_EXE" `
-DLIBCXX_ENABLE_WERROR=YES `
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" `
-DLIBCXX_CXX_ABI=libcxxabi `
-DCMAKE_C_COMPILER=${{matrix.target_arch}}-w64-mingw32-clang `
-DCMAKE_CXX_COMPILER=${{matrix.target_arch}}-w64-mingw32-clang++ `
-DCMAKE_CXX_COMPILER_TARGET=${{matrix.target_arch}}-w64-windows-gnu `
-DLIBCXXABI_ENABLE_SHARED=NO `
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES `
-DLIBCXX_USE_COMPILER_RT=YES `
-DLIBCXXABI_USE_COMPILER_RT=YES `
-DLIBUNWIND_USE_COMPILER_RT=YES `
-DLIBCXXABI_USE_LLVM_UNWINDER=YES `
-DLIBCXX_EXTRA_SITE_DEFINES="__USE_MINGW_ANSI_STDIO=${{startsWith(matrix.arch, 'a') && '0' || '1'}}" `
-DCMAKE_INSTALL_MESSAGE=NEVER `
-DLLVM_LIT_ARGS="-v --time-tests"
ninja
ninja check-runtimes
# Run the OpenMP tests with the cross-built toolchains from above.
# This also forces testing the bundled python executables.
test-openmp:
# Only running these tests in scheduled builds.
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [linux-cross-windows, prepare]
strategy:
fail-fast: false
matrix:
include:
- { arch: i686, asmflag: }
- { arch: x86_64, asmflag: -m64 }
- { arch: aarch64 }
- { arch: arm64ec }
runs-on: ${{startsWith(matrix.arch, 'a') && 'windows-11-arm' || 'windows-latest'}}
steps:
- uses: actions/download-artifact@v8
with:
name: windows-ucrt-${{matrix.arch == 'arm64ec' && 'aarch64' || matrix.arch}}-toolchain
- name: Unpack toolchain
run: |
7z x llvm-mingw-*.zip
del llvm-mingw-*.zip
mv llvm-mingw-* c:\llvm-mingw
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v6
- name: Checkout llvm-project
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
run: |
bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh"
- name: Build test executables
run: |
cd llvm-project
mkdir build-tools
cd build-tools
cmake ../llvm `
-G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_TARGETS_TO_BUILD=X86 `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang++
ninja not FileCheck
echo "TOOLS=$PWD" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Build and test OpenMP
run: |
cd llvm-project
mkdir build-openmp
cd build-openmp
cmake ../runtimes `
-G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DPython3_EXECUTABLE="$Env:PYTHON_EXE" `
-DLLVM_BINARY_DIR="$Env:TOOLS" `
-DCMAKE_C_COMPILER=${{matrix.arch}}-w64-mingw32-clang `
-DCMAKE_CXX_COMPILER=${{matrix.arch}}-w64-mingw32-clang++ `
-DCMAKE_ASM_MASM_COMPILER=llvm-ml `
-DLLVM_ENABLE_RUNTIMES="openmp" `
-DLIBOMP_ASMFLAGS=${{matrix.asmflag}} `
-DLLVM_LIT_ARGS="-v --time-tests"
ninja
ninja check-openmp
# Run the compiler-rt tests with the cross-built toolchains from above. This
# also forces testing the bundled python executables.
test-compiler-rt:
# Only running these tests in scheduled builds.
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [linux-cross-windows, prepare]
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- i686
- aarch64
runs-on: ${{startsWith(matrix.arch, 'a') && 'windows-11-arm' || 'windows-latest'}}
steps:
- uses: actions/download-artifact@v8
with:
name: windows-ucrt-${{matrix.arch}}-toolchain
- name: Unpack toolchain
run: |
7z x llvm-mingw-*.zip
del llvm-mingw-*.zip
mv llvm-mingw-* c:\llvm-mingw
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v6
- name: Checkout llvm-project
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
run: |
git config --global core.autocrlf false
bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh"
- name: Build test executables
run: |
cd llvm-project
mkdir build-tools
cd build-tools
cmake ../llvm `
-G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_TARGETS_TO_BUILD=X86 `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang++
ninja not FileCheck llvm-config KillTheDoctor count split-file
echo "LLVM_CONFIG=$PWD\bin\llvm-config.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
echo "CMAKE_DIR=$PWD\lib\cmake\llvm" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Build and test compiler-rt
# Skipping libfuzzer; all tests fail since the clang mingw driver
# doesn't support -fsanitize=fuzzer.
# Skipping ORC; the tests rely on llvm-jitlink being available,
# which requires building a large part of LLVM among the test
# tools above, and jitlink requires an MSVC toolchain to be available.
run: |
cd llvm-project
mkdir build-compiler-rt
cd build-compiler-rt
cmake ../compiler-rt `
-G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DPython3_EXECUTABLE="$Env:PYTHON_EXE" `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang++ `
-DCMAKE_C_COMPILER_TARGET=${{matrix.arch}}-w64-windows-gnu `
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=TRUE `
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=TRUE `
-DLLVM_CONFIG_PATH="$Env:LLVM_CONFIG" `
-DLLVM_CMAKE_DIR="$Env:CMAKE_DIR" `
-DSANITIZER_CXX_ABI=libc++ `
-DCOMPILER_RT_INCLUDE_TESTS=ON `
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF `
-DCOMPILER_RT_BUILD_ORC=OFF `
-DLLVM_LIT_ARGS="-v --time-tests"
ninja
ninja check-compiler-rt
# Test cross-building ffmpeg for all 4 targeted architectures from linux.
# This is done only on scheduled builds, with a toolchain with assertions
# enabled, to catch code generation bugs that might trigger asserts, to
# find such regressions early.
linux-test-cross-build-ffmpeg:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [linux-asserts]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch:
- i686
- x86_64
- armv7
- aarch64
steps:
- uses: actions/download-artifact@v8
with:
name: linux-asserts-x86_64-toolchain
- name: Unpack cross toolchain
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
sudo mv llvm-mingw* /opt/llvm-mingw
echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- name: Checkout ffmpeg
uses: actions/checkout@v6
with:
repository: ffmpeg/ffmpeg
ref: n9.0.2
path: ffmpeg
- name: Build ffmpeg
run: |
sudo apt-get update && sudo apt-get install nasm
mkdir ffmpeg-build
cd ffmpeg-build
# Set a limit of 3 minutes per process/object file; with unproven
# versions from latest git, the compiler may occasionally hang.
# Make sure we exit in a reasonable time instead of waiting for
# the whole github actions timeout of 6h before exiting.
ulimit -t 180
../ffmpeg/configure --arch=${{matrix.arch}} --target-os=mingw32 --cross-prefix=${{matrix.arch}}-w64-mingw32- --enable-gpl --disable-doc
make -j$(nproc)
# Test building ffmpeg for natively on x86_64 Windows and run its tests,
# to find cases of compiler bugs don't show up as failed asserts in the
# compiler itself, but that only show up at runtime. This is only done
# for scheduled builds.
test-ffmpeg:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: [linux-cross-windows]
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Avoid git checking out files with CRLF
shell: cmd
run: |
git config --global core.autocrlf false
- uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
install: >-
unzip
make
rsync
diffutils
pacboy: >-
nasm:p
- uses: actions/download-artifact@v8
with:
name: windows-ucrt-x86_64-toolchain
- name: Unpack toolchain
run: |
unzip -q llvm-mingw-*.zip
rm llvm-mingw-*.zip
mv llvm-mingw-* /llvm-mingw
echo /llvm-mingw/bin >> $GITHUB_PATH
- name: Checkout ffmpeg
uses: actions/checkout@v6
with:
repository: ffmpeg/ffmpeg
ref: n9.0.2
path: ffmpeg
- name: Build & test ffmpeg
run: |
export PATH=/llvm-mingw/bin:$PATH
mkdir ffmpeg-build
cd ffmpeg-build
../ffmpeg/configure --samples=../fate-samples --enable-gpl --disable-doc
make -j$(nproc)
make fate-rsync || make fate-rsync
make -j$(nproc) fate
upload-nightly:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
needs: [linux, linux-cross-aarch64, macos, linux-cross-windows, test-toolchain, linux-test-cross-build-ffmpeg, test-ffmpeg]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
- name: Rearrange files
run: |
rm -rf linux-asserts*
rm -rf msys2*
rm -rf linux-stage1-*
rm -rf macos-llvm*
rm -rf profile*
mv *-toolchain/*.zip *-toolchain/*.tar.xz .
- name: Upload binaries
env:
GITHUB_TOKEN: ${{github.token}}
run: |
gh release upload nightly *.tar.xz *.zip --clobber -R ${{github.repository}}