Skip to content

Commit 9f722f2

Browse files
committed
wip: try multi-arch
1 parent 53450bf commit 9f722f2

File tree

8 files changed

+114
-68
lines changed

8 files changed

+114
-68
lines changed

.github/workflows/ci.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
jobs:
99
coverage:
10+
if: false
1011
name: Code coverage
1112
runs-on: ubuntu-latest
1213
concurrency:

.github/workflows/publish.yaml

+17-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
release:
77
types:
88
- published
9+
pull_request:
910
workflow_dispatch:
1011

1112
jobs:
@@ -17,29 +18,42 @@ jobs:
1718
contents: read
1819
packages: write
1920
steps:
20-
- uses: docker/setup-qemu-action@v3
2121
- uses: docker/setup-buildx-action@v3
2222
- uses: docker/login-action@v3
2323
with:
2424
username: ${{ vars.DOCKERHUB_USERNAME }}
2525
password: ${{ secrets.DOCKERHUB_TOKEN }}
26+
- uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
2631
- uses: actions/checkout@v4
2732
- uses: docker/metadata-action@v5
2833
id: meta
2934
with:
30-
images: uatuko/ruek
35+
images: |
36+
${{ github.repository }}
37+
ghcr.io/${{ github.repository }}
3138
tags: |
32-
type=raw,value=latest,enable={{is_default_branch}}
39+
type=raw,value=latest
3340
type=semver,pattern={{version}}
3441
type=semver,pattern={{major}}.{{minor}}
3542
type=semver,pattern={{major}}
3643
- name: Build and publish
3744
uses: docker/build-push-action@v6
3845
with:
46+
annotations: ${{ steps.meta.outputs.annotations }}
3947
context: .
4048
file: Containerfile
4149
platforms: |
4250
linux/amd64
4351
linux/arm64
4452
push: true
4553
tags: ${{ steps.meta.outputs.tags }}
54+
- uses: actions/delete-package-versions@v5
55+
with:
56+
package-name: ruek
57+
package-type: container
58+
min-versions-to-keep: 2
59+
delete-only-untagged-versions: true

Containerfile

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1-
FROM debian:12-slim as builder
1+
FROM --platform=$BUILDPLATFORM debian:12-slim as builder
2+
3+
ARG TARGETARCH
4+
5+
COPY . /tmp/source
6+
WORKDIR /tmp
27

38
RUN apt-get update \
9+
&& \
10+
ruek_march=$(./source/bin/march.sh) \
11+
&& \
12+
if [ "$ruek_march" = "x86_64" ]; then ruek_march=x86-64; fi \
413
&& \
514
apt-get install -y --no-install-recommends \
15+
binutils-${ruek_march}-linux-gnu \
616
cmake ninja-build \
7-
clang libclang-rt-dev \
17+
g++ \
818
protobuf-compiler libprotobuf-dev libprotoc-dev \
919
libpq-dev
1020

1121
COPY . /tmp/source
1222
WORKDIR /tmp
1323

14-
RUN cmake -B build -G Ninja -S source/ \
15-
-DCMAKE_BUILD_TYPE=Release \
16-
-DRUEK_BUILD_TESTING=OFF
24+
RUN ruek_march=$(./source/bin/march.sh) \
25+
&& \
26+
cmake -B build -G Ninja -S source/ \
27+
-DCMAKE_CXX_COMPILER_TARGET=${ruek_march}-linux-gnu \
28+
-DCMAKE_BUILD_TYPE=Release \
29+
-DRUEK_BUILD_TESTING=OFF
1730

1831
RUN cmake --build build/ --config Release
1932

bin/march.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env sh
2+
3+
: ${ruek_march=unknown}
4+
5+
if [ -z ${TARGETARCH} ]; then
6+
TARGETARCH=$(uname -m)
7+
fi
8+
9+
case ${TARGETARCH} in
10+
amd64 | x86_64)
11+
ruek_march=x86_64
12+
;;
13+
aarch64 | arm64)
14+
ruek_march=aarch64
15+
;;
16+
esac
17+
18+
echo ${ruek_march}

