From 1ee17e995a2612d30a13a23b8cc30be9a57236f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Sat, 4 Apr 2020 13:19:19 -0700 Subject: [PATCH] Setup GitHub Actions --- .gitattributes | 1 - .github/workflows/linters.yml | 16 +++++++++++ .github/workflows/unit_tests.yml | 47 ++++++++++++++++++++++++++++++++ .travis.yml | 32 ---------------------- README.md | 2 -- tests/Dockerfile | 24 ++++++++++++++++ tests/units.postgres.xml | 2 +- 7 files changed, 88 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/linters.yml create mode 100644 .github/workflows/unit_tests.yml delete mode 100644 .travis.yml create mode 100644 tests/Dockerfile diff --git a/.gitattributes b/.gitattributes index f4dbe5fd7..1eb022cb9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,7 +4,6 @@ app/constants.php export-subst .gitattributes export-ignore .gitignore export-ignore .dockerignore export-ignore -.travis.yml export-ignore docker export-ignore Dockerfile export-ignore diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 000000000..55af98cb4 --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,16 @@ +name: Linters + +on: + pull_request: + branches: [ master ] + +jobs: + jshint: + runs-on: ubuntu-latest + container: kanboard/tests:latest + steps: + - uses: actions/checkout@v2 + - name: Install jshint + run: npm install -g jshint + - name: Run jshint + run: jshint ./assets/js/core ./assets/js/components diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 000000000..4279e853c --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,47 @@ +name: Unit Tests + +on: + pull_request: + branches: [ master ] + +jobs: + Sqlite: + runs-on: ubuntu-latest + container: kanboard/tests:latest + steps: + - uses: actions/checkout@v2 + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + - name: Unit tests with Sqlite + run: ./vendor/bin/phpunit -c tests/units.sqlite.xml + + Postgres: + runs-on: ubuntu-latest + container: kanboard/tests:latest + services: + postgres: + image: postgres:9.4 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v2 + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + - name: Unit tests with Postgres + run: ./vendor/bin/phpunit -c tests/units.postgres.xml + env: + DB_HOSTNAME: postgres + DB_PORT: ${{ job.services.postgres.ports[5432] }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e002452bb..000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -notifications: - email: false - -git: - depth: 3 - -services: - - postgresql - -language: php -sudo: false - -php: - - 7.4 - - 7.3 - - 7.2 - -env: - - DB=sqlite - - DB=postgres - -matrix: - fast_finish: true - -before_script: - - composer install --no-interaction - - npm install -g jshint - -script: - - jshint assets/js/{core,components} - - ./vendor/bin/phpunit -c tests/units.$DB.xml - - ./vendor/bin/phpunit tests/configtest diff --git a/README.md b/README.md index 3754bccbb..d83876e01 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Kanboard ======== -[![Build Status](https://travis-ci.org/kanboard/kanboard.svg?branch=master)](https://travis-ci.org/kanboard/kanboard) - Kanboard is project management software that focuses on the Kanban methodology. - Official website: diff --git a/tests/Dockerfile b/tests/Dockerfile new file mode 100644 index 000000000..e9eba8ef4 --- /dev/null +++ b/tests/Dockerfile @@ -0,0 +1,24 @@ +# This Dockerfile can be used to run unit tests. +# This image is published on the Docker Hub: kanboard/tests:latest +FROM debian:10-slim + +RUN apt-get update -y -q && \ + apt-get install -y \ + php-cli \ + php-mbstring \ + php-sqlite3 \ + php-opcache \ + php-json \ + php-ldap \ + php-gd \ + php-zip \ + php-curl \ + php-xml \ + php-mysql \ + php-pgsql \ + composer \ + npm \ + git \ + make \ + mariadb-client \ + postgresql-client diff --git a/tests/units.postgres.xml b/tests/units.postgres.xml index cf538a820..387c64a21 100644 --- a/tests/units.postgres.xml +++ b/tests/units.postgres.xml @@ -7,7 +7,7 @@ - +