diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..80ccbf7 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -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 + diff --git a/.github/workflows/docker/Dockerfile b/.github/workflows/docker/Dockerfile new file mode 100644 index 0000000..e8b0287 --- /dev/null +++ b/.github/workflows/docker/Dockerfile @@ -0,0 +1,7 @@ +FROM centos:8 + +RUN dnf install -y rpmdevtools dnf-utils make + +COPY * / + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/workflows/docker/action.yml b/.github/workflows/docker/action.yml new file mode 100644 index 0000000..17d151a --- /dev/null +++ b/.github/workflows/docker/action.yml @@ -0,0 +1,22 @@ +name: 'make' + +description: 'make ' + +inputs: + target: + description: 'make ' + required: true + default: '' + +outputs: + rpm_name: + description: 'rpm name' + srpm_name: + description: 'src.rpm name' + +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.target }} + diff --git a/.github/workflows/docker/entrypoint.sh b/.github/workflows/docker/entrypoint.sh new file mode 100755 index 0000000..96d7272 --- /dev/null +++ b/.github/workflows/docker/entrypoint.sh @@ -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 diff --git a/.github/workflows/tests-dev.yml b/.github/workflows/tests-dev.yml new file mode 100644 index 0000000..a32e7f1 --- /dev/null +++ b/.github/workflows/tests-dev.yml @@ -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' + diff --git a/.github/workflows/tests-master.yml b/.github/workflows/tests-master.yml new file mode 100644 index 0000000..b794d9e --- /dev/null +++ b/.github/workflows/tests-master.yml @@ -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' + diff --git a/Makefile b/Makefile index bb4459c..bde9238 100644 --- a/Makefile +++ b/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 \