diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1637634 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +--- +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 yamllint ansible-lint + + - 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: 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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2354e68 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6bf2d25..0000000 --- a/.travis.yml +++ /dev/null @@ -1,112 +0,0 @@ ---- -sudo: required -dist: xenial - -language: python -python: - - "2.7" - - "3.5" - -env: - - ANSIBLE_VERSION=latest - - ANSIBLE_VERSION=2.10.1 - - ANSIBLE_VERSION=2.10.0 - - ANSIBLE_VERSION=2.9.14 - - ANSIBLE_VERSION=2.9.13 - - ANSIBLE_VERSION=2.9.12 - - ANSIBLE_VERSION=2.9.11 - - ANSIBLE_VERSION=2.9.10 - - ANSIBLE_VERSION=2.9.9 - - ANSIBLE_VERSION=2.9.8 - - ANSIBLE_VERSION=2.9.7 - - ANSIBLE_VERSION=2.9.6 - - ANSIBLE_VERSION=2.9.5 - - ANSIBLE_VERSION=2.9.4 - - ANSIBLE_VERSION=2.9.3 - - ANSIBLE_VERSION=2.9.2 - - ANSIBLE_VERSION=2.9.1 - - ANSIBLE_VERSION=2.9.0 - - ANSIBLE_VERSION=2.8.16 - - ANSIBLE_VERSION=2.8.15 - - ANSIBLE_VERSION=2.8.14 - - ANSIBLE_VERSION=2.8.13 - - ANSIBLE_VERSION=2.8.12 - - ANSIBLE_VERSION=2.8.11 - - ANSIBLE_VERSION=2.8.10 - - ANSIBLE_VERSION=2.8.9 - - ANSIBLE_VERSION=2.8.8 - - ANSIBLE_VERSION=2.8.7 - - ANSIBLE_VERSION=2.8.6 - - ANSIBLE_VERSION=2.8.5 - - ANSIBLE_VERSION=2.8.4 - - ANSIBLE_VERSION=2.8.3 - - ANSIBLE_VERSION=2.8.2 - - ANSIBLE_VERSION=2.8.1 - - ANSIBLE_VERSION=2.8.0 - -jobs: - include: - - python: "3.8" - env: ANSIBLE_VERSION=latest ANSIBLE_LINT_VERSION=latest - exclude: - - python: "2.7" - env: ANSIBLE_VERSION=latest - - python: "2.7" - env: ANSIBLE_VERSION=2.10.2 - - python: "2.7" - env: ANSIBLE_VERSION=2.10.1 - -branches: - only: - - master - -before_install: - - sudo apt-get update -qq - - # Remove r-base - - sudo apt-get remove --purge --yes r-base - -install: - # Install Ansible. - - if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi - - > - if [ -n "$ANSIBLE_LINT_VERSION" ]; then - if [ "$ANSIBLE_LINT_VERSION" = "latest" ]; then - pip install ansible-lint; - else - pip install ansible-lint==$ANSIBLE_LINT_VERSION; - fi - fi - -script: - # Check the role/playbook's syntax. - - ansible-playbook -i tests/inventory tests/test.yml --syntax-check - - # Run the role/playbook with ansible-playbook. - - ansible-playbook -i tests/inventory tests/test.yml -vvvv - - # Run the role/playbook again, checking to make sure it's idempotent. - - > - ansible-playbook -i tests/inventory tests/test.yml - | grep -q 'changed=0.*failed=0' - && (echo 'Idempotence test: pass' && exit 0) - || (echo 'Idempotence test: fail' && exit 1) - - # Test r installation - - > - Rscript -e 'print(gsub("I","O","PING"))' - | grep -q 'PONG' - && (echo 'Availability test: pass' && exit 0) - || (echo 'Availability test: fail' && exit 1) - - - > - if [ -n "$ANSIBLE_LINT_VERSION" ]; then - ansible-lint tests/test.yml; - fi - -notifications: - email: false - webhooks: https://galaxy.ansible.com/api/v1/notifications/ - slack: - rooms: - secure: "ttWp/BcjXX52/ui3O0ajM2AhYv0eUP+B74XmPVJ25D8RFsn8yHa7nGs8de5nsN6Vkhd+iIafNtc5Bh9SoBPVAILHpcXoVyVJltRFPJsVsVeT3K4En8b4BTJu/kb17iUHcdfQHmehu58umoo61v6Qeh4CW+EUTMqS4yU20WvAXIamGi7fkWjXugv2P8FvX5P2TYPcy+DZ5eYI1NaaKv6moB6yUL3qzOg95sCGZq4J70Up2WuGxyLx6daArG9U0qoFNfCVWkZKb6YZL31lFO6689dT6DmohPMKAym3OSkg3nvzDH1rBQt2rR08FVrHtEbZCbstb8XFgnxjl+VYtv/BQyYu8v/pZk3Ihi+r/5a1DMEOhCynnBpcfoJDA+C5ZOuNJKz6W0fhqOArJE4MhGiZQewc7L8hJowY+7lzjDAR4X33D+a8z4W6qLN4hzQuIZcfgraQBdckprXJIxICzf/P9K0Xy43TW48xJ9qSqArkcL6Vib147Vdnj6w1QZ4UJXau8TW8i1sZCW1LDOIug1h/7SET+HhY1DF8jC1idxqHOuBLzoLWtA1rnojCIHtrQsHHc8tXHA+JfgPhXR6YTYRwWkTXblZEjQ9D0LwBqtfe3kdLfYOrj8u9506BQsLweZHjQlP7DrWqtQb65GI833tO6C9va6P6v6grwmmUOaGnGNE=" diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..894450c --- /dev/null +++ b/.yamllint @@ -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/ diff --git a/Dockerfile b/Dockerfile index 4961dbe..fc89ab2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,10 @@ RUN rm -rf $HOME/.cache # ansible RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \ apt-get clean -RUN pip install ansible==2.9.14 +RUN pip install ansible==2.9.15 RUN rm -rf $HOME/.cache # provision COPY . /etc/ansible/roles/ansible-role WORKDIR /etc/ansible/roles/ansible-role -RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local -vv +RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local diff --git a/README.md b/README.md index 8f2c0d6..293fb1f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## r -[![Build Status](https://travis-ci.org/Oefenweb/ansible-r.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-r) +[![CI](https://github.com/Oefenweb/ansible-r/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-r/actions?query=workflow%3ACI) [![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-r-blue.svg)](https://galaxy.ansible.com/Oefenweb/r/) Set up the latest version of R in Ubuntu systems. diff --git a/meta/main.yml b/meta/main.yml index 53cec24..3d57bc3 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -10,9 +10,9 @@ galaxy_info: platforms: - name: Ubuntu versions: - - trusty - xenial - bionic + - focal galaxy_tags: - system - r diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..be762b2 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,6 @@ +--- +- name: Converge + hosts: all + become: true + roles: + - ../../../ diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..fbb7120 --- /dev/null +++ b/molecule/default/molecule.yml @@ -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 diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml new file mode 100644 index 0000000..9a6673d --- /dev/null +++ b/molecule/default/prepare.yml @@ -0,0 +1,5 @@ +--- +- name: Prepare + hosts: all + become: true + tasks: [] diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..44debad --- /dev/null +++ b/molecule/default/verify.yml @@ -0,0 +1,5 @@ +--- +- name: Verify + hosts: all + become: true + tasks: [] diff --git a/vars/main.yml b/vars/main.yml index d547a7d..95a3ba6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -6,6 +6,7 @@ r_repository: url: "{{ r_cran_mirror }}/bin/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }}{{ r_repository_suffix }}/" r_dependencies_pre: + - dirmngr - apt-transport-https r_dependencies_dummy_package: apt