Change asset fetching location

This commit is contained in:
David Gonzalez Martin 2024-10-29 20:04:52 -06:00 committed by David
parent 24c59e03e9
commit ab57df147a
3 changed files with 87 additions and 71 deletions

View File

@ -3,29 +3,45 @@ name: CI
on:
pull_request:
push:
tags:
- "**"
branches:
- main
schedule:
- cron: "0 0 * * *"
env:
LLVM_VERSION: "19.1.2"
LINUX_IMAGE: "ubuntu-24.04"
MACOS_IMAGE: "macos-15"
WINDOWS_IMAGE: "windows-2022"
jobs:
generate-config:
runs-on: ubuntu-latest
outputs:
BIRTH_GITHUB_TARGETS: ${{ steps.generate-config.outputs.BIRTH_GITHUB_TARGETS }}
BIRTH_CMAKE_BUILD_TYPES: ${{ steps.generate-config.outputs.BIRTH_CMAKE_BUILD_TYPES }}
BIRTH_MACOS_IMAGE: ${{ steps.generate-config.outputs.BIRTH_LINUX_IMAGE }}
BIRTH_LINUX_IMAGE: ${{ steps.generate-config.outputs.BIRTH_LINUX_IMAGE }}
BIRTH_WINDOWS_IMAGE: ${{ steps.generate-config.outputs.BIRTH_WINDOWS_IMAGE }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Generate config
id: generate-config
uses: birth-software/github-config@v2
build_and_test:
runs-on: ${{ matrix.os}}
timeout-minutes: 15
needs: generate-config
permissions: write-all
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-2022]
build_type: [Debug, MinSizeRel, RelWithDebInfo, Release]
os: ${{ fromJSON(needs.generate-config.outputs.BIRTH_GITHUB_TARGETS) }}
CMAKE_BUILD_TYPE: ${{ fromJSON(needs.generate-config.outputs.BIRTH_CMAKE_BUILD_TYPES) }}
runs-on: ${{ matrix.os }}
env:
BIRTH_LINUX_IMAGE: ${{ needs.generate-config.outputs.BIRTH_LINUX_IMAGE }}
BIRTH_MACOS_IMAGE: ${{ needs.generate-config.outputs.BIRTH_MACOS_IMAGE }}
BIRTH_WINDOWS_IMAGE: ${{ needs.generate-config.outputs.BIRTH_WINDOWS_IMAGE }}
steps:
- name: Maximize build space
if: matrix.os == env.LINUX_IMAGE
if: matrix.os == env.BIRTH_LINUX_IMAGE
uses: AdityaGarg8/remove-unwanted-software@v4.1
with:
remove-android: 'true'
@ -33,44 +49,20 @@ jobs:
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
remove-large-packages: 'true'
remove-cached-tools: 'true'
- name: Checkout
uses: actions/checkout@v4
- name: System Info (Linux)
if: matrix.os == env.LINUX_IMAGE
run: |
uname -a
lsb_release -a
df -h
- name: System Info (macOS)
if: matrix.os == env.MACOS_IMAGE
run: |
uname -a
sw_vers -productVersion
df -h
- name: System Info (Windows)
if: matrix.os == env.WINDOWS_IMAGE
run: |
systeminfo
wmic logicaldisk get name, size, freespace
- name: Install dependencies (Linux)
if: matrix.os == env.LINUX_IMAGE
run: sudo apt update && sudo apt install -y llvm llvm-dev ninja-build mold curl libssl-dev libcurl4-openssl-dev
- name: Install dependencies (MacOS)
if: matrix.os == env.MACOS_IMAGE
run: brew install llvm ninja
- name: Install dependencies (Windows)
if: matrix.os == env.WINDOWS_IMAGE
run: choco install ninja && pwsh ./fetch-llvm.ps1 "${{ matrix.build_type }}"
- name: Clang version
run: clang -v
remove-swapfile: 'true'
- uses: actions/checkout@v4
- uses: birth-software/github-setup@v2
- name: Fetch LLVM
id: FETCH
run: ./fetch-llvm.sh
shell: bash
env:
CMAKE_BUILD_TYPE: ${{matrix.CMAKE_BUILD_TYPE}}
- name: Build and test
if: matrix.os == env.LINUX_IMAGE || matrix.os == env.MACOS_IMAGE
run: ./project.sh "build_type=${{ matrix.build_type }}" test all
- name: Build and test (Windows)
if: matrix.os == env.WINDOWS_IMAGE
run: pwsh ./project.ps1 "build_type=${{ matrix.build_type }}" test all
run: ./project.sh test all
shell: bash
env:
CMAKE_BUILD_TYPE: ${{matrix.CMAKE_BUILD_TYPE}}
CMAKE_PREFIX_PATH: ${{steps.FETCH.outputs.CMAKE_PREFIX_PATH}}

