mirror of
https://tvoygit.ru/Djam/r11_workflows.git
synced 2025-02-23 08:52:46 +00:00
add ci
This commit is contained in:
parent
e9940b596c
commit
1361b77f40
3 changed files with 135 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.*~
|
||||||
|
*~
|
||||||
|
.env
|
93
ci.yml
Normal file
93
ci.yml
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
name: CI/CD Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- rosa2016.1
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- rosa2016.1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: r11_builder
|
||||||
|
env:
|
||||||
|
PUBLICATOR: ${{ secrets.PUBLICATOR }}
|
||||||
|
CI_DEPLOY: ${{ secrets.CI_DEPLOY }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# - uses: actions/checkout@v3
|
||||||
|
# with:
|
||||||
|
# fetch-depth: 0
|
||||||
|
|
||||||
|
- name: git fetch
|
||||||
|
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}"
|
||||||
|
|
||||||
|
- name: _Debug Print environment variables
|
||||||
|
run: |
|
||||||
|
source .env
|
||||||
|
env
|
||||||
|
|
||||||
|
- name: _Debug Current directory and files
|
||||||
|
run: |
|
||||||
|
cat /etc/*release*
|
||||||
|
echo "check specfile" && [ -f ${SPECFILE} ] || exit 1
|
||||||
|
|
||||||
|
- name: Remove djam_personal repo
|
||||||
|
run: sudo urpmi.removemedia djam_personal
|
||||||
|
|
||||||
|
- name: Update repo
|
||||||
|
run: |
|
||||||
|
sudo urpmi.update -fa
|
||||||
|
|
||||||
|
# - name: Set up locale
|
||||||
|
# run: |
|
||||||
|
# export LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
- name: Download sources artifacts
|
||||||
|
run: |
|
||||||
|
.gitea/workflows/download_sources.sh
|
||||||
|
|
||||||
|
- name: Linter
|
||||||
|
run: |
|
||||||
|
source .env
|
||||||
|
rpmlint ${SPECFILE}
|
||||||
|
|
||||||
|
- name: Install dependies
|
||||||
|
run: |
|
||||||
|
source .env
|
||||||
|
sudo urpmi --buildrequires --auto ${SPECFILE}
|
||||||
|
|
||||||
|
- name: Build rpm
|
||||||
|
run: |
|
||||||
|
source .env
|
||||||
|
rpmbuild -ba ${SPECFILE}
|
||||||
|
|
||||||
|
- name: Deploy in repos packages
|
||||||
|
# if: github.ref == 'refs/heads/rosa2016'
|
||||||
|
run: |
|
||||||
|
echo "Deploying artifacts..."
|
||||||
|
curl --user ${GITHUB_REPOSITORY_OWNER}:${CI_DEPLOY} \
|
||||||
|
--upload-file /home/builder/rpmbuild/SRPMS/*.rpm \
|
||||||
|
--upload-file /home/builder/rpmbuild/RPMS/x86_64/*.rpm \
|
||||||
|
${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/rpm/r11/upload
|
||||||
|
|
||||||
|
- name: Deploy in buildkitie
|
||||||
|
run: |
|
||||||
|
echo "Deploying src artifacts..."
|
||||||
|
curl -X POST https://api.buildkite.com/v2/packages/organizations/r11-team/registries/r11-srpms/packages \
|
||||||
|
-H "Authorization: Bearer ${PUBLICATOR}" \
|
||||||
|
-F "file=@/home/builder/rpmbuild/SRPMS/*.src.rpm"
|
||||||
|
echo "Deploying rpm artifacts..."
|
||||||
|
curl -X POST https://api.buildkite.com/v2/packages/organizations/r11-team/registries/r11-x86-64/packages \
|
||||||
|
-H "Authorization: Bearer ${PUBLICATOR}" \
|
||||||
|
-F "file=@/home/builder/rpmbuild/RPMS/x86_64/*.x86_64.rpm"
|
||||||
|
|
||||||
|
|
||||||
|
|
39
download_sources.sh
Executable file
39
download_sources.sh
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
do_restore() {
|
||||||
|
abfyml=.abf.yml
|
||||||
|
|
||||||
|
local file sha
|
||||||
|
if [ -e "${abfyml}" ]; then
|
||||||
|
echo "parsing file '${abfyml}'"
|
||||||
|
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
|
||||||
|
else
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
do_restore
|
Loading…
Add table
Reference in a new issue