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
name: Run operations on a rpm repo (from a Rocky Linux 8 system) | |
on: | |
push: | |
branches: [ devel ] | |
pull_request: | |
push: | |
branches: [ stable ] | |
jobs: | |
run-operations: | |
runs-on: ubuntu-latest | |
container: | |
image: rockylinux:8 | |
options: --user root | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Update system packages | |
run: | | |
dnf install epel-release -y | |
dnf update -y | |
- name: Install dependencies packages | |
run: dnf install yum-utils rpm-sign createrepo_c sudo findutils -y | |
- name: Setup PHP | |
run: | | |
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y | |
dnf module reset php -y | |
dnf module install php:remi-8.1 -y | |
dnf update -y | |
dnf install php -y | |
- name: Install PHP modules | |
run: dnf install php-cli php-pdo sqlite -y | |
- name: Print PHP version | |
run: php --version | |
- name: Set up repomanager files & directories | |
run: | | |
useradd www-data -s /usr/sbin/nologin | |
groupadd repomanager | |
usermod -a -G repomanager www-data | |
mkdir -p /home/repo | |
mkdir -p /var/www/repomanager | |
mkdir -p /var/lib/repomanager | |
mkdir -p /var/lib/repomanager/backups | |
mkdir -p /var/lib/repomanager/logs/main | |
mkdir -p /var/lib/repomanager/configurations | |
mkdir -p /var/lib/repomanager/operations/pool/ | |
mkdir -p /var/lib/repomanager/db | |
mkdir -p /var/lib/repomanager/.gnupg | |
cp -r $GITHUB_WORKSPACE/www/* /var/www/repomanager/ | |
cp $GITHUB_WORKSPACE/www/version /var/lib/repomanager/version.available | |
- name: Set up repomanager main config | |
run: | | |
curl -s -L -o /var/lib/repomanager/db/repomanager.db https://github.com/lbr38/resources/raw/main/ci/repomanager/repomanager.db 2> /dev/null | |
curl -s -L -o /var/lib/repomanager/db/repomanager-hosts.db https://github.com/lbr38/resources/raw/main/ci/repomanager/repomanager-hosts.db 2> /dev/null | |
ls -l /var/lib/repomanager/configurations/ | |
ls -l /var/lib/repomanager/db/ | |
- name: Download jobs | |
run: | | |
curl -s -o /var/lib/repomanager/operations/pool/ci-mirror-repo.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-mirror-repo.json 2> /dev/null | |
curl -s -o /var/lib/repomanager/operations/pool/ci-update-repo.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-update-repo.json 2> /dev/null | |
curl -s -o /var/lib/repomanager/operations/pool/ci-duplicate-repo.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-duplicate-repo.json 2> /dev/null | |
curl -s -o /var/lib/repomanager/operations/pool/ci-create-env.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-create-env.json 2> /dev/null | |
curl -s -o /var/lib/repomanager/operations/pool/ci-delete.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-delete.json 2> /dev/null | |
curl -s -o /var/lib/repomanager/operations/pool/ci-reconstruct.json https://raw.githubusercontent.com/lbr38/resources/main/ci/repomanager/operations/rpm/ci-reconstruct.json 2> /dev/null | |
- name: Check repomanager dependencies | |
run: sudo /var/www/repomanager/bin/repomanager -d --package-type rpm | |
- name: Set up permissions | |
run: sudo chown -R www-data:repomanager /var/www/repomanager /var/lib/repomanager /home/repo | |
- name: Update database | |
run: | | |
sudo -u www-data php /var/www/repomanager/tools/initialize-database.php | |
sudo -u www-data php /var/www/repomanager/tools/update-database.php | |
- name: Run job - Mirror repo | |
# run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-mirror-repo' || sleep 10; sudo cat /var/lib/repomanager/logs/main/lastlog.log; exit 1 | |
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-mirror-repo' | |
- name: Print mirrored repo content | |
run: ls -l /home/repo/nginx_pprd/ | |
- name: Run job - Update repo | |
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-update-repo' | |
- name: Run job - Duplicate repo | |
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-duplicate-repo' | |
- name: Print duplicated repo content | |
run: ls -l /home/repo/nginx-copy_pprd/ | |
- name: Run job - Create repo env | |
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-create-env' | |
- name: Run job - Reconstruct repo | |
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-reconstruct' | |
- name: Run job - Delete repo | |
run: sudo -u www-data php /var/www/repomanager/operations/execute.php --id='ci-delete' |