ladybird/.github/actions/setup/action.yml
Timothy Flynn c5bb98bcf0 Meta: Revert to a stable rust compiler
Let's not depend on a nightly pre-release, especially not just for a
linting option. We can enable the linter option once it lands in the
stable release.
2026-06-02 20:12:41 +02:00

156 lines
4.9 KiB
YAML

name: 'Setup action'
description: 'Sets up shared CI tooling'
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 use'
required: true
default: 'Clang'
type:
description: 'Whether the setup is for building or linting'
required: false
default: 'build'
outputs:
ccache_path:
description: 'Path to the ccache directory'
value: ${{ steps.workspace.outputs.ccache_path }}
vcpkg_cache_path:
description: 'Path to the vcpkg binary cache'
value: ${{ steps.workspace.outputs.vcpkg_cache_path }}
runs:
using: "composite"
steps:
- name: 'Set workspace environment'
id: 'workspace'
shell: bash
run: |
echo "LADYBIRD_SOURCE_DIR=${GITHUB_WORKSPACE}" >> "$GITHUB_ENV"
echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_ENV"
echo "VCPKG_ROOT=${GITHUB_WORKSPACE}/Build/vcpkg" >> "$GITHUB_ENV"
echo "ccache_path=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_OUTPUT"
echo "vcpkg_cache_path=${GITHUB_WORKSPACE}/Build/caches/vcpkg-binary-cache" >> "$GITHUB_OUTPUT"
echo "GIT_CONFIG_GLOBAL=${RUNNER_TEMP}/gitconfig" >> "$GITHUB_ENV"
git config --file "${RUNNER_TEMP}/gitconfig" --add safe.directory "${GITHUB_WORKSPACE}"
mkdir -p "${RUNNER_TEMP}/pip-cache"
echo "PIP_CACHE_DIR=${RUNNER_TEMP}/pip-cache" >> "$GITHUB_ENV"
- uses: actions/setup-python@v6
if: ${{ inputs.os != 'Linux' }}
with:
python-version: 3.12
cache: 'pip'
# actions/setup-python can fail to find its tool-cache pip inside job containers.
- name: 'Set up Python environment'
if: ${{ inputs.os == 'Linux' }}
shell: bash
run: |
python3 -m venv "${RUNNER_TEMP}/ladybird-python"
echo "${RUNNER_TEMP}/ladybird-python/bin" >> "$GITHUB_PATH"
echo "pythonLocation=${RUNNER_TEMP}/ladybird-python" >> "$GITHUB_ENV"
- 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 pyright ruff
fi
- 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@21 \
nasm \
ninja \
pkg-config \
qt \
unzip
- name: 'Install Rust toolchain'
if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }}
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' }}
shell: bash
run: echo "VCPKG_FORCE_SYSTEM_BINARIES=1" >> "$GITHUB_ENV"
- name: 'Install vcpkg'
if: ${{ inputs.type == 'build' }}
shell: bash
run: ./Meta/Utils/build_vcpkg.py