-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically build and publish development packages (deb/rpm) on mer…
…ge (#7) - Run tests - Build devel deb and rpm - publish to build.virtualmin.com via aptly (deb) and scp/ssh (rpm)
- Loading branch information
Showing
6 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "build-devel-deb" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: 'jailkit' | ||
|
||
- name: Install dependencies | ||
run: |- | ||
sudo apt-get -y update | ||
sudo apt-get -y install perl build-essential gnupg curl | ||
curl -O https://raw.githubusercontent.com/webmin/webmin/master/mod_def_list.txt | ||
curl -O https://raw.githubusercontent.com/webmin/webmin/master/makemoduledeb.pl | ||
- name: Build package | ||
env: | ||
APTLY_USER: ${{ secrets.APTLY_USER }} | ||
APTLY_PASSWD: ${{ secrets.APTLY_PASSWD }} | ||
run: |- | ||
jailkit/build-devel-deb.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "build-devel-rpm" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: 'jailkit' | ||
|
||
- name: Install dependencies | ||
run: |- | ||
sudo apt-get -y update | ||
sudo apt-get -y install rpm perl build-essential gnupg curl | ||
curl -O https://raw.githubusercontent.com/webmin/webmin/master/mod_def_list.txt | ||
curl -O https://raw.githubusercontent.com/webmin/webmin/master/makemodulerpm.pl | ||
- name: Setup ssh | ||
env: | ||
BUILD_SSH_PRIVATE_KEY: ${{ secrets.BUILD_SSH_PRIVATE_KEY }} | ||
BUILD_SSH_KNOWN_HOSTS: ${{ secrets.BUILD_SSH_KNOWN_HOSTS }} | ||
run: |- | ||
install -m 600 -D /dev/null ~/.ssh/id_ed25519 | ||
echo "${{ secrets.BUILD_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||
echo "${{ secrets.BUILD_SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | ||
- name: Build package | ||
env: | ||
BUILD_SSH_USER: ${{ secrets.BUILD_SSH_USER }} | ||
run: |- | ||
jailkit/build-devel-rpm.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "run-tests" | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: 'jailkit' | ||
|
||
- name: Install dependencies | ||
run: |- | ||
sudo apt-get -y update | ||
sudo apt-get -y install perl libconfig-inifiles-perl libtest-strict-perl | ||
- name: Run tests | ||
run: |- | ||
cd jailkit | ||
prove |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# Build and publish a package, called by github actions | ||
|
||
# echo, exit on error/undefined vars | ||
set -xeu | ||
|
||
MOD='jailkit' | ||
NAME="webmin-$MOD" | ||
|
||
# Always increasing. Also a human-readable datetime. | ||
BUILD=$(date +'%Y%m%d%H%M') | ||
|
||
# Load module.info to get version | ||
version=$(grep version $MOD/module.info | cut -d'=' -f2) | ||
VERSION="${version}.devel.${BUILD}" | ||
|
||
mkdir tmp | ||
perl makemoduledeb.pl --deb-depends --licence 'GPLv3' --email '[email protected]' --allow-overwrite --target-dir tmp "$MOD" "$VERSION" | ||
mv "tmp/${NAME}_${VERSION}_all.deb" . | ||
|
||
# Publish to aptly | ||
curl --user $APTLY_USER:$APTLY_PASSWD -X POST -F file=@${NAME}_${VERSION}_all.deb https://aptly.virtualmin.com/api/files/${NAME}_${VERSION} | ||
curl --user $APTLY_USER:$APTLY_PASSWD -X POST https://aptly.virtualmin.com/api/repos/virtualmin-7-gpl-devel/file/${NAME}_${VERSION} | ||
curl -i --user $APTLY_USER:$APTLY_PASSWD -X PUT -H 'Content-Type: application/json' --data '{}' https://aptly.virtualmin.com/api/publish/filesystem:7-gpl:./virtualmin-devel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# Build and publish a package, called by github actions | ||
|
||
# echo, exit on error/undefined vars | ||
set -xeu | ||
|
||
MOD='jailkit' | ||
NAME="wbm-$MOD" | ||
|
||
# Always increasing. Also a human-readable datetime. | ||
BUILD=$(date +'%Y%m%d%H%M') | ||
|
||
# Load module.info to get version | ||
version=$(grep version $MOD/module.info | cut -d'=' -f2) | ||
VERSION="${version}.devel.${BUILD}" | ||
|
||
if [ -f epoch ]; then | ||
epoch="--epoch $(cat epoch)" | ||
else | ||
epoch="" | ||
fi | ||
|
||
# FIXME after PR is merged to Webmin | ||
mkdir -p ${HOME}/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} | ||
mkdir -p "${HOME}/rpmbuild/RPMS/noarch" | ||
ls "${HOME}/rpmbuild/RPMS/noarch" | ||
ls "${HOME}/rpmbuild/SOURCES" | ||
ls "${HOME}/rpmbuild/SPECS" | ||
perl makemodulerpm.pl --rpm-depends --licence 'GPLv3' --allow-overwrite $epoch "$MOD" "$VERSION" | ||
|
||
# Copy to build/deploy server | ||
scp -i "${HOME}/.ssh/id_ed25519" "${HOME}/rpmbuild/RPMS/noarch/${NAME}-${VERSION}-1.noarch.rpm" "$BUILD_SSH_USER@build.virtualmin.com:/home/build/result/vm/7/gpl-devel/rpm/noarch" | ||
# Add it to the publish queue | ||
ssh -i "${HOME}/.ssh/id_ed25519" "$BUILD_SSH_USER@build.virtualmin.com" "flock /home/build/rpm-publish-queue.lock echo 'vm/7/gpl-devel/rpm/noarch' >> /home/build/rpm-publish-queue" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters