From e01b4d4fef02d054d12c9f015c428a45f3d90de2 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.uk>
Date: Wed, 13 May 2020 03:23:12 +0100
Subject: [PATCH] Add ci.yml

---
 .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++
 .gitignore               |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 .github/workflows/ci.yml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..5b8f818
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,55 @@
+name: CI
+
+on:
+  push: {}
+
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+
+    name: "Run ${{ matrix.test-types }} tests"
+
+    strategy:
+      matrix:
+        test-types:
+          - functional
+          - kernel
+          - unit
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: Cache dependencies
+        uses: actions/cache@v1
+        with:
+          path: ~/.composer/cache/files
+          key: dependencies-composer-${{ hashFiles('composer.json') }}
+
+      - name: Setup PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: 7.4
+          extensions: mbstring
+          coverage: none
+
+      - name: Install the Symfony local web server
+        run: |
+          wget https://get.symfony.com/cli/installer -O - | bash
+          mv /home/runner/.symfony/bin/symfony /usr/local/bin/symfony
+
+      - name: Install dependencies
+        run: composer install --prefer-dist --no-interaction --no-suggest
+
+      - name: Start the local web server
+        run: symfony serve -d
+        if: matrix.test-types == 'functional'
+
+      - name: Execute tests
+        run: vendor/bin/phpunit --testsuite=${{ matrix.test-types }}
+        env:
+          SIMPLETEST_BASE_URL: http://localhost:8000
+
+      - name: Stop the local web server
+        run: symfony server:stop
+        if: matrix.test-types == 'functional'
diff --git a/.gitignore b/.gitignore
index e74fb94..96eb775 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 !*/
 !/.gitignore
 !/**/.gitkeep
+!/.github/**
 !/.idea/**
 !/bin/*
 !/config/**