CI: Improve/fix tests, build & publish config
All checks were successful
Run tests / test-precommit (push) Successful in 3m52s
All checks were successful
Run tests / test-precommit (push) Successful in 3m52s
This commit is contained in:
parent
27a7385bed
commit
6c34da2068
3 changed files with 45 additions and 34 deletions
|
@ -30,6 +30,8 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: docker.io/brenard/debian-python-deb:latest
|
image: docker.io/brenard/debian-python-deb:latest
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: Download Debian package files
|
- name: Download Debian package files
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
@ -42,15 +44,18 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir release
|
mkdir release
|
||||||
mv *.deb release/
|
mv *.deb release/
|
||||||
mv check-forgejo-upgrade-*/check_forgejo_upgrade release/
|
mv check-*/check_* release/
|
||||||
|
md5sum release/* > md5sum.txt
|
||||||
|
sha512sum release/* > sha512sum.txt
|
||||||
|
mv md5sum.txt sha512sum.txt release/
|
||||||
{
|
{
|
||||||
echo 'release_note<<EOF'
|
echo 'release_note<<EOF'
|
||||||
cat release_notes.md
|
cat release_notes.md | sed 's/"/\\"/g'
|
||||||
echo 'EOF'
|
echo 'EOF'
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Publish release on Forgejo
|
- name: Publish release on Forgejo
|
||||||
uses: actions/forgejo-release@v1
|
uses: actions/forgejo-release@v2
|
||||||
with:
|
with:
|
||||||
direction: upload
|
direction: upload
|
||||||
url: https://gitea.zionetrix.net
|
url: https://gitea.zionetrix.net
|
||||||
|
@ -62,6 +67,8 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: docker.io/brenard/aptly-publish:latest
|
image: docker.io/brenard/aptly-publish:latest
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: "Download Debian package files"
|
- name: "Download Debian package files"
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
|
|
@ -32,22 +32,22 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
args:
|
args:
|
||||||
- --ignore-words-list=fro,hass
|
- --ignore-words-list=exten
|
||||||
- --skip="./.*,*.csv,*.json,*.ambr"
|
- --skip="./.*,*.csv,*.json,*.ini,*.subject,*.txt,*.html,*.log,*.conf"
|
||||||
- --quiet-level=2
|
- --quiet-level=2
|
||||||
- --ignore-regex=.*codespell-ignore$
|
- --ignore-regex=.*codespell-ignore$
|
||||||
# - --write-changes # Uncomment to write changes
|
# - --write-changes # Uncomment to write changes
|
||||||
exclude_types: [csv, json]
|
exclude_types: [csv, json]
|
||||||
- repo: https://github.com/adrienverge/yamllint
|
|
||||||
rev: v1.32.0
|
|
||||||
hooks:
|
|
||||||
- id: yamllint
|
|
||||||
args: ["-d {extends: relaxed, rules: {line-length: disable}}", "-s"]
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
rev: v2.7.1
|
rev: v2.7.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
args: ["--print-width", "100"]
|
args: ["--print-width", "100"]
|
||||||
|
- repo: https://github.com/adrienverge/yamllint
|
||||||
|
rev: v1.32.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
ignore: .github/
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
|
@ -61,10 +61,13 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: bandit
|
- id: bandit
|
||||||
args: [--skip, "B101", --recursive]
|
args: [--skip, "B101", --recursive]
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-executables-have-shebangs
|
- id: check-executables-have-shebangs
|
||||||
stages: [manual]
|
stages: [manual]
|
||||||
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||||
|
rev: v0.10.0.1
|
||||||
|
hooks:
|
||||||
|
- id: shellcheck
|
||||||
minimum_pre_commit_version: 3.2.0
|
minimum_pre_commit_version: 3.2.0
|
||||||
|
|
45
build.sh
45
build.sh
|
@ -1,10 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
QUIET_ARG=""
|
QUIET_ARG=""
|
||||||
[ "$1" == "--quiet" ] && QUIET_ARG="--quiet"
|
[[ "$1" == "--quiet" ]] && QUIET_ARG="--quiet"
|
||||||
|
|
||||||
# Enter source directory
|
# Enter source directory
|
||||||
cd $( dirname $0 )
|
cd "$( dirname "$0" )" || exit
|
||||||
|
|
||||||
|
CHECK_FILE="$( find "." -name 'check_*' ! -name '*~' -type f -executable | head -n 1 )"
|
||||||
|
PACKAGE_NAME="$( basename "$CHECK_FILE" | tr '_' '-' )"
|
||||||
|
|
||||||
echo "Clean previous build..."
|
echo "Clean previous build..."
|
||||||
rm -fr dist
|
rm -fr dist
|
||||||
|
@ -13,17 +16,17 @@ echo "Detect version using git describe..."
|
||||||
VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )"
|
VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )"
|
||||||
|
|
||||||
echo "Create building environemt..."
|
echo "Create building environemt..."
|
||||||
BDIR=dist/check-forgejo-upgrade-$VERSION
|
BDIR="dist/$PACKAGE_NAME-$VERSION"
|
||||||
mkdir -p $BDIR
|
mkdir -p "$BDIR"
|
||||||
[ -z "$QUIET_ARG" ] && RSYNC_ARG="-v" || RSYNC_ARG=""
|
RSYNC_ARG=""
|
||||||
rsync -a $RSYNC_ARG debian/ $BDIR/debian/
|
[[ -z "$QUIET_ARG" ]] && RSYNC_ARG="-v"
|
||||||
cp check_forgejo_upgrade $BDIR/
|
rsync -a "$RSYNC_ARG" debian/ "$BDIR/debian/"
|
||||||
|
cp "$CHECK_FILE" "$BDIR/"
|
||||||
|
|
||||||
echo "Set VERSION=$VERSION in gitdch using sed..."
|
echo "Set VERSION=$VERSION in gitdch using sed..."
|
||||||
sed -i "s/^VERSION *=.*$/VERSION = '$VERSION'/" $BDIR/check_forgejo_upgrade
|
sed -i "s/^VERSION *=.*$/VERSION = '$VERSION'/" "$BDIR/$( basename "$CHECK_FILE" )"
|
||||||
|
|
||||||
if [ -z "$DEBIAN_CODENAME" ]
|
if [[ -z "$DEBIAN_CODENAME" ]]; then
|
||||||
then
|
|
||||||
echo "Retrieve debian codename using lsb_release..."
|
echo "Retrieve debian codename using lsb_release..."
|
||||||
DEBIAN_CODENAME=$( lsb_release -c -s )
|
DEBIAN_CODENAME=$( lsb_release -c -s )
|
||||||
else
|
else
|
||||||
|
@ -32,31 +35,29 @@ fi
|
||||||
|
|
||||||
echo "Generate debian changelog using gitdch..."
|
echo "Generate debian changelog using gitdch..."
|
||||||
GITDCH_ARGS=('--verbose')
|
GITDCH_ARGS=('--verbose')
|
||||||
[ -n "$QUIET_ARG" ] && GITDCH_ARGS=('--warning')
|
[[ -n "$QUIET_ARG" ]] && GITDCH_ARGS=('--warning')
|
||||||
if [ -n "$MAINTAINER_NAME" ]
|
if [[ -n "$MAINTAINER_NAME" ]]; then
|
||||||
then
|
|
||||||
echo "Use maintainer name from environment ($MAINTAINER_NAME)"
|
echo "Use maintainer name from environment ($MAINTAINER_NAME)"
|
||||||
GITDCH_ARGS+=("--maintainer-name" "${MAINTAINER_NAME}")
|
GITDCH_ARGS+=("--maintainer-name" "${MAINTAINER_NAME}")
|
||||||
fi
|
fi
|
||||||
if [ -n "$MAINTAINER_EMAIL" ]
|
if [[ -n "$MAINTAINER_EMAIL" ]]; then
|
||||||
then
|
|
||||||
echo "Use maintainer email from environment ($MAINTAINER_EMAIL)"
|
echo "Use maintainer email from environment ($MAINTAINER_EMAIL)"
|
||||||
GITDCH_ARGS+=("--maintainer-email" "$MAINTAINER_EMAIL")
|
GITDCH_ARGS+=("--maintainer-email" "$MAINTAINER_EMAIL")
|
||||||
fi
|
fi
|
||||||
gitdch \
|
gitdch \
|
||||||
--package-name check-forgejo-upgrade \
|
--package-name "$PACKAGE_NAME" \
|
||||||
--version "${VERSION}" \
|
--version "${VERSION}" \
|
||||||
--code-name $DEBIAN_CODENAME \
|
--code-name "$DEBIAN_CODENAME" \
|
||||||
--output $BDIR/debian/changelog \
|
--output "$BDIR"/debian/changelog \
|
||||||
--release-notes dist/release_notes.md \
|
--release-notes dist/release_notes.md \
|
||||||
"${GITDCH_ARGS[@]}"
|
"${GITDCH_ARGS[@]}"
|
||||||
|
|
||||||
if [ -n "$MAINTAINER_NAME" -a -n "$MAINTAINER_EMAIL" ]
|
if [[ -n "$MAINTAINER_NAME" ]] && [[ -n "$MAINTAINER_EMAIL" ]]; then
|
||||||
then
|
|
||||||
echo "Set Maintainer field in debian control file ($MAINTAINER_NAME <$MAINTAINER_EMAIL>)..."
|
echo "Set Maintainer field in debian control file ($MAINTAINER_NAME <$MAINTAINER_EMAIL>)..."
|
||||||
sed -i "s/^Maintainer: .*$/Maintainer: $MAINTAINER_NAME <$MAINTAINER_EMAIL>/" $BDIR/debian/control
|
sed -i "s/^Maintainer: .*$/Maintainer: $MAINTAINER_NAME <$MAINTAINER_EMAIL>/" \
|
||||||
|
"$BDIR"/debian/control
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Build debian package..."
|
echo "Build debian package..."
|
||||||
cd $BDIR
|
cd "$BDIR" || exit
|
||||||
dpkg-buildpackage
|
dpkg-buildpackage
|
||||||
|
|
Loading…
Reference in a new issue