Add an integration test with Docker

pull/40/head
Christopher Patton 2020-05-30 17:08:11 -07:00
parent 333658ce09
commit d9bdf1b813
2 changed files with 52 additions and 0 deletions

25
Dockerfile Normal file
View File

@ -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

27
integration-test.yml Normal file
View File

@ -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