Skip to content

Commit 1d5d749

Browse files
committed
revert ci-build.sh and build.yml to b1bd05e
1 parent 0fa8371 commit 1d5d749

File tree

2 files changed

+141
-181
lines changed

2 files changed

+141
-181
lines changed

.github/workflows/build.yml

Lines changed: 98 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,22 @@ jobs:
1818

1919
complete:
2020
if: always()
21-
needs: [fmt, cargo-deny, rust-check-git-rev-deps, build-linux, build-mac]
22-
runs-on:
23-
- namespace-profile-jammy-1-stellar-core
24-
- nscloud-cache-exp-do-not-commit
21+
needs: [fmt, cargo-deny, rust-check-git-rev-deps, build]
22+
runs-on: ubuntu-22.04
2523
steps:
2624
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
2725
run: exit 1
2826

2927
fmt:
30-
runs-on:
31-
- namespace-profile-jammy-1-stellar-core
32-
- nscloud-cache-exp-do-not-commit
28+
runs-on: ubuntu-22.04
3329
steps:
34-
- uses: namespacelabs/nscloud-checkout-action@v7
35-
with:
36-
fetch-depth: 1
37-
submodules: recursive
38-
- run: rustup component add rustfmt
39-
- run: rustup update
40-
- run: cargo fmt --all --check
30+
- uses: actions/checkout@v4
31+
- run: rustup component add rustfmt
32+
- run: rustup update
33+
- run: cargo fmt --all --check
4134

4235
cargo-deny:
43-
runs-on:
44-
- namespace-profile-jammy-1-stellar-core
45-
- nscloud-cache-exp-do-not-commit
36+
runs-on: ubuntu-22.04
4637
strategy:
4738
matrix:
4839
checks:
@@ -51,31 +42,27 @@ jobs:
5142
# Prevent sudden announcement of a new advisory from failing ci:
5243
continue-on-error: ${{ matrix.checks == 'advisories' }}
5344
steps:
54-
- uses: namespacelabs/nscloud-checkout-action@v7
55-
with:
56-
fetch-depth: 1
57-
submodules: recursive
58-
- uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
59-
with:
60-
command: check ${{ matrix.checks }}
61-
# leave arguments empty so we don't test --all-features
62-
# which will see conflicting env versions
63-
arguments:
45+
- uses: actions/checkout@v4
46+
- uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
47+
with:
48+
command: check ${{ matrix.checks }}
49+
# leave arguments empty so we don't test --all-features
50+
# which will see conflicting env versions
51+
arguments:
6452

6553
rust-check-git-rev-deps:
66-
runs-on:
67-
- namespace-profile-jammy-1-stellar-core
68-
- nscloud-cache-exp-do-not-commit
54+
runs-on: ubuntu-22.04
6955
steps:
70-
- uses: namespacelabs/nscloud-checkout-action@v7
71-
with:
72-
fetch-depth: 1
73-
submodules: recursive
74-
- uses: stellar/actions/rust-check-git-rev-deps@main
75-
76-
build-linux:
77-
runs-on:
78-
- namespace-profile-jammy-32-stellar-core;overrides.cache-tag=config-${{ matrix.toolchain }}-${{ matrix.protocol }}
56+
- uses: actions/checkout@v4
57+
- uses: stellar/actions/rust-check-git-rev-deps@main
58+
59+
build:
60+
runs-on: ubuntu-jammy-16-cores-amd64
61+
env:
62+
CACHED_PATHS: |
63+
~/.ccache
64+
~/.cargo
65+
target
7966
strategy:
8067
fail-fast: false
8168
matrix:
@@ -88,32 +75,66 @@ jobs:
8875
# using leading to random crashes: https://reviews.llvm.org/D148280
8976
run: sudo sysctl vm.mmap_rnd_bits=28
9077

