-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions: build rpms for releases (#29)
- Loading branch information
Showing
8 changed files
with
211 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
%define __spec_install_post %{nil} | ||
%define __os_install_post %{_dbpath}/brp-compress | ||
%define debug_package %{nil} | ||
|
||
Name: innernet | ||
Summary: A client to manage innernet network interfaces. | ||
Version: @@VERSION@@ | ||
Release: @@RELEASE@@%{?dist} | ||
License: MIT | ||
Source0: %{name}-%{version}.tar.gz | ||
URL: https://github.com/tonarino/innernet | ||
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||
|
||
Requires: glibc | ||
Requires: systemd | ||
Requires: libgcc | ||
|
||
%description | ||
%{summary} | ||
|
||
%prep | ||
%setup -q | ||
|
||
%build | ||
ln -s %{name} .%{_bindir}/inn | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
mkdir -p %{buildroot} | ||
cp -a * %{buildroot} | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{_bindir}/* | ||
%attr(0644, root, root) "/usr/lib/systemd/system/[email protected]" | ||
%attr(0644, root, root) "/usr/share/man/man8/innernet.8.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,16 @@ maintainer = "tonari <[email protected]>" | |
name = "innernet" | ||
priority = "optional" | ||
section = "net" | ||
|
||
[package.metadata.rpm] | ||
package = "innernet" | ||
|
||
[package.metadata.rpm.cargo] | ||
buildflags = ["--release"] | ||
|
||
[package.metadata.rpm.files] | ||
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" } | ||
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" } | ||
|
||
[package.metadata.rpm.targets] | ||
innernet = { path = "/usr/bin/innernet" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
ARG DISTRO | ||
ARG VER | ||
|
||
FROM ${DISTRO}:${VER} as builder | ||
LABEL stage=innernet-rpm | ||
|
||
RUN dnf -y update && \ | ||
dnf -y install clang-devel sqlite-devel glibc-devel rpm-build && \ | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal | ||
|
||
WORKDIR /workdir | ||
COPY . . | ||
RUN rm -rf target | ||
|
||
RUN source $HOME/.cargo/env && \ | ||
cargo install cargo-rpm && \ | ||
cargo build --release --verbose&& \ | ||
# device::tests::test_add_peers will fail due to restricted docker env | ||
cargo test --release --verbose -- --skip test_add_peers && \ | ||
cd server && cargo rpm build && \ | ||
cd ../client && cargo rpm build | ||
|
||
FROM ${DISTRO}:${VER} | ||
LABEL stage=innernet-rpm | ||
|
||
RUN mkdir -p /target/rpm | ||
COPY --from=builder /workdir/target/release/rpmbuild/RPMS/x86_64/innernet-*.rpm /target/rpm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
cmd() { | ||
echo "[#] $*" >&2 | ||
"$@" | ||
} | ||
|
||
if [ $# -lt 1 ]; then | ||
echo "Usage: $0 distro version (from docker hub), e.g:" | ||
echo | ||
echo "$0 fedora:33" | ||
exit 1 | ||
else | ||
SPLIT_ARG=(${1//:/ }) | ||
DISTRO=${SPLIT_ARG[0]} | ||
VER=${SPLIT_ARG[1]} | ||
|
||
if [[ -z "$DISTRO" || -z "$VER" ]]; then | ||
echo "bad arg" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
|
||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
cd $SCRIPT_DIR/.. | ||
|
||
cmd docker build --tag "innernet-rpm-$DISTRO$VER" --file rpm/Dockerfile --build-arg DISTRO=$DISTRO --build-arg VER=$VER . | ||
|
||
echo "exporting built rpm's from docker image" | ||
cmd docker run --rm innernet-rpm-$DISTRO$VER sh -c "tar cf - target/rpm/*" | tar xv | ||
|
||
echo "cleaning up" | ||
cmd docker image prune --force --filter label=stage=innernet-rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
%define __spec_install_post %{nil} | ||
%define __os_install_post %{_dbpath}/brp-compress | ||
%define debug_package %{nil} | ||
|
||
Name: innernet-server | ||
Summary: A server to coordinate innernet networks. | ||
Version: @@VERSION@@ | ||
Release: @@RELEASE@@%{?dist} | ||
License: MIT | ||
Source0: %{name}-%{version}.tar.gz | ||
URL: https://github.com/tonarino/innernet | ||
|
||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | ||
|
||
Requires: glibc | ||
Requires: systemd | ||
Requires: libgcc | ||
Requires: sqlite | ||
Requires: zlib | ||
|
||
%description | ||
%{summary} | ||
|
||
%prep | ||
%setup -q | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
mkdir -p %{buildroot} | ||
cp -a * %{buildroot} | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{_bindir}/* | ||
%attr(0644, root, root) "/usr/lib/systemd/system/[email protected]" | ||
%attr(0644, root, root) "/usr/share/man/man8/innernet-server.8.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,16 @@ maintainer = "tonari <[email protected]>" | |
name = "innernet-server" | ||
priority = "optional" | ||
section = "net" | ||
|
||
[package.metadata.rpm] | ||
package = "innernet-server" | ||
|
||
[package.metadata.rpm.cargo] | ||
buildflags = ["--release"] | ||
|
||
[package.metadata.rpm.files] | ||
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" } | ||
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet-server.8.gz" } | ||
|
||
[package.metadata.rpm.targets] | ||
innernet-server = { path = "/usr/bin/innernet-server" } |