-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from cosmicpsyop/feature/ubuntu-pkg-job
create debian package framework and git action job
- Loading branch information
Showing
10 changed files
with
165 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: ubuntu | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
ubuntu: | ||
runs-on: ubuntu-latest | ||
name: A job to build and run strfry on Ubuntu | ||
steps: | ||
- name: Checkout strfry | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build strfry | ||
run: | | ||
sudo apt update && sudo apt install -y --no-install-recommends \ | ||
git g++ make pkg-config libtool ca-certificates \ | ||
libyaml-perl libtemplate-perl libregexp-grammars-perl libssl-dev zlib1g-dev \ | ||
liblmdb-dev libflatbuffers-dev libsecp256k1-dev libzstd-dev | ||
git submodule update --init | ||
make setup-golpe | ||
make -j4 | ||
if ! [ -f ./strfry ]; then | ||
echo "Strfry build failed." | ||
exit 1 | ||
fi | ||
- name: Package strfry | ||
run: | | ||
sudo apt-get install debhelper devscripts -y | ||
dpkg-buildpackage --build=binary -us -uc | ||
mv ../*.deb . | ||
filename=`ls *.deb | grep -v -- -dbgsym` | ||
echo "filename=$filename" >> $GITHUB_ENV | ||
- name: Upload strfry deb | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.filename }} | ||
path: ${{ env.filename }} | ||
|
||
- name: Run strfry | ||
run: | | ||
cat /etc/os-release | ||
sudo ./strfry relay & | ||
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,6 @@ | ||
strfry (0.9.6-1) unstable; urgency=low | ||
|
||
* Initial ubuntu test release | ||
|
||
-- Doug Hoytech <[email protected]> Fri, 22 Sep 2023 17:32:21 +0800 | ||
|
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 @@ | ||
11 |
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,13 @@ | ||
Source: strfry | ||
Section: admin | ||
Priority: optional | ||
Maintainer: Doug Hoytech <[email protected]> | ||
Build-Depends: debhelper (>= 8.0.0) | ||
|
||
Package: strfry | ||
Architecture: amd64 | ||
Depends: ${shlibs:Depends} | ||
Conflicts: | ||
Replaces: | ||
Provides: strfry | ||
Description: strfry is a relay for the nostr protocol |
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,22 @@ | ||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: strfry | ||
Upstream-Contact: Doug Hoytech <[email protected]> | ||
Source: https://github.com/hoytech/strfry | ||
|
||
Files: * | ||
Copyright: 2023 Doug Hoytech | ||
License: GPL-3 | ||
|
||
License: GPL-3 | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. |
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,21 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if ! getent group strfry >/dev/null 2>&1; then | ||
addgroup --system --quiet strfry | ||
fi | ||
if ! getent passwd strfry >/dev/null 2>&1; then | ||
adduser --system --quiet --ingroup strfry \ | ||
--no-create-home --home /nonexistent \ | ||
strfry | ||
fi | ||
|
||
if [ "$1" = "configure" ] ; then | ||
chown strfry:strfry /etc/strfry.conf | ||
chown strfry:strfry /var/lib/strfry | ||
|
||
systemctl daemon-reload | ||
systemctl enable strfry.service | ||
systemctl start strfry | ||
fi |
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,12 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then | ||
systemctl --system daemon-reload >/dev/null || true | ||
fi | ||
if [ "$1" = "purge" ]; then | ||
if [ -x "/usr/bin/deb-systemd-helper" ]; then | ||
deb-systemd-helper purge 'strfry.service' >/dev/null || true | ||
fi | ||
fi |
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,12 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ "$1" = "remove" ]; then | ||
systemctl stop strfry | ||
systemctl disable strfry | ||
fi | ||
|
||
if [ "$1" = "upgrade" ]; then | ||
systemctl stop strfry | ||
fi |
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,15 @@ | ||
#!/usr/bin/make -f | ||
|
||
#export DH_VERBOSE=1 | ||
|
||
%: | ||
dh $@ --parallel | ||
|
||
override_dh_auto_clean: | ||
override_dh_auto_install: | ||
mkdir -p debian/strfry/usr/bin/ | ||
mkdir -p debian/strfry/etc/ | ||
mkdir -p debian/strfry/var/lib/strfry/ | ||
cp -a strfry debian/strfry/usr/bin/. | ||
cp -a strfry.conf debian/strfry/etc/. | ||
sed -i 's|./strfry-db/|/var/lib/strfry/|g' debian/strfry/etc/strfry.conf |
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,16 @@ | ||
[Unit] | ||
Description=strfry relay service | ||
After=syslog.target network.target | ||
|
||
[Service] | ||
User=strfry | ||
ExecStart=/usr/bin/strfry relay | ||
Restart=on-failure | ||
RestartSec=5 | ||
ProtectHome=yes | ||
NoNewPrivileges=yes | ||
ProtectSystem=full | ||
LimitCORE=1000000000 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |