Skip to content

Commit 4b392f4

Browse files
committed
Switch build.yml to namespace runners
1 parent 8bd3834 commit 4b392f4

File tree

1 file changed

+52
-81
lines changed

1 file changed

+52
-81
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,30 @@ jobs:
1515
complete:
1616
if: always()
1717
needs: [fmt, cargo-deny, rust-check-git-rev-deps, build]
18-
runs-on: ubuntu-22.04
18+
runs-on:
19+
- namespace-profile-jammy-1-stellar-core
20+
- nscloud-cache-exp-do-not-commit
1921
steps:
2022
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
2123
run: exit 1
2224

2325
fmt:
24-
runs-on: ubuntu-22.04
26+
runs-on:
27+
- namespace-profile-jammy-1-stellar-core
28+
- nscloud-cache-exp-do-not-commit
2529
steps:
26-
- uses: actions/checkout@v4
27-
- run: rustup component add rustfmt
28-
- run: rustup update
29-
- run: cargo fmt --all --check
30+
- uses: namespacelabs/nscloud-checkout-action@v7
31+
with:
32+
fetch-depth: 1
33+
submodules: recursive
34+
- run: rustup component add rustfmt
35+
- run: rustup update
36+
- run: cargo fmt --all --check
3037

3138
cargo-deny:
32-
runs-on: ubuntu-22.04
39+
runs-on:
40+
- namespace-profile-jammy-1-stellar-core
41+
- nscloud-cache-exp-do-not-commit
3342
strategy:
3443
matrix:
3544
checks:
@@ -38,100 +47,69 @@ jobs:
3847
# Prevent sudden announcement of a new advisory from failing ci:
3948
continue-on-error: ${{ matrix.checks == 'advisories' }}
4049
steps:
41-
- uses: actions/checkout@v4
42-
- uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
43-
with:
44-
command: check ${{ matrix.checks }}
45-
# leave arguments empty so we don't test --all-features
46-
# which will see conflicting env versions
47-
arguments:
50+
- uses: namespacelabs/nscloud-checkout-action@v7
51+
with:
52+
fetch-depth: 1
53+
submodules: recursive
54+
- uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
55+
with:
56+
command: check ${{ matrix.checks }}
57+
# leave arguments empty so we don't test --all-features
58+
# which will see conflicting env versions
59+
arguments:
4860

4961
rust-check-git-rev-deps:
50-
runs-on: ubuntu-22.04
62+
runs-on:
63+
- namespace-profile-jammy-1-stellar-core
64+
- nscloud-cache-exp-do-not-commit
5165
steps:
52-
- uses: actions/checkout@v4
53-
- uses: stellar/actions/rust-check-git-rev-deps@main
66+
- uses: namespacelabs/nscloud-checkout-action@v7
67+
with:
68+
fetch-depth: 1
69+
submodules: recursive
70+
- uses: stellar/actions/rust-check-git-rev-deps@main
5471

5572
build:
56-
runs-on: ubuntu-jammy-16-cores-amd64
57-
env:
58-
CACHED_PATHS: |
59-
~/.ccache
60-
~/.cargo
61-
target
73+
runs-on:
74+
- namespace-profile-jammy-32-stellar-core;overrides.cache-tag=config-${{ matrix.toolchain }}-${{ matrix.protocol }}
6275
strategy:
6376
fail-fast: false
6477
matrix:
6578
toolchain: [ "gcc", "clang"]
6679
protocol: ["current", "next"]
67-
scenario: ["", "--check-test-tx-meta"]
6880
steps:
6981
- name: Fix kernel mmap rnd bits
7082
# Asan in llvm provided in ubuntu 22.04 is incompatible with
7183
# high-entropy ASLR in much newer kernels that GitHub runners are
7284
# using leading to random crashes: https://reviews.llvm.org/D148280
7385
run: sudo sysctl vm.mmap_rnd_bits=28
7486

