PrivateBin/.github/workflows/tests.yml
rugk 79fd33d21f
chore: run tests with NodeJS 14
I expect no stuff to break or so, so let's just try to use the current recommend LTS version. (v14 will also die at some time, but Fedora e.g. still seems to use it for now by default. Likely we may upgrade soon even more.)

Ref https://nodejs.org/en/about/releases/
2022-07-09 16:57:06 +02:00

122 lines
3.3 KiB
YAML

name: Tests
on: [push]
jobs:
Composer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-dev
PHPunit:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
name: PHP ${{ matrix.php-versions }} unit tests on ${{ matrix.operating-system }}
env:
extensions: gd, sqlite3
extensions-cache-key-name: phpextensions
steps:
# let's get started!
- name: Checkout
uses: actions/checkout@v3
# cache PHP extensions
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ runner.os }}-${{ env.extensions-cache-key }}
- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ runner.os }}-${{ env.extensions-cache-key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
# Setup GitHub CI PHP problem matchers
# https://github.com/shivammathur/setup-php#problem-matchers
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
# composer cache
- name: Remove composer lock
run: rm composer.lock
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
# http://man7.org/linux/man-pages/man1/date.1.html
# https://github.com/actions/cache#creating-a-cache-key
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-
# composer installation
- name: Setup PHPunit
run: composer install -n
- name: Install Google Cloud Storage
run: composer require google/cloud-storage
# testing
- name: Run unit tests
run: ../vendor/bin/phpunit --no-coverage
working-directory: tst
Mocha:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'npm'
cache-dependency-path: 'js/package.json'
- name: Setup Mocha
run: npm install -g mocha
- name: Setup Node modules
run: npm install
working-directory: js
- name: Run unit tests
run: mocha
working-directory: js