From 0f8f09b2b0db9580a6e3c19211c8f9be5ad27c48 Mon Sep 17 00:00:00 2001
From: Denis Urban <urbandenis0@gmail.com>
Date: Thu, 3 Aug 2023 19:03:51 +0200
Subject: [PATCH] add gh actions

---
 .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++
 .travis.yml                | 20 ---------------
 2 files changed, 52 insertions(+), 20 deletions(-)
 create mode 100644 .github/workflows/main.yml
 delete mode 100644 .travis.yml

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..686b094
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,52 @@
+name: PHP CI
+
+on:
+  push:
+  pull_request:
+
+defaults:
+  run:
+    shell: bash
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v3
+
+#      - name: Configure sysctl limits
+#        run: |
+#          # sudo swapoff -a
+#          sudo sysctl -w vm.swappiness=1
+#          sudo sysctl -w fs.file-max=262144
+#          sudo sysctl -w vm.max_map_count=262144
+
+#      - name: Runs Elasticsearch
+#        uses: elastic/elastic-github-actions/elasticsearch@master
+#        with:
+#          stack-version: 8.9.0
+
+      - name: Install composer and dependencies
+        uses: php-actions/composer@v6
+
+      - name: PHPUnit Tests
+        uses: php-actions/phpunit@v3
+        env:
+          XDEBUG_MODE: coverage
+        with:
+          bootstrap: vendor/autoload.php
+          configuration: phpunit.xml.dist
+          php_extensions: xdebug
+          args: tests --coverage-clover ./coverage.xml
+
+      - name: Upload to Codecov
+        uses: codecov/codecov-action@v3
+        env:
+          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+        with:
+          files: ./coverage.xml
+          verbose: true
+
+      - name: Run PHP CodeSniffer
+        run: vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/ ./
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c8934ae..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-sudo: false
-language: php
-php:
-  - 8.1
-env:
-  global:
-    - ES_VERSION=8.9.0 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz
-install:
-  - wget ${ES_DOWNLOAD_URL}
-  - tar -xzf elasticsearch-${ES_VERSION}-linux-x86_64.tar.gz
-  - ./elasticsearch-${ES_VERSION}/bin/elasticsearch -d
-before_script:
-  - if [ "$GITHUB_COMPOSER_AUTH" ]; then composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH; fi
-  - composer install --no-interaction --prefer-dist
-script:
-  - wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
-  - vendor/bin/phpunit --coverage-clover=coverage.xml
-  - vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/ ./
-after_script:
-  - travis_retry bash <(curl -s https://codecov.io/bash)
-- 
GitLab