Skip to content

Commit

Permalink
Merge pull request #5 from Oefenweb/make-use-of-github-actions
Browse files Browse the repository at this point in the history
Make use of Github actions
  • Loading branch information
tersmitten authored May 17, 2021
2 parents 78fc119 + 7d1c295 commit 1cae188
Show file tree
Hide file tree
Showing 16 changed files with 202 additions and 124 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
warn_list:
- '106'
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: CI
'on':
pull_request:
push:
branches:
- master
schedule:
- cron: '30 1 * * 3'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v2

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

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]

- name: Lint code
run: |
yamllint .
ansible-lint
molecule:
name: Molecule
runs-on: ubuntu-latest
defaults:
run:
working-directory: "${{ github.repository }}"
needs:
- lint
strategy:
fail-fast: false
matrix:
include:
- distro: debian8
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.8, <2.9'
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
- distro: ubuntu1804
- distro: ubuntu2004

steps:
- name: Check out the codebase
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"

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

- name: Install test dependencies
run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker

- name: Run Molecule tests
run: |
molecule test
env:
ANSIBLE_FORCE_COLOR: '1'
ANSIBLE_VERBOSITY: '2'
MOLECULE_DEBUG: '1'
MOLECULE_DISTRO: "${{ matrix.distro }}"
PY_COLORS: '1'
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Release
'on':
push:
tags:
- '*'

jobs:

release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v2

- name: Publish to Galaxy
uses: robertdebock/galaxy-action@1.1.0
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
84 changes: 0 additions & 84 deletions .travis.yml

This file was deleted.

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

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy: disable

ignore: |
.tox/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## tinyproxy

[![Build Status](https://travis-ci.org/Oefenweb/ansible-tinyproxy.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-tinyproxy) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-tinyproxy-blue.svg)](https://galaxy.ansible.com/Oefenweb/tinyproxy)
[![CI](https://github.com/Oefenweb/ansible-tinyproxy/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-tinyproxy/actions?query=workflow%3ACI)
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-tinyproxy-blue.svg)](https://galaxy.ansible.com/Oefenweb/tinyproxy)

Set up [tinyproxy](https://tinyproxy.github.io/) in Debian-like systems.

Expand Down
14 changes: 7 additions & 7 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ role = File.basename(File.expand_path(File.dirname(__FILE__)))

boxes = [
{
:name => "ubuntu-1404",
:box => "bento/ubuntu-14.04",
:name => "ubuntu-1604",
:box => "bento/ubuntu-16.04",
:ip => '10.0.0.12',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1604",
:box => "bento/ubuntu-16.04",
:name => "ubuntu-1804",
:box => "bento/ubuntu-18.04",
:ip => '10.0.0.13',
:cpu => "50",
:ram => "256"
:ram => "384"
},
{
:name => "ubuntu-1804",
:box => "bento/ubuntu-18.04",
:name => "ubuntu-2004",
:box => "bento/ubuntu-20.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "384"
Expand Down
1 change: 0 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- focal
Expand Down
9 changes: 9 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Converge
hosts: all
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
roles:
- ../../../
19 changes: 19 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
prepare: prepare.yml
converge: converge.yml
verify: verify.yml
9 changes: 9 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/../../tests/tasks/pre.yml"
9 changes: 9 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- name: Verify
hosts: all
become: true
tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/../../tests/tasks/post.yml"
8 changes: 5 additions & 3 deletions tests/post.yml → tests/tasks/post.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# post test file
---
- name: post | install dependencies
- name: install test dependencies
apt:
name:
- curl
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"

- name: post | test installation
- name: test tinyproxy installation
command: >
curl -sL --head https://www.google.com --proxy http://127.0.0.1:3128
curl -sL --head https://www.google.com --proxy http://{{ ansible_lo['ipv4']['address'] }}:{{ tinyproxy_port }}
args:
warn: false
register: _result
changed_when: false
failed_when: _result.stdout.find('HTTP/1.0 200') == -1
tags:
- skip_ansible_lint
14 changes: 14 additions & 0 deletions tests/tasks/pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# post test file
---
- name: install test dependencies
apt:
name:
- net-tools
- iproute2
- ethtool
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"

- name: (re)gather facts
action: setup
31 changes: 5 additions & 26 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,11 @@
become: true
pre_tasks:
- name: include vars
include_vars: main.yml
include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
post_tasks:
- include: post.yml
vars:
tinyproxy_tinyproxy_conf:
- |
User nobody
Group nogroup
Port {{ tinyproxy_port }}
Timeout 666
DefaultErrorFile "/usr/share/tinyproxy/default.html"
StatFile "/usr/share/tinyproxy/stats.html"
Logfile "/var/log/tinyproxy/tinyproxy.log"
LogLevel Info
PidFile "/var/run/tinyproxy/tinyproxy.pid"
MaxClients 100
MinSpareServers 5
MaxSpareServers 20
StartServers 10
MaxRequestsPerChild 0
{% for allow in tinyproxy_allow %}
Allow {{ allow }}
{% endfor %}
ViaProxyName "tinyproxy"
{% for connect_port in tinyproxy_connect_port %}
ConnectPort {{ connect_port }}
{% endfor %}
- name: include tasks
include: "{{ playbook_dir }}/tasks/post.yml"
7 changes: 5 additions & 2 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
become: true
pre_tasks:
- name: include vars
include_vars: main.yml
include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/pre.yml"
roles:
- ../../
post_tasks:
- include: post.yml
- name: include tasks
include: "{{ playbook_dir }}/tasks/post.yml"

0 comments on commit 1cae188

Please sign in to comment.