-
-
Notifications
You must be signed in to change notification settings - Fork 24
77 lines (58 loc) · 2.08 KB
/
Quickstart.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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))