src/svc/authz.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ class Impl {
1717
return {grpcxx::status::code_t::unimplemented, std::nullopt};
1818
}
1919

20-
template <>
21-
rpcCheck::result_type call<rpcCheck>(grpcxx::context &ctx, const rpcCheck::request_type &req);
22-
23-
template <>
24-
rpcGrant::result_type call<rpcGrant>(grpcxx::context &ctx, const rpcGrant::request_type &req);
25-
26-
template <>
27-
rpcRevoke::result_type call<rpcRevoke>(
28-
grpcxx::context &ctx, const rpcRevoke::request_type &req);
29-
3020
google::rpc::Status exception() noexcept;
3121

3222
private:
@@ -35,5 +25,15 @@ class Impl {
3525
db::Tuple map(const grpcxx::context &ctx, const rpcGrant::request_type &from) const noexcept;
3626
rpcGrant::response_type map(const db::Tuple &from) const noexcept;
3727
};
28+
29+
template <>
30+
rpcCheck::result_type Impl::call<rpcCheck>(grpcxx::context &ctx, const rpcCheck::request_type &req);
31+
32+
template <>
33+
rpcGrant::result_type Impl::call<rpcGrant>(grpcxx::context &ctx, const rpcGrant::request_type &req);
34+
35+
template <>
36+
rpcRevoke::result_type Impl::call<rpcRevoke>(
37+
grpcxx::context &ctx, const rpcRevoke::request_type &req);
3838
} // namespace authz
3939
} // namespace svc

src/svc/entities.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ class Impl {
1818
return {grpcxx::status::code_t::unimplemented, std::nullopt};
1919
}
2020

21-
template <>
22-
rpcList::result_type call<rpcList>(grpcxx::context &ctx, const rpcList::request_type &req);
23-
24-
template <>
25-
rpcListPrincipals::result_type call<rpcListPrincipals>(
26-
grpcxx::context &ctx, const rpcListPrincipals::request_type &req);
27-
2821
google::rpc::Status exception() noexcept;
2922

3023
private:
3124
template <typename T, typename F> T map(const F &) const noexcept;
25+
};
3226

33-
template <> rpcList::response_type map(const db::Tuples &from) const noexcept;
34-
template <> rpcListPrincipals::response_type map(const db::Tuples &from) const noexcept;
27+
template <>
28+
rpcList::result_type Impl::call<rpcList>(grpcxx::context &ctx, const rpcList::request_type &req);
3529

36-
template <> ruek::api::v1::EntitiesEntity map(const db::Tuple &from) const noexcept;
37-
template <> ruek::api::v1::EntitiesPrincipal map(const db::Tuple &from) const noexcept;
38-
};
30+
template <>
31+
rpcListPrincipals::result_type Impl::call<rpcListPrincipals>(
32+
grpcxx::context &ctx, const rpcListPrincipals::request_type &req);
33+
34+
template <> rpcList::response_type Impl::map(const db::Tuples &from) const noexcept;
35+
template <> rpcListPrincipals::response_type Impl::map(const db::Tuples &from) const noexcept;
36+
37+
template <> ruek::api::v1::EntitiesEntity Impl::map(const db::Tuple &from) const noexcept;
38+
template <> ruek::api::v1::EntitiesPrincipal Impl::map(const db::Tuple &from) const noexcept;
3939
} // namespace entities
4040
} // namespace svc

src/svc/principals.h

+19-19
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,6 @@ class Impl {
1818
return {grpcxx::status::code_t::unimplemented, std::nullopt};
1919
}
2020

