ctrlv-privatebin/.github/workflows/tests.yml

111 lines
2.9 KiB
YAML
Raw Normal View History

name: Tests
on: [push]
jobs:
Composer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
2021-05-30 09:17:23 +02:00
run: composer install --prefer-dist --no-dev
PHPunit:
2020-05-31 15:53:57 +02:00
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
2021-10-02 00:43:54 +02:00
extensions-cache-key: ${{ runner.os }}-phpextensions
steps:
# let's get started!
- name: Checkout
uses: actions/checkout@v2
# cache PHP extensions
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
2021-10-02 00:43:54 +02:00
key: ${{ env.extensions-cache-key }}
- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
2021-10-02 00:43:54 +02:00
restore-keys: ${{ env.extensions-cache-key }}
- name: Setup PHP
2020-05-31 15:53:57 +02:00
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
# 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@v2
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
- name: Setup PHPunit
run: composer install -n
2021-05-28 22:39:50 +02:00
- 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@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12'
- 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