Selaa lähdekoodia

Add Travis CI tests.

Jeff Geerling 12 vuotta sitten
vanhempi
sitoutus
d20903900a
4 muutettua tiedostoa jossa 42 lisäystä ja 0 poistoa
  1. 33 0
      .travis.yml
  2. 2 0
      README.md
  3. 1 0
      tests/inventory
  4. 6 0
      tests/test.yml

+ 33 - 0
.travis.yml

@@ -0,0 +1,33 @@
+---
+language: python
+python: "2.7"
+
+env:
+  - SITE=test.yml
+
+before_install:
+  - sudo apt-get update -qq
+
+install:
+  # Install Ansible.
+  - pip install ansible==1.5.0
+
+  # Add ansible.cfg to pick up roles path.
+  - "printf '[defaults]\nroles_path = ../' > ansible.cfg"
+
+  # Install required dependencies.
+  - ansible-galaxy install geerlingguy.git
+
+script:
+  # Check the role/playbook's syntax.
+  - "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
+
+  # Run the role/playbook with ansible-playbook.
+  - "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"
+
+  # Run the role/playbook again, checking to make sure it's idempotent.
+  - >
+    ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
+    | grep -q 'changed=0.*failed=0'
+    && (echo 'Idempotence test: pass' && exit 0)
+    || (echo 'Idempotence test: fail' && exit 1)

+ 2 - 0
README.md

@@ -1,5 +1,7 @@
 # Ansible Role: Gogs
 # Ansible Role: Gogs
 
 
+[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-gogs.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-gogs)
+
 Installs [Gogs](https://github.com/gogits/gogs), a Go-based front-end to Git, on RedHat or Debian-based linux systems.
 Installs [Gogs](https://github.com/gogits/gogs), a Go-based front-end to Git, on RedHat or Debian-based linux systems.
 
 
 After the playbook is finished, visit the gogs server (on port 3000 by default), and you will be redirected to the /install page, where you can configure an administrator account and other default options.
 After the playbook is finished, visit the gogs server (on port 3000 by default), and you will be redirected to the /install page, where you can configure an administrator account and other default options.

+ 1 - 0
tests/inventory

@@ -0,0 +1 @@
+localhost

+ 6 - 0
tests/test.yml

@@ -0,0 +1,6 @@
+---
+- hosts: localhost
+  remote_user: root
+  roles:
+    - geerlingguy.git
+    - ansible-role-gogs