21-
template <>
22-
rpcCreate::result_type call<rpcCreate>(
23-
grpcxx::context &ctx, const rpcCreate::request_type &req);
24-
25-
template <>
26-
rpcDelete::result_type call<rpcDelete>(
27-
grpcxx::context &ctx, const rpcDelete::request_type &req);
28-
29-
template <>
30-
rpcList::result_type call<rpcList>(grpcxx::context &ctx, const rpcList::request_type &req);
31-
32-
template <>
33-
rpcRetrieve::result_type call<rpcRetrieve>(
34-
grpcxx::context &ctx, const rpcRetrieve::request_type &req);
35-
36-
template <>
37-
rpcUpdate::result_type call<rpcUpdate>(
38-
grpcxx::context &ctx, const rpcUpdate::request_type &req);
39-
4021
google::rpc::Status exception() noexcept;
4122

4223
private:
@@ -46,5 +27,24 @@ class Impl {
4627
rpcCreate::response_type map(const db::Principal &from) const noexcept;
4728
rpcList::response_type map(const db::Principals &from) const noexcept;
4829
};
30+
31+
template <>
32+
rpcCreate::result_type Impl::call<rpcCreate>(
33+
grpcxx::context &ctx, const rpcCreate::request_type &req);
34+
35+
template <>
36+
rpcDelete::result_type Impl::call<rpcDelete>(
37+
grpcxx::context &ctx, const rpcDelete::request_type &req);
38+
39+
template <>
40+
rpcList::result_type Impl::call<rpcList>(grpcxx::context &ctx, const rpcList::request_type &req);
41+
42+
template <>
43+
rpcRetrieve::result_type Impl::call<rpcRetrieve>(
44+
grpcxx::context &ctx, const rpcRetrieve::request_type &req);
45+
46+
template <>
47+
rpcUpdate::result_type Impl::call<rpcUpdate>(
48+
grpcxx::context &ctx, const rpcUpdate::request_type &req);
4949
} // namespace principals
5050
} // namespace svc

src/svc/relations.h

+19-19
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,6 @@ class Impl {
2121
return {grpcxx::status::code_t::unimplemented, std::nullopt};
2222
}
2323

24-
template <>
25-
rpcCheck::result_type call<rpcCheck>(grpcxx::context &ctx, const rpcCheck::request_type &req);
26-
27-
template <>
28-
rpcCreate::result_type call<rpcCreate>(
29-
grpcxx::context &ctx, const rpcCreate::request_type &req);
30-
31-
template <>
32-
rpcDelete::result_type call<rpcDelete>(
33-
grpcxx::context &ctx, const rpcDelete::request_type &req);
34-
35-
template <>
36-
rpcListLeft::result_type call<rpcListLeft>(
37-
grpcxx::context &ctx, const rpcListLeft::request_type &req);
38-
39-
template <>
40-
rpcListRight::result_type call<rpcListRight>(
41-
grpcxx::context &ctx, const rpcListRight::request_type &req);
42-
4324
google::rpc::Status exception() noexcept;
4425

4526
private:
@@ -71,5 +52,24 @@ class Impl {
7152
std::string_view spaceId, db::Tuple::Entity left, std::string_view relation,
7253
db::Tuple::Entity right, std::uint16_t limit) const;
7354
};
55+
56+
template <>
57+
rpcCheck::result_type Impl::call<rpcCheck>(grpcxx::context &ctx, const rpcCheck::request_type &req);
58+
59+
template <>
60+
rpcCreate::result_type Impl::call<rpcCreate>(
61+
grpcxx::context &ctx, const rpcCreate::request_type &req);
62+
63+
template <>
64+
rpcDelete::result_type Impl::call<rpcDelete>(
65+
grpcxx::context &ctx, const rpcDelete::request_type &req);
66+
67+
template <>
68+
rpcListLeft::result_type Impl::call<rpcListLeft>(
69+
grpcxx::context &ctx, const rpcListLeft::request_type &req);
70+
71+
template <>
72+
rpcListRight::result_type Impl::call<rpcListRight>(
73+
grpcxx::context &ctx, const rpcListRight::request_type &req);
7474
} // namespace relations
7575
} // namespace svc

0 commit comments

Comments
 (0)