Skip to content

SilKit Packaging Workflow #119

SilKit Packaging Workflow

SilKit Packaging Workflow #119

Workflow file for this run

name: "SilKit Packaging Workflow"
on:
workflow_dispatch:
inputs:
silkit_source_repo:
description: 'URL to the sil-kit repository in the form namespace/repo.git'
required: true
type: string
silkit_source_ref:
description: 'Commit ref of the repo with the SIL Kit packaging sources. Choose carefully'
required: false
type: string
default: 'main'
silkit_pkg_ref:
description: 'sil-kit-pkg ref used/created for a release'
required: false
type: string
debian_fullname:
description: 'Name of the maintainer creating the current package'
required: true
type: string
debian_email:
description: 'Email of the maintainer creating the current package'
required: true
type: string
debian_arch:
description: 'Ubuntu CPU arch the package should be build for'
required: true
default: 'amd64'
type: string
env:
PKG_WORKDIR: _i
PKG_OUTDIR: _o
jobs:
package_ubuntu:
runs-on: ubuntu-latest
name: Job to build .deb for Ubuntu 20.04+ packages
container:
image: ghcr.io/vectorgrp/sil-kit-docker-build/sil-kit-ci-packaging-ubuntu-20.04:main
env:
ARTIFACT_NAME: silkit-ubuntu-20.04-deb
steps:
- name: Checkout (sil-kit-pkg)
uses: actions/checkout@v4
with:
path: sil-kit-pkg
- name: Checkout (sil-kit)
uses: actions/checkout@v4
with:
repository: ${{ inputs.silkit_source_repo }}
submodules: recursive
path: sil-kit
ref: ${{ inputs.silkit_source_ref }}
github-server-url: https://github.com
- name: Install cmake
run: |
sh sil-kit-pkg/.github/actions/fetch_cmake.sh
- name: Build
id: build
env:
DEBFULLNAME: ${{ inputs.debian_fullname }}
DEBEMAIL: ${{ inputs.debian_fullname }}
CI_RUN: "1"
BUILD_SETTINGS: |
{
"SilKitInfo": {
"url": "sil-kit",
"ref": "",
"recursive": true,
"is_local": true
},
"package_repo_path": "sil-kit-pkg",
"version": {
"major": 4,
"minor": 0,
"patch": 54,
"suffix": "-1"
},
"pkgformat": "deb",
"work_dir": "${{ env.PKG_WORKDIR }}",
"keep_temp": true,
"output_dir": "${{ env.PKG_OUTDIR }}",
"platform": "Ubuntu-20.04"
}
run: |
mkdir -p $PKG_WORKDIR
mkdir -p $PKG_OUTDIR
touch $PKG_WORKDIR/build_cfg.json
printf %s $BUILD_SETTINGS > $PKG_WORKDIR/build_cfg.json
python3 sil-kit-pkg/scripts/silkit_linux_packaging.py \
--build-cfg $PKG_WORKDIR/build_cfg.json \
--verbose
- name: Test Package
id: test
env:
PKG_DIR: ./${{ env.PKG_OUTDIR }}
TEST_DIR: ./sil-kit-pkg/tests/
run: |
python3 sil-kit-pkg/tests/test_deb.py \
--package-directory "$PKG_DIR" \
--test-directory "$TEST_DIR" \
--distro ubuntu
- name: Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: |
./${{ env.PKG_OUTDIR }}/*.dsc
./${{ env.PKG_OUTDIR }}/*.build*
./${{ env.PKG_OUTDIR }}/*.changes
./${{ env.PKG_OUTDIR }}/*.*deb
retention-days: 1
- name: Prepare artifact
if: inputs.silkit_pkg_ref != ''
run: |
cd $PKG_OUTDIR
zip -j ${{ env.ARTIFACT_NAME }}.zip ./*.dsc ./*.build* ./*.changes ./*.*deb
sha256sum ./${{ env.ARTIFACT_NAME }}.zip > ./SHA256
- name: Create git tag
if: inputs.silkit_pkg_ref != ''
uses: actions/github-script@v7
with:
script: |
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ inputs.silkit_pkg_ref }}',
sha: context.sha,
})
} catch(error) {
core.warning("Could not create the specified ref, continuing without it!")
}
- name: Release artifact
if: inputs.silkit_pkg_ref != ''
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ contains(inputs.silkit_pkg_ref, '-rc') }}
draft: false
tag_name: ${{ inputs.silkit_pkg_ref }}
name: ${{ inputs.silkit_pkg_ref }}
files: |
${{ env.PKG_OUTDIR }}/${{ env.ARTIFACT_NAME }}.zip
${{ env.PKG_OUTDIR }}/SHA256
package_almalinux:
runs-on: ubuntu-latest
name: Job to build Alma Linux 9 packages
container:
image: ghcr.io/vectorgrp/sil-kit-docker-build/sil-kit-ci-packaging-fedora-40:main
options: --privileged
env:
ARTIFACT_NAME: silkit-almalinux-9-rpm
steps:
- name: Checkout (sil-kit-pkg)
uses: actions/checkout@v4
with:
path: sil-kit-pkg
- name: Checkout (sil-kit)
uses: actions/checkout@v4
with:
repository: ${{ inputs.silkit_source_repo }}
submodules: recursive
path: libsilkit4-4.0.54
ref: ${{ inputs.silkit_source_ref }}
github-server-url: https://github.com
- name: Build
id: build
env:
CI_RUN: "1"
BUILD_SETTINGS: |
{
"SilKitInfo": {
"url": "libsilkit4-4.0.54",
"ref": "",
"recursive": true,
"is_local": true
},
"package_repo_path": "sil-kit-pkg",
"version": {
"major": 4,
"minor": 0,
"patch": 54,
"suffix": ""
},
"pkgformat": "rpm",
"work_dir": "${{ env.PKG_WORKDIR }}",
"keep_temp": true,
"output_dir": "${{ env.PKG_OUTDIR }}",
"platform": "epel9"
}
run: |
mkdir -p $PKG_WORKDIR
mkdir -p $PKG_OUTDIR
touch $PKG_WORKDIR/build_cfg.json
printf %s $BUILD_SETTINGS > $PKG_WORKDIR/build_cfg.json
python3 sil-kit-pkg/scripts/silkit_linux_packaging.py \
--build-cfg $PKG_WORKDIR/build_cfg.json \
--verbose
- name: Test Package
id: test
env:
PKG_DIR: ./${{ env.PKG_OUTDIR }}
TEST_DIR: ./sil-kit-pkg/tests
run: |
dnf install cmake clang
python3 sil-kit-pkg/tests/test_deb.py \
--package-directory "$PKG_DIR" \
--test-directory "$TEST_DIR" \
--distro fedora
- name: Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: |
./${{ env.PKG_OUTDIR }}/*.rpm
retention-days: 1
- name: Prepare artifact
if: inputs.silkit_pkg_ref != ''
run: |
cd $PKG_OUTDIR
zip -j ${{ env.ARTIFACT_NAME }}-el9.zip ./*.rpm
sha256sum ./${{ env.ARTIFACT_NAME }}-el9.zip > ./SHA256
- name: Create git tag
if: inputs.silkit_pkg_ref != ''
uses: actions/github-script@v7
with:
script: |
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ inputs.silkit_pkg_ref }}',
sha: context.sha,
})
} catch(error) {
core.warning("Could not create the specified ref, continuing without it!")
}
- name: Release artifact
if: inputs.silkit_pkg_ref != ''
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ contains(inputs.silkit_pkg_ref, '-rc') }}
draft: false
tag_name: ${{ inputs.silkit_pkg_ref }}
name: ${{ inputs.silkit_pkg_ref }}
files: |
${{ env.PKG_OUTDIR }}/${{ env.ARTIFACT_NAME }}.zip
${{ env.PKG_OUTDIR }}/SHA256