From c8e8557803f3e335eff33009329e0b5b8e464a15 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 20 Jan 2025 11:13:54 +0100 Subject: [PATCH] ci: add openSUSE Tumbleweed Add an ansible task for openSUSE which will use the configure options used by the official openSUSE package. Signed-off-by: Michael Vetter --- .github/workflows/runner.yml | 2 +- share/ansible/playbook.yml | 1 + share/ansible/roles/ci_run/tasks/opensuse.yml | 91 +++++++++++++++++++ share/container-build.sh | 1 + 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 share/ansible/roles/ci_run/tasks/opensuse.yml diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index ac6440d22..18fca18e7 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -71,7 +71,7 @@ jobs: strategy: fail-fast: false matrix: - os: [alpine, debian, fedora] + os: [alpine, debian, fedora, opensuse] steps: - uses: actions/setup-python@v5 diff --git a/share/ansible/playbook.yml b/share/ansible/playbook.yml index 06fb6e48f..86d1afd8b 100644 --- a/share/ansible/playbook.yml +++ b/share/ansible/playbook.yml @@ -5,6 +5,7 @@ fedora: registry.fedoraproject.org/fedora:latest alpine: docker.io/library/alpine:latest debian: docker.io/library/debian:latest + opensuse: docker.io/opensuse/tumbleweed:latest roles: - role: build_container diff --git a/share/ansible/roles/ci_run/tasks/opensuse.yml b/share/ansible/roles/ci_run/tasks/opensuse.yml new file mode 100644 index 000000000..ab16580f8 --- /dev/null +++ b/share/ansible/roles/ci_run/tasks/opensuse.yml @@ -0,0 +1,91 @@ +--- +# tasks file for ci_run +- name: Ensure python is installed + ansible.builtin.raw: zypper --non-interactive in python3 + +- name: Ensure dependencies are installed + community.general.zypper: + name: + - autoconf + - automake + - byacc + - diffutils + - gawk + - gcc + - gettext-tools + - intltool + - libcmocka-devel + - libtool + - libxslt-tools + - make + - systemd-devel + state: present + +# Needed to use `zypper si` +- name: Enable all repos + ansible.builtin.command: + zypper --non-interactive mr -ea + +- name: Ensure build dependencies are installed + ansible.builtin.command: + zypper --non-interactive si -d shadow + register: zypper_result + changed_when: '"Nothing to do" not in zypper_result.stdout' + +- name: Build configuration + ansible.builtin.command: > + ./autogen.sh + --enable-account-tools-setuid + --enable-shadowgrp + --with-acl + --with-attr + --with-audit + --with-group-name-max-length=32 + --with-libpam + --with-nscd + --with-selinux + --with-sha-crypt + --without-libbsd + --without-libcrack + --without-sssd + args: + chdir: /usr/local/src/shadow/ + ignore_errors: true + +- name: Build + ansible.builtin.shell: + make -Orecurse -j4 > build.log + args: + chdir: /usr/local/src/shadow/ + ignore_errors: true + +- name: Run unit-tests + ansible.builtin.command: + make check + args: + chdir: /usr/local/src/shadow/ + ignore_errors: true + +- name: Install + ansible.builtin.command: + make install + args: + chdir: /usr/local/src/shadow/ + ignore_errors: true + +- name: Copy logs + ansible.builtin.fetch: + src: '{{ item }}' + dest: ./build-out/ + flat: yes + with_items: + - "/usr/local/src/shadow/config.log" + - "/usr/local/src/shadow/config.h" + - "/usr/local/src/shadow/build.log" + - "/usr/local/src/shadow/tests/unit/test-suite.log" + +- name: Copy configuration file for testing + ansible.builtin.copy: + src: /usr/local/src/shadow/tests/system/etc/login.defs + dest: /etc/login.defs + remote_src: yes diff --git a/share/container-build.sh b/share/container-build.sh index 0116c17d3..a0d81ecce 100755 --- a/share/container-build.sh +++ b/share/container-build.sh @@ -12,3 +12,4 @@ cd share/ansible/ ansible-playbook playbook.yml -i inventory.ini -e 'distribution=alpine' ansible-playbook playbook.yml -i inventory.ini -e 'distribution=debian' ansible-playbook playbook.yml -i inventory.ini -e 'distribution=fedora' +ansible-playbook playbook.yml -i inventory.ini -e 'distribution=opensuse'