feat: github-actions
This commit is contained in:
parent
552cba1cef
commit
164ec2f186
52
.github/workflows/build-release.yml
vendored
Normal file
52
.github/workflows/build-release.yml
vendored
Normal 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/x86_64/${{ 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
7
.github/workflows/docker/Dockerfile
vendored
Normal 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
22
.github/workflows/docker/action.yml
vendored
Normal 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
10
.github/workflows/docker/entrypoint.sh
vendored
Executable 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
20
.github/workflows/tests-dev.yml
vendored
Normal 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
20
.github/workflows/tests-master.yml
vendored
Normal 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'
|
||||
|
5
Makefile
5
Makefile
@ -34,12 +34,15 @@ SPEC := $(SPECSDIR)/$(NAME).spec
|
||||
VERSION := $(shell grep -Fi 'Version:' $(SPEC) | awk '{ print $$2 }')
|
||||
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
|
||||
rpmbuild -ba $(SPEC)
|
||||
$(MAKE) clean-tmp
|
||||
|
||||
builddep:
|
||||
dnf builddep $(SPEC)
|
||||
|
||||
prep: clean-tmp
|
||||
cd $(SOURCESDIR) && tar czf $(SOURCETARBALL) \
|
||||
config \
|
||||
|
Loading…
Reference in New Issue
Block a user