actions: build rpms for releases (#29)
parent
78c2bfd6db
commit
d7e9a60ba1
|
@ -6,7 +6,8 @@ on:
|
|||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-deb:
|
||||
name: 'Build Debian packages'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -66,9 +67,40 @@ jobs:
|
|||
with:
|
||||
command: deb
|
||||
args: -p client
|
||||
- name: Save DEBs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: packaged-deb
|
||||
path: target/debian/*.deb
|
||||
|
||||
build-rpm:
|
||||
name: 'Build RPM packages'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
distros: ['fedora:32', 'fedora:33', 'centos:8']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build RPMs
|
||||
run: rpm/build-package.sh ${{ matrix.distros }}
|
||||
- name: Save RPMs
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: packaged-rpm
|
||||
path: target/rpm/*.rpm
|
||||
|
||||
release:
|
||||
name: 'Release packages'
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-deb, build-rpm]
|
||||
steps:
|
||||
- name: Get artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: target/debian/*.deb
|
||||
files: |
|
||||
packaged-deb/*.deb
|
||||
packaged-rpm/*.rpm
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
name: Rust
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags-ignore:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
|
|
@ -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/innernet@.service"
|
||||
%attr(0644, root, root) "/usr/share/man/man8/innernet.8.gz"
|
|
@ -45,3 +45,16 @@ maintainer = "tonari <hey@tonari.no>"
|
|||
name = "innernet"
|
||||
priority = "optional"
|
||||
section = "net"
|
||||
|
||||
[package.metadata.rpm]
|
||||
package = "innernet"
|
||||
|
||||
[package.metadata.rpm.cargo]
|
||||
buildflags = ["--release"]
|
||||
|
||||
[package.metadata.rpm.files]
|
||||
"../innernet@.service" = { path = "/usr/lib/systemd/system/innernet@.service" }
|
||||
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" }
|
||||
|
||||
[package.metadata.rpm.targets]
|
||||
innernet = { path = "/usr/bin/innernet" }
|
||||
|
|
|
@ -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/
|
|
@ -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
|
|
@ -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/innernet-server@.service"
|
||||
%attr(0644, root, root) "/usr/share/man/man8/innernet-server.8.gz"
|
|
@ -56,3 +56,16 @@ maintainer = "tonari <hey@tonari.no>"
|
|||
name = "innernet-server"
|
||||
priority = "optional"
|
||||
section = "net"
|
||||
|
||||
[package.metadata.rpm]
|
||||
package = "innernet-server"
|
||||
|
||||
[package.metadata.rpm.cargo]
|
||||
buildflags = ["--release"]
|
||||
|
||||
[package.metadata.rpm.files]
|
||||
"../innernet-server@.service" = { path = "/usr/lib/systemd/system/innernet-server@.service" }
|
||||
"../../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" }
|
||||
|
|
Loading…
Reference in New Issue