Skip to content

Commit bbc2c78

Browse files
committed
[test2]
1 parent 1d760fd commit bbc2c78

File tree

2 files changed

+56
-80
lines changed

2 files changed

+56
-80
lines changed

.github/workflows/build-meson.yml

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: read
10+
packages: write
1011

1112
concurrency:
1213
group: |
@@ -16,54 +17,32 @@ concurrency:
1617
}}
1718
cancel-in-progress: ${{ github.ref_type != 'tag' }}
1819

19-
env:
20-
SCCACHE_GHA_ENABLED: true
21-
RUSTC_WRAPPER: sccache
22-
RUST_VERSION: '1.88.0'
23-
CXXBRIDGE_VERSION: '1.0.192'
24-
2520
jobs:
21+
container:
22+
name: Build container
23+
uses: ./.github/workflows/build-container.yml
24+
with:
25+
context: ./contrib/containers/meson
26+
file: ./contrib/containers/meson/Dockerfile
27+
name: dashcore-meson-ci
28+
2629
build-librustdeps:
2730
name: Build librustdeps
31+
needs: container
2832
runs-on: ubuntu-latest
29-
env:
30-
CC: clang
31-
CXX: clang++
33+
container:
34+
image: ${{ needs.container.outputs.path }}
35+
options: --user root
3236
steps:
3337
- name: Checkout code
3438
uses: actions/checkout@v4
3539
with:
3640
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3741
submodules: recursive
3842

39-
- name: Install dependencies
40-
run: |
41-
sudo apt-get update
42-
sudo apt-get install -y ninja-build libboost-test-dev clang pipx
43-
pipx install meson
44-
echo "$HOME/.local/bin" >> $GITHUB_PATH
45-
46-
- name: Install Rust toolchain
47-
uses: dtolnay/rust-toolchain@master
48-
with:
49-
toolchain: ${{ env.RUST_VERSION }}
50-
5143
- name: Setup sccache
5244
uses: mozilla-actions/[email protected]
5345

54-
- name: Restore Cargo cache
55-
uses: actions/cache/restore@v4
56-
with:
57-
path: |
58-
/home/runner/.cargo/registry
59-
/home/runner/.cargo/git
60-
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('Cargo.lock') }}
61-
restore-keys: |
62-
${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-
63-
64-
- name: Install cxxbridge
65-
run: cargo install cxxbridge-cmd@${{ env.CXXBRIDGE_VERSION }}
66-
6746
- name: Build librustdeps
6847
run: |
6948
cd rust
@@ -76,56 +55,23 @@ jobs:
7655
meson setup builddir -Duse_rustdeps=true -Drustdeps_build_dir=${{ github.workspace }}/rust/builddir
7756
meson compile -C builddir
7857
79-
- name: Save Cargo cache
80-
if: github.event_name == 'push' && github.ref_name == 'develop'
81-
uses: actions/cache/save@v4
82-
with:
83-
path: |
84-
/home/runner/.cargo/registry
85-
/home/runner/.cargo/git
86-
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('Cargo.lock') }}
87-
8858
build-grovedb-cxx:
8959
name: Build grovedb_cxx
60+
needs: container
9061
runs-on: ubuntu-latest
91-
env:
92-
CC: clang
93-
CXX: clang++
62+
container:
63+
image: ${{ needs.container.outputs.path }}
64+
options: --user root
9465
steps:
9566
- name: Checkout code
9667
uses: actions/checkout@v4
9768
with:
9869
ref: ${{ github.event.pull_request.head.sha || github.sha }}
9970
submodules: recursive
10071

101-
- name: Install dependencies
102-
run: |
103-
sudo apt-get update
104-
sudo apt-get install -y ninja-build libboost-test-dev clang pipx
105-
pipx install meson
106-
echo "$HOME/.local/bin" >> $GITHUB_PATH
107-
108-
- name: Install Rust toolchain
109-
uses: dtolnay/rust-toolchain@master
110-
with:
111-
toolchain: ${{ env.RUST_VERSION }}
112-
11372
- name: Setup sccache
11473
uses: mozilla-actions/[email protected]
11574

116-
- name: Restore Cargo cache
117-
uses: actions/cache/restore@v4
118-
with:
119-
path: |
120-
/home/runner/.cargo/registry
121-
/home/runner/.cargo/git
122-
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('Cargo.lock') }}
123-
restore-keys: |
124-
${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-
125-
126-
- name: Install cxxbridge
127-
run: cargo install cxxbridge-cmd@${{ env.CXXBRIDGE_VERSION }}
128-
12975
- name: Build grovedb_cxx
13076
run: |
13177
cd rust/grovedb_cxx
@@ -142,12 +88,3 @@ jobs:
14288
run: |
14389
cd src/ffi/grovedb
14490
meson test -C builddir --print-errorlogs
145-
146-
- name: Save Cargo cache
147-
if: github.event_name == 'push' && github.ref_name == 'develop'
148-
uses: actions/cache/save@v4
149-
with:
150-
path: |
151-
/home/runner/.cargo/registry
152-
/home/runner/.cargo/git
153-
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('Cargo.lock') }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
ARG RUST_VERSION=1.88.0
2+
FROM rust:${RUST_VERSION}-slim-bookworm
3+
4+
# Needed to prevent tzdata hanging while expecting user input
5+
ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
6+
7+
# Build and base stuff
8+
ENV APT_ARGS="-y --no-install-recommends --no-upgrade"
9+
10+
# Install build dependencies
11+
RUN set -ex; \
12+
apt-get update && apt-get install ${APT_ARGS} \
13+
clang \
14+
git \
15+
libboost-test-dev \
16+
meson \
17+
ninja-build \
18+
pkg-config \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
ARG CXXBRIDGE_VERSION=1.0.192
22+
RUN cargo install cxxbridge-cmd@${CXXBRIDGE_VERSION} sccache \
23+
&& rm -rf /usr/local/cargo/registry
24+
25+
# Setup unprivileged user
26+
ARG USER_ID=1000 \
27+
GROUP_ID=1000
28+
RUN set -ex; \
29+
groupadd -g ${GROUP_ID} build || true; \
30+
useradd -u ${USER_ID} -g ${GROUP_ID} -m -s /bin/bash build || true; \
31+
mkdir -p /src && chown ${USER_ID}:${GROUP_ID} /src
32+
33+
ENV CC=clang \
34+
CXX=clang++ \
35+
SCCACHE_GHA_ENABLED=true \
36+
RUSTC_WRAPPER=sccache
37+
38+
WORKDIR /src
39+
USER build

0 commit comments

Comments
 (0)