diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea68e8716f..30ec31d64f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: complete: if: always() - needs: [static-checks, build-linux, build-mac] + needs: [static-checks, build-linux, build-mac, build-without-tests] runs-on: - namespace-profile-noble-24-04-stellar-core-x64-small steps: @@ -279,3 +279,92 @@ jobs: if: ${{ success() && steps.check-last-tested-commit.outputs.skip != 'true' }} run: | echo "${{ github.sha }}" > "build-clang-current/.last-tested-commit-sha" + + build-without-tests: + runs-on: + - namespace-profile-noble-24-04-stellar-core-x64-large;overrides.cache-tag=config-gcc-no-tests-${{ matrix.protocol }} + strategy: + fail-fast: false + matrix: + protocol: ["current", "next"] + steps: + - name: Fix kernel mmap rnd bits + # Asan in llvm provided in some ubuntu versions is incompatible with + # high-entropy ASLR in much newer kernels that GitHub runners are + # using leading to random crashes: https://reviews.llvm.org/D148280 + run: sudo sysctl vm.mmap_rnd_bits=28 + + - name: Checkout with Namespace Git mirrors cache + uses: namespacelabs/nscloud-checkout-action@v7 + with: + fetch-depth: 1 + submodules: recursive + + - name: Configure Namespace cache volume + uses: namespacelabs/nscloud-cache-action@v1 + with: + path: | + ~/.cargo + build-gcc-no-tests-${{ matrix.protocol }} + + - name: Check if commit already tested + id: check-last-tested-commit + run: | + LAST_TESTED_COMMIT_SHA_FILE="build-gcc-no-tests-${{ matrix.protocol }}/.last-tested-commit-sha" + if [ -f "$LAST_TESTED_COMMIT_SHA_FILE" ] && [ "$(cat "$LAST_TESTED_COMMIT_SHA_FILE")" = "${{ github.sha }}" ]; then + echo "Commit ${{ github.sha }} already tested successfully, skipping build" + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi + + - name: Install rustup + if: steps.check-last-tested-commit.outputs.skip != 'true' + run: ./install-rust.sh + + - name: Install rustup components + if: steps.check-last-tested-commit.outputs.skip != 'true' + run: rustup component add rustfmt + + - uses: stellar/binaries@v50 + if: steps.check-last-tested-commit.outputs.skip != 'true' + with: + name: cargo-cache + version: 0.8.3 + + - uses: stellar/binaries@v50 + if: steps.check-last-tested-commit.outputs.skip != 'true' + with: + name: cargo-sweep + version: 0.7.0 + + # Restore original modification time of files based on the date of the most + # recent commit that modified them as mtimes affect the Go test cache. + - name: Restore modification time of checkout files + if: steps.check-last-tested-commit.outputs.skip != 'true' + shell: bash + run: | + # Set a base, fixed modification time of all directories. + # git-restore-mtime doesn't set the mtime of all directories. + # (see https://github.com/MestreLion/git-tools/issues/47 for details) + touch -m -t '201509301646' $(find . -type d -not -path '.git/*') + # Restore original modification time from git. git clone sets the + # modification time to the current time, but Go tests that access fixtures + # get invalidated if their modification times change. + # + # Note: git-restore-mtime needs to be baked into the image we're + # running on. + git restore-mtime + + - name: Build + if: steps.check-last-tested-commit.outputs.skip != 'true' + run: | + export CC='gcc' + export CXX='g++' + echo Building with $CC and $CXX with --disable-tests + ./ci-build.sh --disable-tests --protocol ${{ matrix.protocol }} + + - name: Record successful test commit + if: ${{ success() && steps.check-last-tested-commit.outputs.skip != 'true' }} + run: | + echo "${{ github.sha }}" > "build-gcc-no-tests-${{ matrix.protocol }}/.last-tested-commit-sha" diff --git a/ci-build.sh b/ci-build.sh index 1d4a640909..0c95181ee8 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -13,6 +13,7 @@ export TEMP_POSTGRES=0 PROTOCOL_CONFIG="" DISABLE_POSTGRES="" +DISABLE_TESTS="" while [[ -n "$1" ]]; do COMMAND="$1" @@ -21,6 +22,7 @@ while [[ -n "$1" ]]; do case "${COMMAND}" in "--disable-tests") WITH_TESTS=0 + DISABLE_TESTS='--disable-tests' echo Disabling tests ;; "--use-temp-db") @@ -118,7 +120,7 @@ elif test $CXX = 'g++'; then g++ -v fi -config_flags="--enable-asan --enable-extrachecks --enable-ccache --enable-sdfprefs --enable-threadsafety ${PROTOCOL_CONFIG} ${DISABLE_POSTGRES}" +config_flags="--enable-asan --enable-extrachecks --enable-ccache --enable-sdfprefs --enable-threadsafety ${PROTOCOL_CONFIG} ${DISABLE_POSTGRES} ${DISABLE_TESTS}" export CFLAGS="-O2 -g1 -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fno-common" export CXXFLAGS="$CFLAGS"