diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ca5cd25 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Create test cluster + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + postgresql_version: [10, 11, 12] + debian_release: [buster, stretch] + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r test/requirements.txt + ansible --version + ansible-galaxy install -r test/requirements.yml -p test/roles/ + - name: Check role syntax + run: | + ansible-playbook test/main.yml -i test/hosts --syntax-check + - name: Run the tests + env: + POSTGRESQL_VERSION: ${{ matrix.postgresql_version }} + DEBIAN_RELEASE: ${{ matrix.debian_release }} + run: | + ansible-playbook test/main.yml -i test/hosts -e "postgres_version=${POSTGRESQL_VERSION}" -e "debian_release=${DEBIAN_RELEASE}" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b7ce10f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -dist: bionic -language: python -python: "3.8" - -# Test on all supported PG versions on both debian stretch and debian buster -env: -- POSTGRESQL_VERSION=10 DEBIAN_RELEASE=stretch -- POSTGRESQL_VERSION=11 DEBIAN_RELEASE=stretch -- POSTGRESQL_VERSION=12 DEBIAN_RELEASE=stretch -- POSTGRESQL_VERSION=10 DEBIAN_RELEASE=buster -- POSTGRESQL_VERSION=11 DEBIAN_RELEASE=buster -- POSTGRESQL_VERSION=12 DEBIAN_RELEASE=buster - -# Install pip -addons: - apt: - packages: - - python-pip - -# Tests are using docker to spawn fake instances -services: - - docker - -install: - # Install ansible - - pip install -r test/requirements.txt - # Check ansible version - - ansible --version - - ansible-galaxy install -r test/requirements.yml -p test/roles/ - -script: - # Basic role syntax check - - ansible-playbook test/main.yml -i test/hosts --syntax-check - # Run the tests - - ansible-playbook test/main.yml -i test/hosts -e "postgres_version=${POSTGRESQL_VERSION}" -e "debian_release=${DEBIAN_RELEASE}" - # FAILS - ansible-playbook test/main.yml -i test/hosts - # Even if Docker and docker-py module are present, the tests fail on Travis - # The error on Travis is: - # => {"changed": false, "item": {"image": "python:3.7-stretch", "links": ["postgres_barman", "postgres_one"], "name": "postgres_three"}, "msg": "Failed to import docker or docker-py - No module named docker. Try `pip install docker` or `pip install docker-py` (Python 2.6)"} - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index e27734a..38933fb 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ This project comes with a `test/main.yml` testing playbook. It uses `Docker` to Coverage of this playbook is probably not complete but at least it's there. -If you are contributing, please first test your changes in a new playbook in the `test/` directory within docker containers, (using the targeted distribution), and if possible, ensure your change is covered in the tests found in [.travis.yml](./.travis.yml). +If you are contributing, please first test your changes in a new playbook in the `test/` directory within docker containers, (using the targeted distribution), and if possible, ensure your change is covered in the tests. #### License