From cec78d510f69f047b39fed665f7a4979a9931f1b Mon Sep 17 00:00:00 2001 From: David Gonzalez Martin Date: Sat, 21 Jun 2025 12:07:06 -0600 Subject: [PATCH] Install binaries --- .gitea/workflows/ci.yml | 30 ++++++++++++++- src/compiler.cpp | 84 ++++++++++++++++++++--------------------- 2 files changed, 69 insertions(+), 45 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 85df234..dbcfed2 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - BIRTH_CMAKE_BUILD_TYPE: [ Debug, RelWithDebInfo, Release, MinSizeRel ] + BIRTH_CMAKE_BUILD_TYPE: [ Debug, Release ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -31,6 +31,34 @@ jobs: CLANG_PATH: clang-19 CLANGXX_PATH: clang++-19 run: | + set -eux ./generate.sh ./build.sh ./build/bb test + mkdir -p $HOME/bloat-buster-artifacts/$(git rev-parse --abbrev-ref HEAD)/$(git rev-parse HEAD)/$CMAKE_BUILD_TYPE + mv ./self-hosted-bb-cache $HOME/bloat-buster-artifacts/$(git rev-parse --abbrev-ref HEAD)/$(git rev-parse HEAD)/$CMAKE_BUILD_TYPE/cache + release: + needs: ci + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Install + shell: bash + env: + BB_CI: 1 + run: | + set -eux + mkdir -p $HOME/bloat-buster-artifacts/releases/$(git rev-parse --abbrev-ref HEAD)/$(git rev-parse HEAD) + cp $HOME/bloat-buster-artifacts/$(git rev-parse --abbrev-ref HEAD)/$(git rev-parse HEAD)/Release/cache/debug_none_di/compiler/aggressively_optimize_for_speed_nodi/compiler $HOME/bloat-buster-artifacts/releases/$(git rev-parse --abbrev-ref HEAD)/$(git rev-parse HEAD) + - name: Release + if: ${{ (github.ref == 'refs/heads/main') }} + shell: bash + env: + BB_CI: 1 + run: | + set -eux + cp $HOME/bloat-buster-artifacts/releases/$(git rev-parse --abbrev-ref HEAD)/$(git rev-parse HEAD)/compiler $HOME/bloat-buster-artifacts/releases/main/ diff --git a/src/compiler.cpp b/src/compiler.cpp index 95094b3..876235a 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -624,53 +624,49 @@ void entry_point(Slice arguments, Slice envp) } } - for (BuildMode compiler_build_mode = BuildMode::debug_none; compiler_build_mode < BuildMode::count; compiler_build_mode = (BuildMode)((backing_type(BuildMode))compiler_build_mode + 1)) - { - for (bool compiler_has_debug_info : has_debug_info_array) - { - auto compiler = compile_file(arena, { - .relative_file_path = string_literal("src/compiler.bbb"), - .build_mode = compiler_build_mode, - .has_debug_info = compiler_has_debug_info, - .silent = true, + BuildMode compiler_build_mode = BuildMode::debug_none; + bool compiler_has_debug_info = true; + auto compiler = compile_file(arena, { + .relative_file_path = string_literal("src/compiler.bbb"), + .build_mode = compiler_build_mode, + .has_debug_info = compiler_has_debug_info, + .silent = true, }); - char* const compiler_arguments[] = - { - (char*)compiler.pointer, - (char*)"test", - 0, - }; - Slice arg_slice = array_to_slice(compiler_arguments); - arg_slice.length -= 1; - auto execution = os_execute(arena, arg_slice, environment, {}); - auto success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0; - if (!success) - { - print(string_literal("Self-hosted tests failed: ")); - print(build_mode_to_string(compiler_build_mode)); - print(compiler_has_debug_info ? string_literal(" with debug info\n") : string_literal(" with no debug info\n")); - bb_fail(); - } + char* const compiler_arguments[] = + { + (char*)compiler.pointer, + (char*)"test", + 0, + }; + Slice arg_slice = array_to_slice(compiler_arguments); + arg_slice.length -= 1; + auto execution = os_execute(arena, arg_slice, environment, {}); + auto success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0; + if (!success) + { + print(string_literal("Self-hosted tests failed: ")); + print(build_mode_to_string(compiler_build_mode)); + print(compiler_has_debug_info ? string_literal(" with debug info\n") : string_literal(" with no debug info\n")); + bb_fail(); + } - char* const reproduce_arguments[] = - { - (char*)compiler.pointer, - (char*)"reproduce", - 0, - }; - arg_slice = array_to_slice(reproduce_arguments); - arg_slice.length -= 1; - execution = os_execute(arena, arg_slice, environment, {}); - success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0; - if (!success) - { - print(string_literal("Self-hosted reproduction failed: ")); - print(build_mode_to_string(compiler_build_mode)); - print(compiler_has_debug_info ? string_literal(" with debug info\n") : string_literal(" with no debug info\n")); - bb_fail(); - } - } + char* const reproduce_arguments[] = + { + (char*)compiler.pointer, + (char*)"reproduce", + 0, + }; + arg_slice = array_to_slice(reproduce_arguments); + arg_slice.length -= 1; + execution = os_execute(arena, arg_slice, environment, {}); + success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0; + if (!success) + { + print(string_literal("Self-hosted reproduction failed: ")); + print(build_mode_to_string(compiler_build_mode)); + print(compiler_has_debug_info ? string_literal(" with debug info\n") : string_literal(" with no debug info\n")); + bb_fail(); } } break; case Command::count: