From d9bdf1b8133e55b4aa7cd21d048938e09dfd1fe5 Mon Sep 17 00:00:00 2001 From: Christopher Patton Date: Sat, 30 May 2020 17:08:11 -0700 Subject: [PATCH] Add an integration test with Docker --- Dockerfile | 25 +++++++++++++++++++++++++ integration-test.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Dockerfile create mode 100644 integration-test.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5f77256 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM archlinux:latest + +# Install dependencies. +ARG mirror_country=US +RUN curl "https://www.archlinux.org/mirrorlist/?country=$mirror_country&protocol=https&ip_version=4&use_mirror_status=on" \ + | sed --expression "s/^#//" \ + > /etc/pacman.d/mirrorlist \ + && pacman -Syyu --noconfirm --needed \ + && pacman -S --noconfirm --needed \ + ansible \ + base-devel \ + sudo + +# Create aur_builder user. +RUN useradd --create-home --group=wheel aur_builder \ + && echo 'aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman' \ + > /etc/sudoers.d/11-install-aur_builder \ + && visudo -c -f /etc/sudoers.d/11-install-aur_builder \ + && chmod 0644 /etc/sudoers.d/11-install-aur_builder + +# Run the playbook. +WORKDIR /opt +COPY library/ ./library/ +COPY integration-test.yml ./ +RUN ansible-playbook --module-path library integration-test.yml diff --git a/integration-test.yml b/integration-test.yml new file mode 100644 index 0000000..a4b86e5 --- /dev/null +++ b/integration-test.yml @@ -0,0 +1,27 @@ +--- + +- hosts: 127.0.0.1 + connection: local + tasks: + - name: Install yay using makepkg + aur: + name: yay + use: makepkg + become: yes + become_user: aur_builder + + - name: Upgrade AUR packages + aur: + upgrade: yes + use: yay + become: yes + become_user: aur_builder + + - name: Install pikaur using yay + aur: + name: pikaur + use: yay + use_args: + - --noprovides + become: yes + become_user: aur_builder