Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CI to GitHub Actions #235

Merged
merged 38 commits into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
90b1817
[CI] GitHub Action tests
sfgeorge Mar 6, 2022
4da22da
[DOC] Switch build badge to read from the GitHub Action
sfgeorge Mar 8, 2022
3246f29
[CI] Basic test setup
sfgeorge Mar 13, 2022
89645d5
[CI] Remove Travis-CI config
sfgeorge Mar 13, 2022
152c920
[CI] Fix CentOS 6 build by using vault.centos.org
sfgeorge Mar 16, 2022
9f42158
[CI] Add testing and support for Debian 11 and Ubuntu 21.10 & 22.04
sfgeorge Mar 16, 2022
d802707
[CI] Fixes for launching Ubuntu 21 & 22
sfgeorge Mar 16, 2022
077276f
[CI] Add CentOS Stream 8
sfgeorge Mar 16, 2022
ae249e0
[CI] Fix CentOS 8 build by using vault.centos.org
sfgeorge Mar 16, 2022
afd13c8
[CI] Explicitly shut down containers
sfgeorge Mar 18, 2022
577a09f
[CI] Start with a 2 minute timeout for CentOS 6
sfgeorge Mar 20, 2022
599ddd1
[CI] Fix reference to matrix context
sfgeorge Mar 21, 2022
8019d2d
[CI] Add Docker Image Caching
sfgeorge Mar 22, 2022
e35a190
[CI] Add Docker Image Caching: Fix
sfgeorge Mar 22, 2022
c792a66
[CI] Rename the task that runs the test
sfgeorge Mar 22, 2022
fcdda1b
[CI] Set a 29 minute timeout for CentOS 6 to avoid early shutdown
sfgeorge Mar 22, 2022
dbcf88a
[CI] Centos Stream 8: Ensure ps is installed to avoid 'command not fo…
sfgeorge Mar 22, 2022
297d97f
[CI] Ubuntu 21: Install dirmngr to avoid gpg error
sfgeorge Mar 22, 2022
10b145c
[CI] Ubuntu 21: Install ca-certificates to avoid TLS error
sfgeorge Mar 22, 2022
2c248da
[CI] Drop testing for beta Ubuntu 22.04
sfgeorge Mar 22, 2022
3d37e87
[CI] Remove unneeded setup-python GitHub Action
sfgeorge Mar 23, 2022
f6bdfa8
[CI] Test against Centos Stream 9
sfgeorge Mar 24, 2022
23a9d8c
[CI] Restore "Parallelize the test matrix" behavior from #215
sfgeorge Mar 24, 2022
0837d74
Revert "[CI] Test against Centos Stream 9"
sfgeorge Mar 24, 2022
ef6bf23
[CI] Replace CentOS Stream with Rocky Linux
sfgeorge Mar 24, 2022
a05ff4f
[CI] Ubuntu 21.10: Restrict time to 29 min
sfgeorge Mar 24, 2022
eec3578
[DOC] Update CHANGELOG PR reference
sfgeorge Mar 24, 2022
3e1454c
[CI] Rocky Linux 8: Add required findutils package
sfgeorge Mar 24, 2022
07c36e3
DOC] Update CHANGELOG PR reference
sfgeorge Mar 24, 2022
87fbc6a
Merge branch 'master' into github-actions
sfgeorge Mar 25, 2022
b9a7f68
Merge branch 'master' into github-actions
thbar Mar 26, 2022
5352666
[CI] [DOC] Add a comment around scheduled workflow
sfgeorge Mar 26, 2022
afc62bb
[CI] Run CI on any branch push
sfgeorge Mar 26, 2022
c20b465
[DOC] Align YAML comments with Steps
sfgeorge Mar 26, 2022
bbc946f
[DOC] Update CHANGELOG entry to include principal change: Migrate Git…
sfgeorge Mar 26, 2022
51d3f5f
[CI] Use CentOS from Docker Hub
sfgeorge Mar 26, 2022
6b37dba
[CI] Make this PR purely about CI switch (no added OSs)
sfgeorge Mar 26, 2022
5313d0d
Update CHANGELOG.md
pkuczynski Mar 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI
on:
pkuczynski marked this conversation as resolved.
Show resolved Hide resolved
push:
branches:
- develop
- main
- master
pull_request:
schedule:
- cron: '46 3 20 * *'
pkuczynski marked this conversation as resolved.
Show resolved Hide resolved

jobs:
tests:
strategy:
fail-fast: false
matrix:
playbook:
- user.yml
- root.yml
platform:
- centos
- debian
- ubuntu

runs-on: ubuntu-latest

defaults:
run:
working-directory: tests

steps:
- uses: actions/checkout@v3

# Docker Image Caching: Step 1
sfgeorge marked this conversation as resolved.
Show resolved Hide resolved
# Pull the latest image to build, and avoid caching pull-only images.
# (docker pull is faster than caching in most cases.)
- run: docker-compose pull

# Docker Image Caching: Step 2
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

# Docker Image Caching: Step 3
- name: Launch containers
run: ls -1 ./dockerfiles/ | fgrep ${{ matrix.platform }} | xargs docker-compose up --build -d

- name: Run The Tests
run: ansible-playbook ${{ matrix.playbook }} -l ${{ matrix.platform }}

- name: Shut down containers
run: docker-compose down

# Docker Image Caching: Step 4
# Finally a post-run action of satackey/action-docker-layer-caching,
# which is the process of saving the cache, will be executed automatically
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#### Changes

