2025-01-04 13:23:29 +03:00
|
|
|
name: Build and Deploy
|
|
|
|
description: Build and deploy RPM packages
|
|
|
|
inputs:
|
|
|
|
PUBLICATOR:
|
|
|
|
description: Publicator token
|
|
|
|
required: true
|
|
|
|
CI_DEPLOY:
|
|
|
|
description: CI deploy token
|
|
|
|
required: true
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
run: |
|
|
|
|
git clone ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git ${GITHUB_WORKSPACE}
|
|
|
|
git checkout ${GITHUB_REF_NAME}
|
|
|
|
export SPECFILE=$(find . -type f -name "*.spec")
|
|
|
|
echo "SPECFILE=${SPECFILE}" > .env
|
|
|
|
source .env
|
|
|
|
echo "SPECFILE = ${SPECFILE}"
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-07 01:12:20 +03:00
|
|
|
# - name: Debug Print environment variables
|
|
|
|
# run: |
|
|
|
|
# source .env
|
|
|
|
# env
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-07 01:12:20 +03:00
|
|
|
# - name: Debug os version and check exists spec
|
|
|
|
# run: |
|
|
|
|
# cat /etc/*release*
|
|
|
|
# echo "check specfile" && [ -f ${SPECFILE} ] || exit 1
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-10 22:44:52 +03:00
|
|
|
- name: Remove all repo
|
2025-01-04 13:49:19 +03:00
|
|
|
run: |
|
2025-01-10 22:44:52 +03:00
|
|
|
# if grep -q "djam_personal" /etc/urpmi/urpmi.cfg; then sudo urpmi.removemedia djam_personal; fi
|
|
|
|
# Убираем все старые источники
|
|
|
|
sudo urpmi.removemedia -a
|
|
|
|
# Переключаемся на mirror.rosa.ru
|
|
|
|
# sudo urpmi.addmedia --wget -v --distrib --mirrorbrain https://mirror.rosa.ru/rosa/rosa2016.1/$ARCH
|
2025-01-11 18:01:15 +03:00
|
|
|
sudo urpmi.addmedia --distrib --mirrorlist https://tvoygit.ru/Djam/r11_mirrorlist/raw/branch/main/rosa2016.1.x86_64.list
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-10 22:44:52 +03:00
|
|
|
|
|
|
|
- name: Update repo and pre-install
|
2025-01-04 13:23:29 +03:00
|
|
|
run: |
|
|
|
|
sudo urpmi.update -fa
|
2025-01-07 01:48:02 +03:00
|
|
|
sudo urpmi --auto \
|
2025-01-11 18:01:15 +03:00
|
|
|
https://packages.buildkite.com/r11-team/r11-x86-64/files/branding-configs-r11-3.0-3-mdv.x86_64.rpm \
|
|
|
|
https://packages.buildkite.com/r11-team/r11-x86-64/files/branding-configs-common-3.0-3-mdv.x86_64.rpm
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-04 13:23:29 +03:00
|
|
|
- name: Download sources artifacts
|
|
|
|
run: |
|
2025-01-04 16:53:26 +03:00
|
|
|
abfyml=.abf.yml
|
|
|
|
if [ -e "${abfyml}" ]; then
|
|
|
|
echo "parsing file '${abfyml}'"
|
2025-01-15 18:16:39 +03:00
|
|
|
sed -ne '/^[Ss]ources\:.*$/,$p' ${abfyml} | \
|
|
|
|
sed -rn '$G;s/^[\"'\''[:space:]]*([^[:space:]:\"'\'']+)[\"'\''[:space:]]*.*[\"'\''[:space:]]*([0-9a-fA-F]{40})[\"'\''[:space:]]*$/\1 \2/p' | \
|
|
|
|
while read -r file sha; do
|
|
|
|
echo -n "found entry: file=${file} ... "
|
|
|
|
if [ -e "${file}" ]; then
|
|
|
|
if echo "${sha} ${file}" | sha1sum -c --status; then
|
|
|
|
echo "sha1sum correct"
|
|
|
|
else
|
|
|
|
echo "sha1sum INCORRECT! skipping..."
|
|
|
|
fi
|
2025-01-04 16:53:26 +03:00
|
|
|
else
|
2025-01-15 18:16:39 +03:00
|
|
|
echo -n "try to download... "
|
|
|
|
if curl -L "https://file-store.rosalinux.ru/download/${sha}" -o "${file}"; then
|
|
|
|
echo "ok"
|
|
|
|
echo -n "check sum... "
|
|
|
|
if echo "${sha} ${file}" | sha1sum -c --status; then
|
|
|
|
echo "ok"
|
|
|
|
else
|
|
|
|
echo "sha1sum INCORRECT! skipping..."
|
|
|
|
echo "remove file ${file}"
|
|
|
|
rm -f "${file}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "filed! skipping..."
|
|
|
|
fi
|
2025-01-04 16:53:26 +03:00
|
|
|
fi
|
2025-01-15 18:16:39 +03:00
|
|
|
done
|
2025-01-04 16:53:26 +03:00
|
|
|
fi
|
2025-01-12 02:57:56 +03:00
|
|
|
|
|
|
|
- name: Copy all source to rpm source dir
|
|
|
|
run: |
|
2025-01-12 03:02:04 +03:00
|
|
|
mkdir -p /home/builder/rpmbuild/SOURCES
|
2025-01-12 02:59:41 +03:00
|
|
|
cp -a * /home/builder/rpmbuild/SOURCES/
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-12 02:57:56 +03:00
|
|
|
- name: RPM linter
|
2025-01-04 13:23:29 +03:00
|
|
|
run: |
|
|
|
|
source .env
|
2025-01-15 17:37:17 +03:00
|
|
|
rpmlint --file /home/builder/rpmbuild/SOURCES/${{ github.event.repository.name }}.rpmlintrc ${SPECFILE}
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-15 18:16:39 +03:00
|
|
|
- name: Install dependencies
|
2025-01-04 13:23:29 +03:00
|
|
|
run: |
|
2025-01-15 18:16:39 +03:00
|
|
|
source .env
|
2025-01-11 15:57:55 +03:00
|
|
|
|
|
|
|
SPEC_FILE=${SPECFILE}
|
2025-01-10 22:24:18 +03:00
|
|
|
BASE_URL="https://packages.buildkite.com/r11-team/r11-x86-64/files/"
|
2025-01-11 15:57:55 +03:00
|
|
|
|
|
|
|
echo "Processing spec file: $SPECFILE"
|
|
|
|
echo "Base URL: $BASE_URL"
|
|
|
|
|
2025-01-10 22:24:18 +03:00
|
|
|
# Функция для установки зависимостей
|
2025-01-11 15:57:55 +03:00
|
|
|
install_dependencies() {
|
2025-01-11 16:24:33 +03:00
|
|
|
declare -a all_dependencies
|
2025-01-11 15:57:55 +03:00
|
|
|
|
2025-01-11 16:24:33 +03:00
|
|
|
while IFS= read -r line; do
|
2025-01-15 18:16:39 +03:00
|
|
|
if [[ $line =~ ^BuildRequires: ]]; then
|
|
|
|
normalized_line=$(echo "$line" | sed 's/[[:space:]]\+/ /g')
|
|
|
|
dependency=$(echo "$normalized_line" | cut -d ' ' -f2-)
|
|
|
|
|
|
|
|
echo "Processing line: $line"
|
|
|
|
echo "Normalized line: $normalized_line"
|
|
|
|
echo "Dependency: $dependency"
|
|
|
|
|
|
|
|
case "$dependency" in
|
|
|
|
*pkgconfig\(openssl3\.3\)*)
|
|
|
|
openssl_dependencies="openssl3.3-devel-3.3.1-2-R11.x86_64"
|
|
|
|
if [[ -n "$openssl_dependencies" ]]; then
|
|
|
|
echo "Found OpenSSL dependency: $openssl_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$openssl_dependencies.rpm")
|
|
|
|
all_dependencies+=("$BASE_URL/openssl3.3-3.3.1-2-R11.x86_64.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*llvm17*|*%{llvm}*|*%{llvmver}*|*%{llvm_ver}*)
|
|
|
|
llvm17_dependency="llvm17-17.0.1-1-rosa2016.1.x86_64"
|
|
|
|
if [[ -n "$llvm17_dependency" ]]; then
|
|
|
|
echo "Found LLVM17 dependency: $llvm17_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$llvm17_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*stdc++-gcc10-devel*)
|
|
|
|
gcc10_dependency="stdc++-gcc10-devel-10.2.1-1-rosa0.1.x86_64"
|
|
|
|
if [[ -n "$gcc10_dependency" ]]; then
|
|
|
|
echo "Found GCC10 dependency: $gcc10_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$gcc10_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*qt515*)
|
|
|
|
qt515_dependency="qt515-5.15.12-1-rosa2016.1.x86_64"
|
|
|
|
if [[ -n "$qt515_dependency" ]]; then
|
|
|
|
echo "Found Qt515 dependency: $qt515_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$qt515_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*cmake*)
|
|
|
|
cmake_dependency="cmake-3.20.0-1-mdv2016.1.x86_64"
|
|
|
|
if [[ -n "$cmake_dependency" ]]; then
|
|
|
|
echo "Found cmake: $cmake_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$cmake_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*trivy*)
|
|
|
|
trivy_dependency="trivy-0.58.2-1-rosa0.1.x86_64"
|
|
|
|
if [[ -n "$trivy_dependency" ]]; then
|
|
|
|
echo "Found trivy: $trivy_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$trivy_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*pkgconfig\(toxcore\)*)
|
|
|
|
toxcore_dependency="c-toxcore-0.2.18-1-rosa2016.1.x86_64"
|
|
|
|
if [[ -n "$toxcore_dependency" ]]; then
|
|
|
|
echo "Found toxcore: $toxcore_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$toxcore_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*goreleaser*)
|
|
|
|
goreleaser_dependency="goreleaser-1.8.3-1-rosa0.1.x86_64"
|
|
|
|
if [[ -n "$goreleaser_dependency" ]]; then
|
|
|
|
echo "Found goreleaser: $goreleaser_dependency"
|
|
|
|
all_dependencies+=("$BASE_URL/$goreleaser_dependency.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*go*|*golang*)
|
2025-01-20 02:16:26 +03:00
|
|
|
go_dependencies="golang-1.23.5-1-rosa0.1.x86_64"
|
2025-01-15 18:16:39 +03:00
|
|
|
if [[ -n "$go_dependencies" ]]; then
|
|
|
|
echo "Found Go dependency: $go_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$go_dependencies.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*pkgconfig\(libcares\)*)
|
|
|
|
cares_dependencies="lib64cares2-1.34.4-1-rosa0.1.x86_64"
|
|
|
|
if [[ -n "$cares_dependencies" ]]; then
|
|
|
|
echo "Found c-ares dependency: $cares_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$cares_dependencies.rpm")
|
|
|
|
all_dependencies+=("$BASE_URL/lib64cares-devel-1.34.4-1-rosa0.1.x86_64.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*scdoc*)
|
|
|
|
scdoc_dependencies="scdoc-1.11.3-1-rosa0.1.x86_64"
|
|
|
|
if [[ -n "$scdoc_dependencies" ]]; then
|
|
|
|
echo "Found scdoc dependency: $scdoc_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$scdoc_dependencies.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*lua-zlib*)
|
|
|
|
luazlib_dependencies="lua-zlib-1.2-1-rosa0.1.x86_64"
|
|
|
|
if [[ -n "$luazlib_dependencies" ]]; then
|
|
|
|
echo "Found sluazlib dependency: $luazlib_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$luazlib_dependencies.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*libxml2-utils*|*xml2-devel*|*libxml-2\.0*)
|
|
|
|
libxml2utils_dependencies="libxml2-utils-2.9.14-1-rosa2016.1.x86_64"
|
|
|
|
if [[ -n "$libxml2utils_dependencies" ]]; then
|
|
|
|
echo "Found slibxml2utils dependency: $libxml2utils_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$libxml2utils_dependencies.rpm")
|
|
|
|
all_dependencies+=("$BASE_URL/lib64xml2-devel-2.9.14-1-rosa2016.1.x86_64.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
2025-01-23 11:51:41 +03:00
|
|
|
*go-md2man*)
|
|
|
|
gomd2man_dependencies="go-md2man-2.0.2-1-rosa2016.1.x86_64"
|
|
|
|
if [[ -n "$gomd2man_dependencies" ]]; then
|
|
|
|
echo "Found sgomd2man dependency: $gomd2man_dependencies"
|
|
|
|
all_dependencies+=("$BASE_URL/$gomd2man_dependencies.rpm")
|
|
|
|
fi
|
|
|
|
;;
|
2025-01-15 18:16:39 +03:00
|
|
|
esac
|
|
|
|
|
|
|
|
echo "Current dependencies: ${all_dependencies[@]}"
|
|
|
|
fi
|
|
|
|
done < "$SPECFILE"
|
2025-01-11 15:57:55 +03:00
|
|
|
|
2025-01-15 18:16:39 +03:00
|
|
|
unique_dependencies=($(echo "${all_dependencies[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
|
|
|
|
echo "Unique dependencies: ${unique_dependencies[@]}"
|
2025-01-15 18:05:34 +03:00
|
|
|
|
2025-01-15 18:16:39 +03:00
|
|
|
if [[ ${#unique_dependencies[@]} -gt 0 ]]; then
|
|
|
|
echo "Installing all dependencies: ${unique_dependencies[@]}"
|
|
|
|
sudo urpmi --auto "${unique_dependencies[@]}"
|
|
|
|
else
|
|
|
|
echo "No dependencies found."
|
|
|
|
fi
|
|
|
|
}
|
2025-01-11 15:57:55 +03:00
|
|
|
|
2025-01-15 18:16:39 +03:00
|
|
|
install_dependencies
|
2025-01-04 13:23:29 +03:00
|
|
|
sudo urpmi --buildrequires --auto ${SPECFILE}
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-04 13:23:29 +03:00
|
|
|
- name: Build rpm
|
|
|
|
run: |
|
|
|
|
source .env
|
|
|
|
rpmbuild -ba ${SPECFILE}
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-05 13:41:28 +03:00
|
|
|
- name: Deploy in repos packages
|
|
|
|
if: github.ref == 'refs/heads/rosa2016.1'
|
|
|
|
env:
|
2025-01-06 17:16:25 +03:00
|
|
|
RPMBUILDROOT: /home/builder/rpmbuild
|
2025-01-05 13:41:28 +03:00
|
|
|
run: |
|
2025-01-06 17:57:23 +03:00
|
|
|
send_package() {
|
|
|
|
local file=$1
|
|
|
|
local arch=$2
|
|
|
|
local type=$3
|
|
|
|
|
|
|
|
if [ "$arch" = "noarch" ]; then
|
2025-01-06 18:47:14 +03:00
|
|
|
url="${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/r11_rpms/noarch/${file}"
|
2025-01-06 17:57:23 +03:00
|
|
|
else
|
2025-01-06 18:47:14 +03:00
|
|
|
url="${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/r11_rpms/${arch}/${file}"
|
2025-01-06 17:57:23 +03:00
|
|
|
fi
|
2025-01-06 17:16:25 +03:00
|
|
|
|
2025-01-06 17:57:23 +03:00
|
|
|
if [ "$type" = "srpm" ]; then
|
2025-01-06 18:47:14 +03:00
|
|
|
url="${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/r11_rpms/srpms/${file}"
|
2025-01-15 18:16:39 +03:00
|
|
|
fi
|
2025-01-06 18:47:14 +03:00
|
|
|
|
2025-01-15 18:16:39 +03:00
|
|
|
curl --user ${{ github.repository_owner }}:${{ inputs.CI_DEPLOY }} \
|
|
|
|
--upload-file "$file" \
|
|
|
|
"$url"
|
|
|
|
curl --user ${{ github.repository_owner }}:${{ inputs.CI_DEPLOY }} \
|
|
|
|
--upload-file "$file" \
|
|
|
|
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/${{ github.event.repository.name }}/rpm/${file}"
|
2025-01-06 17:57:23 +03:00
|
|
|
}
|
|
|
|
|
2025-01-06 19:02:04 +03:00
|
|
|
for dir in SRPMS RPMS/*; do
|
2025-01-06 17:57:23 +03:00
|
|
|
if [ -d "${RPMBUILDROOT}/${dir}" ]; then
|
|
|
|
for file in "${RPMBUILDROOT}/${dir}"/*.rpm; do
|
|
|
|
if [ -f "$file" ]; then
|
|
|
|
if [ "$dir" = "SRPMS" ]; then
|
2025-01-06 19:02:04 +03:00
|
|
|
arch="srpms"
|
2025-01-06 17:57:23 +03:00
|
|
|
type="srpm"
|
|
|
|
elif [ "$dir" = "noarch" ]; then
|
|
|
|
arch="noarch"
|
|
|
|
type="rpm"
|
|
|
|
else
|
|
|
|
arch=$(basename "${dir}")
|
|
|
|
type="rpm"
|
|
|
|
fi
|
2025-01-06 18:55:53 +03:00
|
|
|
echo "********************************************************"
|
|
|
|
echo "file: " "$file"
|
|
|
|
echo "arch: " "$arch"
|
|
|
|
echo "type: " "$type"
|
|
|
|
echo "********************************************************"
|
2025-01-15 18:16:39 +03:00
|
|
|
send_package "$file" "$arch" "$type"
|
2025-01-06 17:57:23 +03:00
|
|
|
fi
|
|
|
|
done
|
2025-01-06 17:16:25 +03:00
|
|
|
fi
|
2025-01-06 17:53:07 +03:00
|
|
|
done
|
2025-01-06 17:16:25 +03:00
|
|
|
|
2025-01-14 16:32:02 +03:00
|
|
|
- name: Deploy in buildkite
|
2025-01-04 23:39:08 +03:00
|
|
|
if: github.ref == 'refs/heads/rosa2016.1'
|
2025-01-04 13:23:29 +03:00
|
|
|
run: |
|
|
|
|
echo "Deploying src artifacts..."
|
2025-01-04 22:53:49 +03:00
|
|
|
for file in /home/builder/rpmbuild/SRPMS/*.rpm; do
|
2025-01-15 18:16:39 +03:00
|
|
|
curl -X POST https://api.buildkite.com/v2/packages/organizations/r11-team/registries/r11-srpms/packages \
|
|
|
|
-H "Authorization: Bearer ${{ inputs.PUBLICATOR }}" \
|
|
|
|
-F "file=@$file"
|
2025-01-14 16:34:24 +03:00
|
|
|
done
|
2025-01-04 15:53:01 +03:00
|
|
|
|
2025-01-14 16:34:24 +03:00
|
|
|
declare -A arch_urls=(
|
|
|
|
["x86_64"]="https://api.buildkite.com/v2/packages/organizations/r11-team/registries/r11-x86-64/packages"
|
|
|
|
["noarch"]="https://api.buildkite.com/v2/packages/organizations/r11-team/registries/r11-noarch/packages"
|
|
|
|
)
|
2025-01-14 16:32:02 +03:00
|
|
|
|
2025-01-14 16:34:24 +03:00
|
|
|
for arch in "${!arch_urls[@]}"; do
|
2025-01-15 18:16:39 +03:00
|
|
|
echo "Deploying rpm artifacts for $arch..."
|
2025-01-14 16:34:24 +03:00
|
|
|
for file in /home/builder/rpmbuild/RPMS/$arch/*.rpm; do
|
|
|
|
if [ -f "$file" ]; then
|
|
|
|
curl -X POST "${arch_urls[$arch]}" \
|
|
|
|
-H "Authorization: Bearer ${{ inputs.PUBLICATOR }}" \
|
|
|
|
-F "file=@$file"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2025-01-14 16:32:02 +03:00
|
|
|
|
2025-01-04 15:44:15 +03:00
|
|
|
container:
|
2025-01-20 02:16:26 +03:00
|
|
|
image: packages.buildkite.com/r11-team/r11/builder:latest
|