diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 9c0ebb5719..e84955d684 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -3,31 +3,60 @@ name: Builds on: workflow_call: + inputs: + targets: + type: string + description: Build targets + default: all,fdctl + machines: + type: string + description: Build architectures + default: linux_gcc_x86_64,linux_clang_x86_64 + gcc: + type: string + description: GCC compiler versions + default: gcc-8.5.0,gcc-12.4.0 + clang: + type: string + description: Clang compiler versions + default: clang-17.0.6 workflow_dispatch: - merge_group: + inputs: + targets: + type: string + description: Build targets (comma-separated) + default: all,fdctl + machines: + type: string + description: Build architectures (comma-separated) + default: linux_gcc_x86_64,linux_clang_x86_64 + gcc: + type: string + description: GCC compiler versions (comma-separated) + default: gcc-8.5.0,gcc-12.4.0 + clang: + type: string + description: Clang compiler versions (comma-separated) + default: clang-17.0.6 concurrency: group: builds_${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: build: - runs-on: X64 - env: - machines: linux_gcc_x86_64 - gcc: gcc-8.5.0 - targets: all + runs-on: 512G steps: - uses: actions/checkout@v4 with: submodules: recursive - - uses: ./.github/actions/deps - - uses: dtolnay/rust-toolchain@1.73.0 + - uses: ./.github/actions/deps + - name: Start build run: | - contrib/build.sh \ - --no-deps --no-clang \ - --targets $targets \ - --gcc-versions $gcc \ - --machines $machines + contrib/build.sh --no-deps --no-rust \ + --targets ${{ inputs.targets }} \ + --machines ${{ inputs.machines }} \ + --gcc-versions ${{ inputs.gcc || 'none --no-gcc' }} \ + --clang-versions ${{ inputs.clang || 'none --no-clang' }} diff --git a/contrib/build.sh b/contrib/build.sh index 5345735582..f1e6e62b0b 100755 --- a/contrib/build.sh +++ b/contrib/build.sh @@ -29,6 +29,9 @@ while [[ $# -gt 0 ]]; do "--no-deps") NO_DEPS=1 ;; + "--no-rust") + NO_RUST=1 + ;; "--targets") IFS=',' read -r -a TARGETS <<< "$1" shift 1 @@ -57,36 +60,42 @@ FD_REPO_DIR=$(realpath $(dirname $(realpath "$0"))/..) TEST_TARGETS=( unit-test fuzz-test integration-test ) BUILD_TARGETS=( all ) EXTRA_TARGETS=( asm ppp seccomp-policies ) + BINARY_TARGETS=( fdctl fddev ) +NONBINARY_TARGETS=( ${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]} ) declare -A CUSTOM_TARGETS=() -CUSTOM_TARGETS+=( ["linux_gcc_minimal"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["linux_gcc_noarch64"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["linux_gcc_noarch128"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["linux_gcc_minimal"]="${NONBINARY_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["linux_gcc_noarch64"]="${NONBINARY_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["linux_gcc_noarch128"]="${NONBINARY_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["macos_clang_m1"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["linux_clang_minimal"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["linux_clang_noarch64"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["linux_clang_noarch128"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) -CUSTOM_TARGETS+=( ["freebsd_clang_noarch128"]="${BUILD_TARGETS[@]} ${EXTRA_TARGETS[@]} ${TEST_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["macos_clang_m1"]="${NONBINARY_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["linux_clang_minimal"]="${NONBINARY_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["linux_clang_noarch64"]="${NONBINARY_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["linux_clang_noarch128"]="${NONBINARY_TARGETS[@]}" ) +CUSTOM_TARGETS+=( ["freebsd_clang_noarch128"]="${NONBINARY_TARGETS[@]}" ) FAIL=0 -if [[ ${#GCC[@]} -eq 0 ]]; then - if [[ $NO_GCC -ne 1 ]]; then +if [[ $NO_GCC -ne 1 ]]; then + if [[ ${#GCC[@]} -eq 0 ]]; then for gcc in $(ls /opt/gcc); do GCC+=( $gcc ) done fi +else + GCC=() fi -if [[ ${#CLANG[@]} -eq 0 ]]; then - if [[ $NO_CLANG -ne 1 ]]; then +if [[ $NO_CLANG -ne 1 ]]; then + if [[ ${#CLANG[@]} -eq 0 ]]; then for clang in $(ls /opt/clang); do CLANG+=( $clang ) done fi +else + CLANG=() fi if [[ ${#MACHINES[@]} -eq 0 ]]; then @@ -105,8 +114,7 @@ echo echo "Setting up build environment..." cd $FD_REPO_DIR -if [[ $NO_DEPS -ne 1 ]]; then - FD_AUTO_INSTALL_PACKAGES=1 ./deps.sh fetch check install > /dev/null 2>&1 +if [[ $NO_RUST -ne 1 ]]; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y > /dev/null 2>&1 fi make -j distclean > /dev/null 2>&1 @@ -117,6 +125,15 @@ if [[ $NO_GCC -ne 1 ]]; then START=$(date +%s) echo "Starting gcc builds..." for compiler in "${GCC[@]}"; do + if [[ ! -f /opt/gcc/$compiler/activate ]]; then + echo "Environment activate script not found at /opt/gcc/$compiler... exiting." + exit 2 + fi + source /opt/gcc/$compiler/activate + if [[ $NO_DEPS -ne 1 ]]; then + ./deps.sh nuke + FD_AUTO_INSTALL_PACKAGES=1 ./deps.sh +dev fetch check install > /dev/null 2>&1 + fi for machine in "${MACHINES[@]}"; do MACHINE="${machine%.mk}" if [[ "$MACHINE" != *"clang"* ]]; then @@ -130,13 +147,11 @@ if [[ $NO_GCC -ne 1 ]]; then TARGETS+=( "${BINARY_TARGETS[@]}" ) fi fi - test -f /opt/gcc/$compiler/activate || (echo "$compiler not found... exiting." && exit 2) - source /opt/gcc/$compiler/activate echo "Starting builds for $MACHINE with $compiler..." FAILED=() start=$(date +%s) for target in "${TARGETS[@]}"; do - MACHINE=${MACHINE} CC=gcc make -j $target > /dev/null 2>&1 + MACHINE=${MACHINE} CC=gcc make -j $target if [[ $? -ne 0 ]]; then FAILED+=( $target ) FAIL=1 @@ -164,6 +179,15 @@ if [[ $NO_CLANG -ne 1 ]]; then START=$(date +%s) echo "Starting clang builds..." for compiler in "${CLANG[@]}"; do + if [[ ! -f /opt/clang/$compiler/activate ]]; then + echo "Environment activate script not found at /opt/clang/$compiler... exiting." + exit 2 + fi + source /opt/clang/$compiler/activate + if [[ $NO_DEPS -ne 1 ]]; then + ./deps.sh nuke + FD_AUTO_INSTALL_PACKAGES=1 ./deps.sh +dev fetch check install > /dev/null 2>&1 + fi for machine in "${MACHINES[@]}"; do MACHINE="${machine%.mk}" if [[ "$MACHINE" != *"gcc"* ]]; then @@ -177,13 +201,11 @@ if [[ $NO_CLANG -ne 1 ]]; then TARGETS+=( "${BINARY_TARGETS[@]}" ) fi fi - test -f /opt/gcc/$compiler/activate || (echo "$compiler not found... exiting." && exit 2) - source /opt/clang/$compiler/activate echo "Starting builds for $MACHINE with $compiler..." FAILED=() start=$(date +%s) for target in "${TARGETS[@]}"; do - MACHINE=${MACHINE} CC=clang make -j $target > /dev/null 2>&1 + MACHINE=${MACHINE} CC=clang make -j $target if [[ $? -ne 0 ]]; then FAILED+=( $target ) FAIL=1