Quickstart #798
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Quickstart | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 6 * * * | |
defaults: | |
run: | |
working-directory: Quickstart | |
jobs: | |
Quickstart: | |
runs-on: ubuntu-latest | |
env: | |
php: 8.1 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP ${{ env.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.php }} | |
- name: Create working directory | |
run: mkdir --verbose "$GITHUB_WORKFLOW" | |
working-directory: | |
- name: Initialize Composer project | |
run: composer init --name foo/bar | |
- name: Configure minimum stability for Amp v3. | |
run: | | |
composer config minimum-stability beta | |
composer config prefer-stable true | |
- name: Require ECB | |
run: composer require provider/european-central-bank | |
- name: Require DI library | |
run: composer require --with-dependencies joomla/di | |
- name: Run PHP script | |
run: | | |
php <<'.' | sed 's/ *//' | tee out | |
<?php | |
use Joomla\DI\Container; | |
use ScriptFUSION\Porter\Import\Import; | |
use ScriptFUSION\Porter\Porter; | |
use ScriptFUSION\Porter\Provider\EuropeanCentralBank\Provider\EuropeanCentralBankProvider; | |
use ScriptFUSION\Porter\Provider\EuropeanCentralBank\Provider\Resource\DailyForexRates; | |
require 'vendor/autoload.php'; | |
$container = new Container; | |
$container->set(EuropeanCentralBankProvider::class, new EuropeanCentralBankProvider); | |
$porter = new Porter($container); | |
$rates = $porter->import(new Import(new DailyForexRates)); | |
foreach ($rates as $rate) { | |
echo "$rate[currency]: $rate[rate]\n"; | |
} | |
. | |
- name: Test output contains USD | |
run: 'grep --perl-regexp ''^USD: [\d.]+$'' out' | |
- name: Test output contains between 30-40 lines | |
run: | | |
echo Lines: ${lines=$(wc --lines <out)} | |
((lines >= 30 && lines <= 40)) |