-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (98 loc) · 4.08 KB
/
tests.yml
File metadata and controls
117 lines (98 loc) · 4.08 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Tests
on:
pull_request:
merge_group:
types:
- checks_requested
push:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.php == '8.5' }}
strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3", "8.4", "8.5"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Run unit tests (coverage leg)
if: matrix.php == '8.1'
run: composer test:coverage:ci
- name: Run unit tests
if: matrix.php != '8.1'
run: composer test:unit
- name: Upload coverage to Codecov
if: matrix.php == '8.1'
uses: codecov/codecov-action@v5
with:
files: build/coverage.xml
slug: oblakhost/rnids-rsreg-client-php
token: ${{ secrets.CODECOV_TOKEN }}
integration-live:
name: Integration (live RNIDS)
runs-on: ubuntu-latest
needs: unit-tests
env:
RNIDS_EPP_USER: ${{ secrets.RNIDS_EPP_USER }}
RNIDS_EPP_PASS: ${{ secrets.RNIDS_EPP_PASS }}
RNIDS_EPP_CERT: ${{ secrets.RNIDS_EPP_CERT }}
RNIDS_EPP_ROOT: ${{ secrets.RNIDS_EPP_ROOT }}
steps:
- name: Checkout
if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }}
uses: actions/checkout@v4
- name: Setup PHP
if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }}
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
- name: Cache Composer dependencies
if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }}
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-php-8.1-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-8.1-composer-
- name: Install dependencies
if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }}
run: composer install --prefer-dist --no-progress --no-interaction
- name: Prepare RNIDS certificate fixtures
if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }}
run: |
mkdir -p tests/fixtures
printf '%s' '${{ secrets.RNIDS_EPP_CERT }}' > tests/fixtures/client.pem
printf '%s' '${{ secrets.RNIDS_EPP_ROOT }}' > tests/fixtures/root.pem
chmod 600 tests/fixtures/client.pem tests/fixtures/root.pem
- name: Run live integration tests
if: ${{ env.RNIDS_EPP_USER != '' && env.RNIDS_EPP_PASS != '' && env.RNIDS_EPP_CERT != '' && env.RNIDS_EPP_ROOT != '' }}
env:
RNIDS_EPP_USERNAME: ${{ secrets.RNIDS_EPP_USER }}
RNIDS_EPP_PASSWORD: ${{ secrets.RNIDS_EPP_PASS }}
RNIDS_EPP_CLIENT_CERT_PATH: tests/fixtures/client.pem
RNIDS_EPP_CA_CERT_PATH: tests/fixtures/root.pem
run: composer test:live
- name: Skip live integration tests (missing RNIDS secrets)
if: ${{ env.RNIDS_EPP_USER == '' || env.RNIDS_EPP_PASS == '' || env.RNIDS_EPP_CERT == '' || env.RNIDS_EPP_ROOT == '' }}
run: echo "RNIDS live integration job skipped because required secrets are missing."