From 40d0f939bae08c8b48dcee27c7e0825c4dfa09f9 Mon Sep 17 00:00:00 2001
From: Paragon Initiative Enterprises <security@paragonie.com>
Date: Sun, 18 Apr 2021 14:51:59 -0400
Subject: [PATCH] Switch from Travis CI to Github Actions

---
 .github/workflows/ci.yml | 101 +++++++++++++++++++++++++++++++++++++++
 .travis.yml              |  24 ----------
 README.md                |   2 +-
 psalm.xml                |   3 ++
 4 files changed, 105 insertions(+), 25 deletions(-)
 create mode 100644 .github/workflows/ci.yml
 delete mode 100644 .travis.yml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..da71570
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,101 @@
+name: CI
+
+on: [push]
+
+jobs:
+  old:
+    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
+    runs-on: ${{ matrix.operating-system }}
+    strategy:
+      matrix:
+        operating-system: ['ubuntu-16.04']
+        php-versions: ['7.0']
+        phpunit-versions: ['6.5.14']
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Setup PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php-versions }}
+          extensions: mbstring, intl
+          ini-values: post_max_size=256M, max_execution_time=180
+          tools: psalm, phpunit:${{ matrix.phpunit-versions }}
+
+      - name: Install dependencies
+        run: composer self-update --1; composer install
+
+      - name: PHPUnit tests
+        uses: php-actions/phpunit@v2
+        with:
+          memory_limit: 256M
+
+      - name: Static Analysis
+        run: vendor/bin/psalm
+
+  moderate:
+    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
+    runs-on: ${{ matrix.operating-system }}
+    strategy:
+      matrix:
+        operating-system: ['ubuntu-latest']
+        php-versions: ['7.1', '7.2', '7.3']
+        phpunit-versions: ['latest']
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Setup PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php-versions }}
+          extensions: mbstring, intl, sodium
+          ini-values: post_max_size=256M, max_execution_time=180
+          tools: psalm, phpunit:${{ matrix.phpunit-versions }}
+
+      - name: Install dependencies
+        run: composer install
+
+      - name: Modernize dependencies
+        run: composer require --dev "phpunit/phpunit:>=4"
+
+      - name: PHPUnit tests
+        uses: php-actions/phpunit@v2
+        timeout-minutes: 30
+        with:
+          memory_limit: 256M
+
+      - name: Static Analysis
+        run: vendor/bin/psalm
+
+  modern:
+    name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
+    runs-on: ${{ matrix.operating-system }}
+    strategy:
+      matrix:
+        operating-system: ['ubuntu-latest']
+        php-versions: ['7.4', '8.0']
+        phpunit-versions: ['latest']
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Setup PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php-versions }}
+          extensions: mbstring, intl, sodium
+          ini-values: post_max_size=256M, max_execution_time=180
+          tools: psalm, phpunit:${{ matrix.phpunit-versions }}
+
+      - name: Install dependencies
+        run: composer install
+      - name: PHPUnit tests
+        uses: php-actions/phpunit@v2
+        timeout-minutes: 30
+        with:
+          memory_limit: 256M
+
+      - name: Static Analysis
+        run: vendor/bin/psalm
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 117c114..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-language: php
-sudo: false
-
-matrix:
-  fast_finish: true
-  include:
-    - php: "7.1"
-    - php: "7.2"
-    - php: "7.3"
-    - php: "7.4"
-    - php: "8.0"
-    - php: "nightly"
-  allow_failures:
-    - php: "nightly"
-    - php: "7.4"
-    - php: "8.0"
-
-install:
-    - composer self-update
-    - composer update
-
-script:
-    - vendor/bin/phpunit
-    - vendor/bin/psalm
diff --git a/README.md b/README.md
index d7db2a2..d39cc66 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Constant-Time Encoding
 
-[![Build Status](https://travis-ci.org/paragonie/constant_time_encoding.svg?branch=master)](https://travis-ci.org/paragonie/constant_time_encoding)
+[![Build Status](https://github.com/paragonie/constant_time_encoding/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/constant_time_encoding/actions)
 [![Latest Stable Version](https://poser.pugx.org/paragonie/constant_time_encoding/v/stable)](https://packagist.org/packages/paragonie/constant_time_encoding)
 [![Latest Unstable Version](https://poser.pugx.org/paragonie/constant_time_encoding/v/unstable)](https://packagist.org/packages/paragonie/constant_time_encoding)
 [![License](https://poser.pugx.org/paragonie/constant_time_encoding/license)](https://packagist.org/packages/paragonie/constant_time_encoding)
diff --git a/psalm.xml b/psalm.xml
index 0a17264..dade79a 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -6,4 +6,7 @@
     <projectFiles>
         <directory name="src" />
     </projectFiles>
+    <issueHandlers>
+        <UnnecessaryVarAnnotation errorLevel="info" />
+    </issueHandlers>
 </psalm>
-- 
GitLab