75-
# We start with as cheap as possible a cache probe to see if we have an exact hit on this
76-
# git commit ID (for a given OS/toolchain/protocol). If so we can skip all subsequent
77-
# steps: we already tested this exact SHA.
78-
#
79-
# Unfortunately due to the way github actions control flow works, we have to repeat the
80-
# step 'if' condition in each step, and cannot actually "exit early" and skip the job.
81-
# There are a lot of duplicate bug reports filed on this aspect of github actions, don't
82-
# bother filing another.
83-
- name: Probe Cache
84-
id: cache
85-
uses: actions/cache/restore@v4
87+
- name: Checkout with Namespace Git mirrors cache
88+
uses: namespacelabs/nscloud-checkout-action@v7
8689
with:
87-
path: ${{ env.CACHED_PATHS }}
88-
key: ${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.protocol }}-${{ github.sha }}
89-
lookup-only: true
90+
fetch-depth: 1
91+
submodules: recursive
9092

91-
# When we have a cache miss on the exact commit SHA, we restore from the prefix without it.
92-
# This will restore the most-recently-written cache (github does this date ordering itself).
93-
- name: Restore Cache
94-
if: steps.cache.outputs.cache-hit != 'true'
95-
uses: actions/cache/restore@v4
93+
- name: Configure Namespace cache volume
94+
uses: namespacelabs/nscloud-cache-action@v1
9695
with:
97-
path: ${{ env.CACHED_PATHS }}
98-
key: ${{ steps.cache.outputs.cache-primary-key }}
99-
restore-keys: |
100-
${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.protocol }}
96+
path: |
97+
~/.cargo
98+
build-${{matrix.toolchain}}-${{matrix.protocol}}
99+
100+
- name: install rustup
101+
run: ./install-rust.sh
101102

102-
- uses: actions/checkout@v4
103-
if: steps.cache.outputs.cache-hit != 'true'
104-
with:
105-
fetch-depth: 200
106-
submodules: true
107-
- name: install core packages
108-
if: steps.cache.outputs.cache-hit != 'true'
109-
run: |
110-
sudo apt-get update
111-
sudo apt-get -y install --no-install-recommends apt-utils dialog git iproute2 procps lsb-release
112-
- name: install tool chain
113-
if: steps.cache.outputs.cache-hit != 'true'
114-
run: |
115-
sudo apt-get -y install libstdc++-10-dev clang-format-12 ccache lldb
116-
if test "${{ matrix.toolchain }}" = "gcc" ; then
117-
sudo apt-get -y install cpp-10 gcc-10 g++-10
118-
else
119-
sudo apt-get -y install clang-12 llvm-12
120-
fi
121103
- name: install rustup components
122-
if: steps.cache.outputs.cache-hit != 'true'
123104
run: rustup component add rustfmt
105+
124106
- name: install cargo-cache
125-
if: steps.cache.outputs.cache-hit != 'true'
126107
run: cargo install --locked cargo-cache --version 0.8.3
108+
127109
- name: install cargo-sweep
128-
if: steps.cache.outputs.cache-hit != 'true'
129110
run: cargo install --locked cargo-sweep --version 0.7.0
130-
- name: install dependencies
131-
if: steps.cache.outputs.cache-hit != 'true'
132-
run: sudo apt-get -y install postgresql git build-essential pkg-config autoconf automake libtool bison flex libpq-dev parallel libunwind-dev sed perl
111+
133112
- name: Build
134-
if: steps.cache.outputs.cache-hit != 'true'
135113
run: |
136114
if test "${{ matrix.toolchain }}" = "gcc" ; then
137115
export CC='gcc'
@@ -141,11 +119,4 @@ jobs:
141119
export CXX='clang++'
142120
fi
143121
echo Build with $CC and $CXX
144-
./ci-build.sh --use-temp-db --protocol ${{ matrix.protocol }} ${{ matrix.scenario }}
145-
146-
# We only _save_ to the cache when we had a cache miss, are running on master, and are the non-txmeta scenario.
147-
- uses: actions/cache/save@v4
148-
if: ${{ steps.cache.outputs.cache-hit != 'true' && github.ref_name == 'master' && matrix.scenario == ''}}
149-
with:
150-
path: ${{ env.CACHED_PATHS }}
151-
key: ${{ steps.cache.outputs.cache-primary-key }}
122+
./ci-build.sh --use-temp-db --protocol ${{ matrix.protocol }}

0 commit comments

Comments
 (0)