Skip to content

Builds

Builds #28

Workflow file for this run

name: Builds
on:
push:
branches:
- '**'
pull_request:
schedule:
- cron: '0 0 * * *'
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 == 'bylaws/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}}
steps:
- name: Select build tag
id: get-tag
run: |
if ${{github.event_name == 'schedule'}}; then
TAG=nightly
else
TAG=$(TZ=UTC date +%Y%m%d)
fi
echo TAG=$TAG >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
cat $GITHUB_OUTPUT >> parameters.txt
- name: Check latest version
if: github.event_name == 'schedule'
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.11.6$' | awk '{print $1}') >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
cat $GITHUB_OUTPUT >> parameters.txt
- uses: actions/upload-artifact@v3
with:
name: parameters
path: |
parameters.txt
retention-days: 7
# Build a cross compiler for Linux, targeting Windows.
linux:
if: (github.event_name != 'schedule') || (github.repository == 'bylaws/llvm-mingw')
needs: [prepare]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
run: |
sudo apt-get update && sudo apt-get install ninja-build
# 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 -DLLVM_ENABLE_TERMINFO=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
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 $NAME
- uses: actions/upload-artifact@v3
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' step above.
linux-cross-aarch64:
if: (github.event_name != 'schedule') || (github.repository == 'bylaws/llvm-mingw')
needs: [linux, prepare]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
run: |
sudo apt-get update && sudo apt-get install ninja-build g++-aarch64-linux-gnu
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --no-runtimes --host=aarch64-linux-gnu
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
- uses: actions/download-artifact@v3
with:
name: linux-ucrt-x86_64-toolchain
- name: Unpack native toolchain
run: |
tar -Jxf llvm-mingw-*.tar.xz
rm llvm-mingw-*.tar.xz
mv llvm-mingw* llvm-mingw-native
- name: Assemble the cross-built toolchain
run: |
./prepare-cross-toolchain-unix.sh $(pwd)/llvm-mingw-native $(pwd)/install/llvm-mingw
- name: Package the toolchain
env:
TAG: ${{needs.prepare.outputs.TAG}}
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 $NAME
- uses: actions/upload-artifact@v3
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.repository == 'bylaws/llvm-mingw')
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
run: |
sudo apt-get update && sudo apt-get install ninja-build
# 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 -DLLVM_ENABLE_TERMINFO=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
cd install
tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw
- uses: actions/upload-artifact@v3
with:
name: linux-asserts-toolchain
path: |
llvm-mingw-linux.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.
upload-nightly:
if: (github.event_name == 'schedule') && (github.repository == 'bylaws/llvm-mingw')
permissions:
contents: write
needs: [linux, linux-cross-aarch64]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Rearrange files
run: |
rm -rf linux-asserts*
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}}