diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml new file mode 100644 index 00000000..bbe39834 --- /dev/null +++ b/.github/workflows/default.yml @@ -0,0 +1,75 @@ +name: Test + +on: [push, pull_request] + +jobs: + test: + name: Test MapIt + runs-on: ubuntu-18.04 + + services: + postgres: + image: postgis/postgis:10-2.5 + env: + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + PGHOST: localhost + PGUSER: postgres + PGPASSWORD: postgres + CFLAGS: "-O0" + + strategy: + fail-fast: false + matrix: + python-version: [3.6] + thing-to-test: [flake8, 1.11, 2.2, 3.1, '3.2b1'] + include: + - python-version: 2.7 + thing-to-test: 1.11 + - python-version: 2.7 + thing-to-test: flake8 + + steps: + - uses: actions/checkout@v2 + + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + set -xe + python -VV + python -m site + pip install tox tox-gh-actions codecov + + - name: Install GDAL + run: sudo apt-get install gdal-bin + + - name: Set up config + run: | + createdb mapit + psql -d mapit -c 'create extension postgis;' + echo 'MAPIT_DB_HOST: localhost' > conf/general.yml + echo 'MAPIT_DB_NAME: mapit' >> conf/general.yml + echo 'MAPIT_DB_USER: postgres' >> conf/general.yml + echo 'MAPIT_DB_PASS: postgres' >> conf/general.yml + echo 'DJANGO_SECRET_KEY: secret' >> conf/general.yml + echo 'COUNTRY: GB' >> conf/general.yml + + - name: Run tests + run: tox + env: + THING_TO_TEST: ${{ matrix.thing-to-test }} + + - name: Upload code coverage + run: codecov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1cfaed1a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -notifications: - email: false - -language: python - -sudo: false - -addons: - postgresql: "9.6" - apt: - packages: - - postgresql-9.6-postgis-2.4 - -env: - global: - - CFLAGS="-O0" - matrix: - - TOXENV=flake8 - - TOXENV=py27-1.11 - -install: - - pip install tox codecov - - sed -r - -e "s,(MAPIT_DB_USER:) 'mapit',\\1 'postgres'," - conf/general.yml-example > conf/general.yml - -before_script: - - createdb -U postgres mapit - - psql -U postgres -d mapit -c 'CREATE EXTENSION postgis;' - -script: - - tox - -after_success: - - codecov