Skip to content

Commit

Permalink
Migrate to GitHub actions (#19)
Browse files Browse the repository at this point in the history
* Migrate to GitHub Actions
  • Loading branch information
tobias-richter authored Feb 8, 2021
1 parent e59d470 commit 7e686d5
Show file tree
Hide file tree
Showing 20 changed files with 208 additions and 110 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
name: CI

env:
ROLE_NAME: wcm_io_devops.aem_dispatcher

defaults:
run:
working-directory: 'wcm_io_devops.aem_dispatcher'

'on':
pull_request:
push:
branches:
- master
- "feature/migrate-to-github-actions"

jobs:

lint:
name: "Lint (${{ matrix.NAME }})"
runs-on: ubuntu-latest
strategy:
matrix:
include:
- NAME: min_ansible_version
ANSIBLE_VERSION: "==2.7.*"
ANSIBLE_LINT_VERSION: "==4.2.*"
- NAME: latest
ANSIBLE_VERSION: ""
ANSIBLE_LINT_VERSION: ""

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: '${{ env.ROLE_NAME }}'

- name: Cache PIP
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.ANSIBLE_VERSION }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.ANSIBLE_VERSION }}-
- name: Create ansible.cfg
run: "printf '[defaults]\nroles_path=./tests/requirements/:../' > ansible.cfg"

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install pip tools.
run: |
pip3 install wheel --upgrade
- name: Install test dependencies.
run: >
pip3 install yamllint
ansible${{ matrix.ANSIBLE_VERSION }}
ansible-lint${{ matrix.ANSIBLE_LINT_VERSION }}
--upgrade
- name: Install role requirements.
run: |
pip3 install -r requirements.txt
- name: Install Galaxy requirements.
run: |
ansible-galaxy install -r tests/requirements.yml -p ./tests/requirements
- name: Lint code.
run: |
yamllint .
ansible-lint
- name: Test syntax.
run: |
ansible-playbook tests/test.yml -i tests/inventory --syntax-check
galaxy:
name: "Ansible Galaxy import"
needs:
- lint
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Trigger a new import on Galaxy.
uses: robertdebock/galaxy-action@affc5472cd0b08f64a51eafba49b08898c1bbeb8
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Release

'on':
release:
types:
- published

jobs:

release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Trigger a new import on Galaxy.
uses: robertdebock/galaxy-action@affc5472cd0b08f64a51eafba49b08898c1bbeb8
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
61 changes: 31 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
maven-eclipse.xml
infinitest.filters

node_modules/
npm-debug.log

.nodejs
.project
.classpath
.settings
.externalToolBuilders
.pmd
.checkstyle
.idea
.vagrant
*.iml
.DS_Store
*.retry
.rubygems
.sass-cache
.rubygems-gem-maven-plugin
*.sublime-*
*nbactions*.xml
.temp/
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
maven-eclipse.xml
infinitest.filters

node_modules/
npm-debug.log

.nodejs
.project
.classpath
.settings
.externalToolBuilders
.pmd
.checkstyle
.idea
.vagrant
*.iml
.DS_Store
*.retry
.rubygems
.sass-cache
.rubygems-gem-maven-plugin
*.sublime-*
*nbactions*.xml
.temp/
ansible.cfg
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
extends: default

rules:
line-length:
max: 120
level: warning
truthy:
allowed-values: ['true', 'false', 'yes', 'no']

ignore: |
.travis.yml
tests/requirements/
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Dispatcher version to install
aem_dispatcher_version: 4.3.3
# Whether to install dispatcher with SSL support
Expand Down Expand Up @@ -44,4 +45,4 @@ aem_dispatcher_install_source: file
aem_dispatcher_dependency_apache: true

# Overwrites the os family specific apache server root
# aem_dispatcher_apache_server_root: /etc/apache2
# aem_dispatcher_apache_server_root: /etc/apache2
36 changes: 18 additions & 18 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
galaxy_info:
role_name: aem_dispatcher
author: Martin Wehner
Expand All @@ -8,19 +9,19 @@ galaxy_info:
min_ansible_version: 2.7

platforms:
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: Debian
versions:
- stretch
- buster
- name: EL
versions:
- 7
- 8
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: Debian
versions:
- stretch
- buster
- name: EL
versions:
- 7
- 8

