Compare commits

...

8 Commits

Author SHA1 Message Date
8dc57a7cfa add test builddep 2020-08-10 14:27:46 +03:00
96cf5b8164 fix: build-release rpm path 2020-08-10 14:25:32 +03:00
dfa7fc5b23 builddep hotfix 2020-08-10 14:22:07 +03:00
e510c227f0 spec change 2020-08-10 14:16:53 +03:00
30d669ff06 Merge branch 'master' into dev 2020-08-10 14:13:57 +03:00
c19fdf0f6a feat: github-actions 2020-08-10 14:11:30 +03:00
5d2895871d feat: make test 2020-08-08 22:49:40 +03:00
ad30dfe034 more parallel actions 2020-08-08 08:28:44 +03:00
10 changed files with 156 additions and 6 deletions

52
.github/workflows/build-release.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: build release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+-[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: build
uses: ./.github/workflows/docker
id: build
with:
target: 'all'
- name: create release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: upload srpm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/kf2-srv/kf2-srv/SRPMS/${{ steps.build.outputs.srpm_name }}
asset_name: ${{ steps.build.outputs.srpm_name }}
asset_content_type: application/gzip
- name: upload rpm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/kf2-srv/kf2-srv/RPMS/noarch/${{ steps.build.outputs.rpm_name }}
asset_name: ${{ steps.build.outputs.rpm_name }}
asset_content_type: application/gzip

7
.github/workflows/docker/Dockerfile vendored Normal file
View File

@ -0,0 +1,7 @@
FROM centos:8
RUN dnf install -y rpmdevtools dnf-utils make
COPY * /
ENTRYPOINT ["/entrypoint.sh"]

22
.github/workflows/docker/action.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: 'make'
description: 'make <target>'
inputs:
target:
description: 'make <target>'
required: true
default: ''
outputs:
rpm_name:
description: 'rpm name'
srpm_name:
description: 'src.rpm name'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.target }}

10
.github/workflows/docker/entrypoint.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh -l
make active && make builddep && make -j$(nproc) "$1"
RC=$?
echo "::set-output name=rpm_name::$(find /github/workspace/RPMS -type f -name '*.rpm' -printf '%f\n')"
echo "::set-output name=srpm_name::$(find /github/workspace/SRPMS -type f -name '*.src.rpm' -printf '%f\n')"
exit $RC

20
.github/workflows/tests-dev.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: tests (dev)
on:
push:
branches:
- dev
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: run tests
uses: ./.github/workflows/docker
with:
target: 'test'

20
.github/workflows/tests-master.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: tests (master)
on:
push:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: run tests
uses: ./.github/workflows/docker
with:
target: 'test'

View File

@ -34,12 +34,15 @@ SPEC := $(SPECSDIR)/$(NAME).spec
VERSION := $(shell grep -Fi 'Version:' $(SPEC) | awk '{ print $$2 }') VERSION := $(shell grep -Fi 'Version:' $(SPEC) | awk '{ print $$2 }')
SOURCETARBALL := $(SOURCESDIR)/$(NAME)-$(VERSION).tar.gz SOURCETARBALL := $(SOURCESDIR)/$(NAME)-$(VERSION).tar.gz
.PHONY: all prep rpm srpm activate active check-activate clean-tmp clean-pkg clean .PHONY: all prep rpm srpm activate active check-activate clean-tmp clean-pkg clean builddep test
all: check-activate prep all: check-activate prep
rpmbuild -ba $(SPEC) rpmbuild -ba $(SPEC)
$(MAKE) clean-tmp $(MAKE) clean-tmp
builddep:
dnf builddep -y $(SPEC)
prep: clean-tmp prep: clean-tmp
cd $(SOURCESDIR) && tar czf $(SOURCETARBALL) \ cd $(SOURCESDIR) && tar czf $(SOURCETARBALL) \
config \ config \
@ -56,6 +59,10 @@ srpm: check-activate prep
rpmbuild -bs $(SPEC) rpmbuild -bs $(SPEC)
$(MAKE) clean-tmp $(MAKE) clean-tmp
test: check-activate prep
rpmbuild -bi $(SPEC)
$(MAKE) clean-tmp
active: activate active: activate
activate: activate:

View File

@ -253,8 +253,11 @@ function instance_list () # $*: [InstanceName[s]]
fi fi
for Instance in $InstanceList for Instance in $InstanceList
do do
(
instance_status "$Instance" instance_status "$Instance"
) &
done done
wait
} | sort -t : -k 4 } | sort -t : -k 4
} | column -t -s : } | column -t -s :
} }

View File

@ -59,6 +59,7 @@ function workshop_list ()
{ {
for WorkshopID in $(workshop_list_ids) for WorkshopID in $(workshop_list_ids)
do do
(
local Cache="$CacheDir/$WorkshopID" local Cache="$CacheDir/$WorkshopID"
local Downl="$DownloadDir/content/$AppClientNum/$WorkshopID" local Downl="$DownloadDir/content/$AppClientNum/$WorkshopID"
local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID" local Url="https://steamcommunity.com/sharedfiles/filedetails/?id=$WorkshopID"
@ -69,7 +70,9 @@ function workshop_list ()
local WsSize="-"; WsName="-" local WsSize="-"; WsName="-"
fi fi
echo "$WorkshopID $WsName $WsSize $Url" echo "$WorkshopID $WsName $WsSize $Url"
) &
done done
wait
} | sort -k 2 } | sort -k 2
} | column -t } | column -t
} }

View File

@ -1,8 +1,8 @@
%global steamuser steam %global steamuser steam
Name: kf2-srv Name: kf2-srv
Version: 0.14.0 Version: 0.14.1
Release: 1%{dist} Release: 2%{dist}
Summary: Killing Floor 2 server Summary: Killing Floor 2 server
Group: Amusements/Games Group: Amusements/Games
License: GNU GPLv3 License: GNU GPLv3
@ -10,10 +10,10 @@ BuildArch: noarch
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
# test deps
BuildRequires: systemd
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
BuildRequires: libxml2
#BuildRequires(check): xmllint
#BuildRequires(check): systemd >= 219
Requires: systemd >= 219 Requires: systemd >= 219
Requires: steamcmd >= 2018.01.05-5 Requires: steamcmd >= 2018.01.05-5
@ -99,6 +99,12 @@ if [[ $1 == 1 ]]; then # Install
fi fi
%changelog %changelog
* Mon Aug 10 2020 GenZmeY <genzmey@gmail.com> - 0.14.1-2
- github-actions build.
* Sat Aug 8 2020 GenZmeY <genzmey@gmail.com> - 0.14.1-1
- parallel actions for instance list.
* Sat Aug 8 2020 GenZmeY <genzmey@gmail.com> - 0.14.0-1 * Sat Aug 8 2020 GenZmeY <genzmey@gmail.com> - 0.14.0-1
- new usage (groups/commands); - new usage (groups/commands);
- new code structure; - new code structure;