91-
- name: Checkout with Namespace Git mirrors cache
92-
uses: namespacelabs/nscloud-checkout-action@v7
78+
# We start with as cheap as possible a cache probe to see if we have an exact hit on this
79+
# git commit ID (for a given OS/toolchain/protocol). If so we can skip all subsequent
80+
# steps: we already tested this exact SHA.
81+
#
82+
# Unfortunately due to the way github actions control flow works, we have to repeat the
83+
# step 'if' condition in each step, and cannot actually "exit early" and skip the job.
84+
# There are a lot of duplicate bug reports filed on this aspect of github actions, don't
85+
# bother filing another.
86+
- name: Probe Cache
87+
id: cache
88+
uses: actions/cache/restore@v4
9389
with:
94-
fetch-depth: 1
95-
submodules: recursive
96-
97-
- name: Configure Namespace cache volume
98-
uses: namespacelabs/nscloud-cache-action@v1
90+
path: ${{ env.CACHED_PATHS }}
91+
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.protocol }}-${{ github.sha }}
92+
lookup-only: true
93+
94+
# When we have a cache miss on the exact commit SHA, we restore from the prefix without it.
95+
# This will restore the most-recently-written cache (github does this date ordering itself).
96+
- name: Restore Cache
97+
if: steps.cache.outputs.cache-hit != 'true'
98+
uses: actions/cache/restore@v4
9999
with:
100-
path: |
101-
~/.cargo
102-
build-${{matrix.toolchain}}-${{matrix.protocol}}
103-
104-
- name: install rustup
105-
run: ./install-rust.sh
100+
path: ${{ env.CACHED_PATHS }}
101+
key: ${{ steps.cache.outputs.cache-primary-key }}
102+
restore-keys: |
103+
${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.protocol }}
106104
105+
- uses: actions/checkout@v4
106+
if: steps.cache.outputs.cache-hit != 'true'
107+
with:
108+
fetch-depth: 200
109+
submodules: true
110+
- name: install core packages
111+
if: steps.cache.outputs.cache-hit != 'true'
112+
run: |
113+
sudo apt-get update
114+
sudo apt-get -y install --no-install-recommends apt-utils dialog git iproute2 procps lsb-release
115+
- name: install tool chain
116+
if: steps.cache.outputs.cache-hit != 'true'
117+
run: |
118+
sudo apt-get -y install libstdc++-10-dev clang-format-12 ccache lldb
119+
if test "${{ matrix.toolchain }}" = "gcc" ; then
120+
sudo apt-get -y install cpp-10 gcc-10 g++-10
121+
else
122+
sudo apt-get -y install clang-12 llvm-12
123+
fi
107124
- name: install rustup components
125+
if: steps.cache.outputs.cache-hit != 'true'
108126
run: rustup component add rustfmt
109-
110-
- name: cargo install tools
111-
run: |
112-
cargo install --locked cargo-cache --version 0.8.3
113-
cargo install --locked cargo-sweep --version 0.7.0
114-
cargo install --locked mtime-travel --version 0.1.0
115-
127+
- name: install cargo-cache
128+
if: steps.cache.outputs.cache-hit != 'true'
129+
run: cargo install --locked cargo-cache --version 0.8.3
130+
- name: install cargo-sweep
131+
if: steps.cache.outputs.cache-hit != 'true'
132+
run: cargo install --locked cargo-sweep --version 0.7.0
133+
- name: install dependencies
134+
if: steps.cache.outputs.cache-hit != 'true'
135+
run: sudo apt-get -y install postgresql git build-essential pkg-config autoconf automake libtool bison flex libpq-dev parallel libunwind-dev sed perl
116136
- name: Build
137+
if: steps.cache.outputs.cache-hit != 'true'
117138
run: |
118139
if test "${{ matrix.toolchain }}" = "gcc" ; then
119140
export CC='gcc'
@@ -123,50 +144,26 @@ jobs:
123144
export CXX='clang++'
124145
fi
125146
echo Build with $CC and $CXX
147+
echo "Running first scenario"
126148
./ci-build.sh --use-temp-db --protocol ${{ matrix.protocol }}
127149
128-
build-mac:
129-
runs-on:
130-
- namespace-profile-macos-sequoia;overrides.cache-tag=config-macos-sequoia
131-
steps:
132-
133-
- name: Checkout with Namespace Git mirrors cache
134-
uses: namespacelabs/nscloud-checkout-action@v7
150+
# We only _save_ to the cache when we had a cache miss and are running on master.
151+
- name: Save cache after first build
152+
uses: actions/cache/save@v4
153+
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.ref_name == 'master' }}
135154
with:
136-
fetch-depth: 1
137-
submodules: recursive
155+
path: ${{ env.CACHED_PATHS }}
156+
key: ${{ steps.cache.outputs.cache-primary-key }}
138157

139-
- name: Configure Namespace cache volume
140-
uses: namespacelabs/nscloud-cache-action@v1
141-
with:
142-
path: |
143-
~/.cargo
144-
build-clang-current
145-
146-
- name: install prerequisites and uninstall brew rust, add rustup
147-
run: |
148-
brew install libsodium libtool autoconf automake pkg-config libpq openssl parallel ccache bison gnu-sed perl coreutils
149-
brew uninstall rust rustup
150-
brew install rustup
151-
152-
- name: install rustup components
158+
- name: Build for check-test-tx-meta scenario
159+
if: steps.cache.outputs.cache-hit != 'true'
153160
run: |
154-
rustup-init -y
155-
rustup component add rustfmt rustc cargo clippy rust-src rust-std
156-
157-
- name: cargo install tools
158-
run: |
159-
cargo install --locked cargo-cache --version 0.8.3
160-
cargo install --locked cargo-sweep --version 0.7.0
161-
cargo install --locked mtime-travel --version 0.1.0
162-
163-
- name: Build
164-
run: |
165-
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix)/opt/libpq/lib/pkgconfig"
166-
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix)/opt/openssl@3/lib/pkgconfig"
167-
export PATH="$(brew --prefix bison)/bin:$PATH"
168-
export CC='clang'
169-
export CXX='clang++'
170-
export CLANG_VERSION=none
171-
export SKIP_FORMAT_CHECK=1
172-
./ci-build.sh --disable-postgres --protocol current
161+
if test "${{ matrix.toolchain }}" = "gcc" ; then
162+
export CC='gcc'
163+
export CXX='g++'
164+
else
165+
export CC='clang'
166+
export CXX='clang++'
167+
fi
168+
echo "Running second scenario with --check-test-tx-meta flag"
169+
./ci-build.sh --use-temp-db --protocol ${{ matrix.protocol }} --check-test-tx-meta

0 commit comments

Comments
 (0)