galaxy_tags:
- aem
Expand All @@ -31,14 +32,13 @@ galaxy_info:

dependencies:
- role: wcm_io_devops.apache
version: "3.1.0-1"
version: "3.1.4-1"
apache_remove_default_vhost: true
apache_remove_default_vhost_ssl: true
apache_create_vhosts: false
apache_listen_port: "{{ aem_dispatcher_port }}"
apache_listen_port_ssl: "{{ aem_dispatcher_port_ssl }}"
tags: [
"dependency",
"dependency.apache"
]
tags:
- "dependency"
- "dependency.apache"
when: aem_dispatcher_dependency_apache
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This role needs to have the following PIP components installed
3 changes: 2 additions & 1 deletion tasks/download/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
- name: Copy Dispatcher tarball to download folder.
copy:
src: "{{ aem_dispatcher_tarball_name }}"
dest: "{{ aem_dispatcher_download_path }}"
dest: "{{ aem_dispatcher_download_path }}"
mode: 0644
2 changes: 1 addition & 1 deletion tasks/download/maven_repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
version: "{{ item.version | default(aem_dispatcher_version) }}"
classifier: "{{ item.classifier | default(aem_dispatcher_tarball_name |
regex_replace('dispatcher-[\\d|\\.]*-(.*)\\.tar\\.gz', '\\1') ) }}"
with_items: "{{ aem_dispatcher_maven_repository_coordinates }}"
with_items: "{{ aem_dispatcher_maven_repository_coordinates }}"
1 change: 1 addition & 0 deletions tasks/download/package.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Install Dispatcher package.
package:
name: "{{ aem_dispatcher_package }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
when: aem_dispatcher_install_source != "package"

- name: Include OS-specific setup.
include_tasks: "setup_{{ ansible_os_family }}.yml"
include_tasks: "setup_{{ ansible_os_family }}.yml"
26 changes: 14 additions & 12 deletions tasks/setup_Debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: Include distribution specific variables.
include_vars: "distribution_{{ ansible_distribution }}.yml"

Expand All @@ -11,26 +12,27 @@

- block:

- name: Install libssl dependency.
package:
name: "libssl{{ aem_dispatcher_libssl_version }}"
state: present
- name: Install libssl dependency.
package:
name: "libssl{{ aem_dispatcher_libssl_version }}"
state: present

- name: Create compatibility links.
file:
src: "{{ aem_dispatcher_libssl_path }}/{{ item }}.{{ aem_dispatcher_libssl_version }}"
dest: "{{ aem_dispatcher_libssl_path }}/{{ item }}.10"
state: link
with_items:
- libssl.so
- libcrypto.so
- name: Create compatibility links.
file:
src: "{{ aem_dispatcher_libssl_path }}/{{ item }}.{{ aem_dispatcher_libssl_version }}"
dest: "{{ aem_dispatcher_libssl_path }}/{{ item }}.10"
state: link
with_items:
- libssl.so
- libcrypto.so

when: aem_dispatcher_ssl_support

- name: Make dispatcher module available.
copy:
dest: "{{ _aem_dispatcher_apache_server_root }}/mods-available/dispatcher.load"
content: "LoadModule dispatcher_module {{ aem_dispatcher_module_path }}/mod_dispatcher.so"
mode: 0644
notify:
- restart apache

Expand Down
2 changes: 2 additions & 0 deletions tasks/setup_RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
- name: Enable dispatcher module.
copy:
dest: "{{ _aem_dispatcher_apache_server_root }}/conf.modules.d/01-dispatcher.conf"
content: "LoadModule dispatcher_module modules/mod_dispatcher.so"
mode: 0644
notify: restart apache

- name: Install SELinux Python dependencies.
Expand Down
3 changes: 2 additions & 1 deletion tests/requirements.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- name: wcm_io_devops.apache
---
- name: wcm_io_devops.apache
3 changes: 2 additions & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
- name: test role syntax
hosts: test
roles:
- ansible-aem-dispatcher
- wcm_io_devops.aem_dispatcher
Loading

0 comments on commit 7e686d5

Please sign in to comment.