14
fetch-llvm.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -eux
LLVM_VERSION=19.1.0
FILENAME_BASE=llvm-$BIRTH_ARCH-$BIRTH_OS-$CMAKE_BUILD_TYPE
ZIP_NAME=$FILENAME_BASE.7z
BASE_URL=https://github.com/birth-software/llvm/releases/download/v$LLVM_VERSION/$ZIP_NAME
wget --version 1>/dev/null 2>/dev/null || choco install wget
wget $BASE_URL
wget $BASE_URL.b2sum
b2sum -c $ZIP_NAME.b2sum
7z x $ZIP_NAME
CMAKE_PREFIX_PATH=$PWD/$FILENAME_BASE
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" >> $GITHUB_OUTPUT

View File

@ -1,28 +1,38 @@
#!/usr/bin/env bash
set -ex
release_mode="Debug"
if [[ "$1" =~ ^build_type=.* ]]; then
release_mode=${1#build_type=}
fi
echo "Build type: $release_mode"
build_dir=build
mkdir -p $build_dir
case "$OSTYPE" in
linux*) CLANG_PREFIX="/usr/bin" ;;
darwin*) CLANG_PREFIX="/opt/homebrew/opt/llvm/bin" ;;
*) exit 1 ;;
esac
case "$OSTYPE" in
linux*) cmake . -B$build_dir -G Ninja -DCMAKE_BUILD_TYPE="$release_mode" -DCMAKE_C_COMPILER="$CLANG_PREFIX/clang" -DCMAKE_CXX_COMPILER="$CLANG_PREFIX/clang++" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=mold" ;;
darwin*) cmake . -B$build_dir -G Ninja -DCMAKE_BUILD_TYPE="$release_mode" -DCMAKE_C_COMPILER="$CLANG_PREFIX/clang" -DCMAKE_CXX_COMPILER="$CLANG_PREFIX/clang++" "-DCMAKE_PREFIX_PATH=$(brew --prefix zstd);$(brew --prefix llvm)" ;;
*) exit 1 ;;
esac
original_dir=$PWD
build_dir=build
C_COMPILER_PATH=clang
CXX_COMPILER_PATH=clang++
ASM_COMPILER_PATH=clang
case $BIRTH_OS in
windows)
C_COMPILER_OPT_ARG="-DCMAKE_C_COMPILER_TARGET=x86_64-pc-windows-msvc"
CXX_COMPILER_OPT_ARG="-DCMAKE_CXX_COMPILER_TARGET=x86_64-pc-windows-msvc"
ASM_COMPILER_OPT_ARG="-DCMAKE_ASM_COMPILER_TARGET=x86_64-pc-windows-msvc"
;;
*)
C_COMPILER_OPT_ARG=""
CXX_COMPILER_OPT_ARG=""
ASM_COMPILER_OPT_ARG=""
;;
esac
mkdir -p $build_dir
cmake . \
-B$build_dir \
-G Ninja \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
-DCMAKE_C_COMPILER=$C_COMPILER_PATH \
-DCMAKE_CXX_COMPILER=$CXX_COMPILER_PATH \
-DCMAKE_ASM_COMPILER=$ASM_COMPILER_PATH \
$C_COMPILER_OPT_ARG \
$CXX_COMPILER_OPT_ARG \
$ASM_COMPILER_OPT_ARG
cd $build_dir
ninja
ninja -v
cd $original_dir
if [ "$#" -ne 0 ]; then