From f0d2c1638c230a6041f800d4edb3cf6d76291303 Mon Sep 17 00:00:00 2001
From: Vincent Wong <vincentwwy168@gmail.com>
Date: Wed, 27 Nov 2024 17:50:20 +0800
Subject: [PATCH] Add CI/CD workflows

---
 .github/workflows/ubuntu_l10.yml | 51 ++++++++++++++++++++++++++++++++
 .github/workflows/ubuntu_l11.yml | 51 ++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+)
 create mode 100644 .github/workflows/ubuntu_l10.yml
 create mode 100644 .github/workflows/ubuntu_l11.yml

diff --git a/.github/workflows/ubuntu_l10.yml b/.github/workflows/ubuntu_l10.yml
new file mode 100644
index 0000000..c0b38a1
--- /dev/null
+++ b/.github/workflows/ubuntu_l10.yml
@@ -0,0 +1,51 @@
+name: PHP Composer (Ubuntu; Laravel 10)
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+permissions:
+  contents: read
+
+jobs:
+  build:
+
+    # ubuntu-latest has PHP 8.1
+    # see https://github.com/marketplace/actions/setup-php-action
+    # specify PHP 8.1 to test Laravel 10
+    runs-on: ubuntu-20.04
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: Setup PHP with PECL extension
+      uses: shivammathur/setup-php@v2
+      with:
+        php-version: '8.1'
+
+    - name: Validate composer.json and composer.lock
+      run: composer validate --strict
+
+    - name: Cache Composer packages
+      id: composer-cache
+      uses: actions/cache@v3
+      with:
+        path: vendor
+        key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
+        restore-keys: |
+          ${{ runner.os }}-php-
+
+    - name: Install dependencies
+      run: composer install --prefer-dist --no-progress
+
+    # dump autoload to "boot" our custom mock artisan
+    - name: Dump auto-load details
+      run: composer dump-autoload
+
+    # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
+    # Docs: https://getcomposer.org/doc/articles/scripts.md
+
+    - name: Run test suite
+      run: composer run-script test
diff --git a/.github/workflows/ubuntu_l11.yml b/.github/workflows/ubuntu_l11.yml
new file mode 100644
index 0000000..6ec472f
--- /dev/null
+++ b/.github/workflows/ubuntu_l11.yml
@@ -0,0 +1,51 @@
+name: PHP Composer (Ubuntu; Laravel 11)
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+permissions:
+  contents: read
+
+jobs:
+  build:
+
+    # ubuntu-latest has PHP 8.1
+    # see https://github.com/marketplace/actions/setup-php-action
+    # specify PHP 8.2 to test Laravel 11
+    runs-on: ubuntu-20.04
+
+    steps:
+    - uses: actions/checkout@v4
+
+    - name: Setup PHP with PECL extension
+      uses: shivammathur/setup-php@v2
+      with:
+        php-version: '8.2'
+
+    - name: Validate composer.json and composer.lock
+      run: composer validate --strict
+
+    - name: Cache Composer packages
+      id: composer-cache
+      uses: actions/cache@v3
+      with:
+        path: vendor
+        key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
+        restore-keys: |
+          ${{ runner.os }}-php-
+
+    - name: Install dependencies
+      run: composer install --prefer-dist --no-progress
+
+    # dump autoload to "boot" our custom mock artisan
+    - name: Dump auto-load details
+      run: composer dump-autoload
+
+    # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
+    # Docs: https://getcomposer.org/doc/articles/scripts.md
+
+    - name: Run test suite
+      run: composer run-script test