mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
The idea is that scripts directly under Meta are meant to be run by people. Scripts that are only imported or run by other scripts are moved to a subdirectory.
234 lines
7.4 KiB
YAML
234 lines
7.4 KiB
YAML
name: 'Setup action'
|
|
description: 'Sets up the dependencies for the CI VM'
|
|
author: 'Andrew Kaster <akaster@serenityos.org>'
|
|
inputs:
|
|
os:
|
|
description: 'Operating System to set up'
|
|
required: true
|
|
default: 'Linux'
|
|
arch:
|
|
description: 'Target Architecture to set up'
|
|
required: true
|
|
default: 'x86_64'
|
|
toolchain:
|
|
description: 'Toolchain to set up'
|
|
required: true
|
|
default: 'Clang'
|
|
gcc_version:
|
|
description: 'GCC version to install'
|
|
required: false
|
|
default: '14'
|
|
llvm_version:
|
|
description: 'LLVM version to install'
|
|
required: false
|
|
default: '21'
|
|
type:
|
|
description: 'Whether the setup is for building or linting'
|
|
required: false
|
|
default: 'build'
|
|
|
|
outputs:
|
|
gcc_version:
|
|
description: 'The installed GCC version'
|
|
value: ${{ steps.export-versions.outputs.gcc_version }}
|
|
llvm_version:
|
|
description: 'The installed LLVM version'
|
|
value: ${{ steps.export-versions.outputs.llvm_version }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.12
|
|
cache: 'pip'
|
|
|
|
- name: 'Install Python dependencies'
|
|
shell: bash
|
|
run: |
|
|
python3 -m pip install --upgrade pip
|
|
|
|
if ${{ inputs.type == 'build' }} ; then
|
|
pip3 install pyyaml requests six
|
|
else
|
|
pip3 install ruff
|
|
fi
|
|
|
|
- name: Install apt repositories
|
|
if: ${{ inputs.os == 'Linux' }}
|
|
shell: bash
|
|
run: |
|
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
|
|
|
UBUNTU_RELEASE=$(lsb_release -cs)
|
|
|
|
LLVM_LIST="/etc/apt/sources.list.d/llvm.list"
|
|
LLVM_TOOLCHAIN="llvm-toolchain-${UBUNTU_RELEASE}-${{ inputs.llvm_version }}"
|
|
|
|
if [ ! -f "${LLVM_LIST}" ] || ! grep -q "${LLVM_TOOLCHAIN}" "${LLVM_LIST}" ; then
|
|
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg
|
|
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/${UBUNTU_RELEASE}/ ${LLVM_TOOLCHAIN} main" | sudo tee "${LLVM_LIST}"
|
|
fi
|
|
|
|
sudo apt-get update -y
|
|
|
|
- name: Install Dependencies
|
|
if: ${{ inputs.os == 'Linux' && inputs.type == 'build' }}
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get install -y \
|
|
autoconf \
|
|
autoconf-archive \
|
|
automake \
|
|
build-essential \
|
|
ccache \
|
|
cmake \
|
|
curl \
|
|
fonts-liberation2 \
|
|
g++-${{ inputs.gcc_version }} \
|
|
gcc-${{ inputs.gcc_version }} \
|
|
libcurl4-openssl-dev \
|
|
libdrm-dev \
|
|
libegl1-mesa-dev \
|
|
libgl1-mesa-dev \
|
|
libpulse-dev \
|
|
libssl-dev \
|
|
libstdc++-${{ inputs.gcc_version }}-dev \
|
|
libtool \
|
|
lld-${{ inputs.llvm_version }} \
|
|
llvm-${{ inputs.llvm_version }} \
|
|
nasm \
|
|
ninja-build \
|
|
pulseaudio \
|
|
qt6-base-dev \
|
|
qt6-tools-dev-tools \
|
|
tar \
|
|
unzip \
|
|
zip
|
|
|
|
if ${{ inputs.toolchain == 'Clang' }} ; then
|
|
sudo apt-get install -y \
|
|
clang-${{ inputs.llvm_version }} \
|
|
clang++-${{ inputs.llvm_version }} \
|
|
clang-tools-${{ inputs.llvm_version }}
|
|
|
|
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ inputs.llvm_version }} 100
|
|
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ inputs.llvm_version }} 100
|
|
fi
|
|
|
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc_version }} 100
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc_version }} 100
|
|
|
|
sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${{ inputs.llvm_version }} 100
|
|
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${{ inputs.llvm_version }} 100
|
|
sudo update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-${{ inputs.llvm_version }} 100
|
|
|
|
- name: Install Dependencies
|
|
if: ${{ inputs.os == 'Linux' && inputs.type == 'lint' }}
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get install -y \
|
|
clang-format-${{ inputs.llvm_version }} \
|
|
generate-ninja \
|
|
optipng \
|
|
shellcheck
|
|
|
|
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${{ inputs.llvm_version }} 100
|
|
|
|
sudo npm install -g prettier@3.8.1
|
|
|
|
- name: Ensure clang-cl is available
|
|
if: ${{ inputs.os == 'Windows' && inputs.toolchain == 'ClangCL' }}
|
|
shell: bash
|
|
run: |
|
|
if ! where clang-cl > /dev/null 2>&1 ; then
|
|
# Keep the LLVM version in sync with GitHub's Windows runner image:
|
|
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md
|
|
choco install -y llvm --no-progress --version=20.1.8
|
|
|
|
echo "C:/Program Files/LLVM/bin" >> "${GITHUB_PATH}"
|
|
export PATH="/c/Program Files/LLVM/bin:${PATH}"
|
|
fi
|
|
clang-cl --version
|
|
|
|
- name: 'Select latest Xcode'
|
|
if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }}
|
|
uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: 26.2
|
|
|
|
- name: 'Install Dependencies'
|
|
if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }}
|
|
shell: bash
|
|
run: |
|
|
brew update
|
|
|
|
brew install \
|
|
autoconf \
|
|
autoconf-archive \
|
|
automake \
|
|
bash \
|
|
ccache \
|
|
coreutils \
|
|
libtool \
|
|
llvm@${{ inputs.llvm_version }} \
|
|
nasm \
|
|
ninja \
|
|
pkg-config \
|
|
qt \
|
|
unzip
|
|
|
|
- name: 'Install Rust toolchain'
|
|
if: ${{ inputs.os != 'Windows' }}
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: 'Install wasm-tools'
|
|
if: ${{ inputs.type == 'build' }}
|
|
shell: bash
|
|
run: |
|
|
VERSION=1.243.0
|
|
if ${{ inputs.arch == 'arm64' }} ; then
|
|
ARCH=aarch64
|
|
else
|
|
ARCH=${{ inputs.arch }}
|
|
fi
|
|
LOWERCASE_OS=$( echo -n '${{ inputs.os }}' | tr '[:upper:]' '[:lower:]')
|
|
if ${{ inputs.os == 'Windows' }} ; then
|
|
EXTENSION=zip
|
|
else
|
|
EXTENSION=tar.gz
|
|
fi
|
|
NAME="wasm-tools-${VERSION}-${ARCH}-${LOWERCASE_OS}"
|
|
FILENAME="${NAME}.${EXTENSION}"
|
|
|
|
curl --fail --location --write-out '%{url}' --output "${FILENAME}" \
|
|
"https://github.com/bytecodealliance/wasm-tools/releases/download/v${VERSION}/${FILENAME}"
|
|
|
|
if [ "${EXTENSION}" == 'zip' ]; then
|
|
unzip "${FILENAME}"
|
|
else
|
|
tar -xzf "${FILENAME}"
|
|
fi
|
|
rm "${FILENAME}"
|
|
|
|
echo "${{ github.workspace }}/${NAME}" >> $GITHUB_PATH
|
|
|
|
- name: 'Set required environment variables'
|
|
if: ${{ inputs.os == 'Linux' && inputs.arch == 'arm64' }}
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
core.exportVariable('VCPKG_FORCE_SYSTEM_BINARIES', '1')
|
|
|
|
- name: 'Install vcpkg'
|
|
if: ${{ inputs.type == 'build' }}
|
|
shell: bash
|
|
run: ./Meta/Utils/build_vcpkg.py
|
|
|
|
- name: 'Export installed versions'
|
|
id: 'export-versions'
|
|
shell: bash
|
|
run: |
|
|
echo "gcc_version=${{ inputs.gcc_version }}" >> "$GITHUB_OUTPUT"
|
|
echo "llvm_version=${{ inputs.llvm_version }}" >> "$GITHUB_OUTPUT"
|