* Extend test matrix with: (#235)
pkuczynski marked this conversation as resolved.
Show resolved Hide resolved
* Rocky Linux 8, Debian 11, Ubuntu 21.10
* Extend test matrix with: (#215)
* CentOS 8, Debian 10, Ubuntu 18.04 and 20.04
* Ruby 2.6.6 and 2.7.1
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/rvm/rvm1-ansible.svg?branch=master)](https://travis-ci.org/rvm/rvm1-ansible)
[![Build Status](https://github.com/rvm/rvm1-ansible/actions/workflows/tests.yml/badge.svg)](https://github.com/rvm/rvm1-ansible/actions/workflows/tests.yml)
[![OpenCollective](https://opencollective.com/rvm/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/rvm/sponsors/badge.svg)](#sponsors)
[![Ansible Role](https://img.shields.io/badge/role-rvm_io-red)](https://galaxy.ansible.com/rvm/ruby)
Expand Down Expand Up @@ -172,8 +172,9 @@ Compatibility with Linux distributions based on Debian, Ubuntu or Redhat familie

The continuous integration setup of this project currently covers following platforms:
- CentOS 6, 7 and 8
- Debian 8, 9 and 10
- Ubuntu 14.04, 16.04, 18.04 and 20.04
- Rocky Linux 8
pkuczynski marked this conversation as resolved.
Show resolved Hide resolved
- Debian 8, 9, 10 and 11
- Ubuntu 14.04, 16.04, 18.04, 20.04 and 21.10
pkuczynski marked this conversation as resolved.
Show resolved Hide resolved

## Ansible galaxy

Expand Down
10 changes: 10 additions & 0 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ services:
centos6:
build: ./dockerfiles/centos6
cap_add: [ALL]
init: true
centos7:
build: ./dockerfiles/centos7
cap_add: [ALL]
centos8:
build: ./dockerfiles/centos8
rockylinux8_alt_centos:
build: ./dockerfiles/rockylinux8_alt_centos
cap_add: [ALL]

debian8:
Expand All @@ -20,6 +23,9 @@ services:
debian10:
build: ./dockerfiles/debian10
cap_add: [ALL]
debian11:
build: ./dockerfiles/debian11
cap_add: [ALL]

ubuntu14:
build: ./dockerfiles/ubuntu14
Expand All @@ -33,3 +39,7 @@ services:
ubuntu20:
build: ./dockerfiles/ubuntu20
cap_add: [ALL]
ubuntu21:
build: ./dockerfiles/ubuntu21
cap_add: [ALL]
init: true
21 changes: 12 additions & 9 deletions tests/dockerfiles/centos6/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM centos:6
FROM quay.io/centos/centos:centos6

RUN yum update -y && \
yum install -y \
initscripts \
sudo \
&& yum clean all
RUN sed -i -e 's/mirrorlist/#mirrorlist/g' \
-e 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' \
/etc/yum.repos.d/CentOS-* \
&& yum update -y \
&& yum install -y \
sudo \
which \
&& yum clean all

RUN useradd -ms /bin/bash user \
&& echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
RUN useradd -ms /bin/bash user && \
echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

CMD ["/sbin/init"]
CMD ["/usr/bin/env", "sleep", "29m"]
11 changes: 7 additions & 4 deletions tests/dockerfiles/centos8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM centos:8
FROM quay.io/centos/centos:centos8
pkuczynski marked this conversation as resolved.
Show resolved Hide resolved

RUN yum update -y \
&& yum install -y \
RUN sed -i -e 's/mirrorlist/#mirrorlist/g' \
-e 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' \
/etc/yum.repos.d/CentOS-* \
&& dnf update -y \
&& dnf install -y \
sudo \
which \
&& yum clean all
&& dnf clean all

RUN useradd -ms /bin/bash user && \
echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
Expand Down
17 changes: 17 additions & 0 deletions tests/dockerfiles/debian11/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM debian:11

RUN apt-get update \
&& apt-get install -y \
curl \
gpg \
procps \
python \
sudo \
systemd \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash user && \
echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

CMD ["/lib/systemd/systemd"]
14 changes: 14 additions & 0 deletions tests/dockerfiles/rockylinux8_alt_centos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM rockylinux:8

RUN dnf update -y \
&& dnf install -y \
findutils \
procps \
sudo \
which \
&& dnf clean all

RUN useradd -ms /bin/bash user && \
echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

CMD ["/usr/sbin/init"]
19 changes: 19 additions & 0 deletions tests/dockerfiles/ubuntu21/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:21.10

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
-y --no-install-recommends \
ca-certificates \
curl \
dirmngr \
gpg \
python \
sudo \
systemd \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash user && \
echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

CMD ["/usr/bin/env", "sleep", "29m"]
3 changes: 3 additions & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
tests_centos6_1 ansible_connection=docker
tests_centos7_1 ansible_connection=docker
tests_centos8_1 ansible_connection=docker
tests_rockylinux8_alt_centos_1 ansible_connection=docker

[debian]
tests_debian8_1 ansible_connection=docker
tests_debian9_1 ansible_connection=docker
tests_debian10_1 ansible_connection=docker
tests_debian11_1 ansible_connection=docker

[ubuntu]
tests_ubuntu14_1 ansible_connection=docker
tests_ubuntu16_1 ansible_connection=docker
tests_ubuntu18_1 ansible_connection=docker
tests_ubuntu20_1 ansible_connection=docker
tests_ubuntu21_1 ansible_connection=docker