-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (76 loc) · 2.6 KB
/
unit-and-integration-test.yml
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
name: Unit & integration tests
on:
push:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
inputs:
unit_tests:
type: boolean
description: Run Unit tests
default: true
integration_tests:
type: boolean
description: Run Integration tests
default: true
permissions:
contents: read
jobs:
test-suite:
strategy:
fail-fast: false
matrix:
php-version: ['7.2','7.3','7.4','8.0','8.1', '8.2']
name: Unit and integration test
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
env:
EXTENSION_PATH: "my-code/common"
steps:
- name: Clone DDEV files
uses: actions/checkout@v3
with:
path: .ddev
repository: julienloizelet/ddev-php
ref: "main"
- name: Install DDEV
env:
DDEV_VERSION: v1.21.4
run: |
# @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
sudo apt-get -qq update
sudo apt-get -qq -y install libnss3-tools
curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh
bash install_ddev.sh ${{env.DDEV_VERSION}}
ddev config global --instrumentation-opt-in=false --omit-containers=dba,ddev-ssh-agent
rm install_ddev.sh
- name: Set PHP_VERSION_CODE env
# used in some directory path and conventional file naming
# Example : 7.4 => 74
run: |
echo "PHP_VERSION_CODE=$(echo php${{ matrix.php-version }} | sed 's/\.//g' )" >> $GITHUB_ENV
- name: Start DDEV with PHP ${{ matrix.php-version }}
run: |
cp .ddev/config_overrides/config.${{ env.PHP_VERSION_CODE }}.yaml .ddev/config.${{ env.PHP_VERSION_CODE }}.yaml
ddev start
- name: Some DEBUG information
run: |
ddev --version
ddev exec php -v
- name: Clone sources
uses: actions/checkout@v3
with:
path: ${{env.EXTENSION_PATH}}
- name: Validate composer.json
run: |
ddev composer validate --strict --working-dir ./${{env.EXTENSION_PATH}}
- name: Install dependencies
run: |
ddev composer update --working-dir ./${{env.EXTENSION_PATH}}
- name: Run Unit tests
if: |
github.event.inputs.unit_tests == 'true' ||
github.event_name == 'push'
run: ddev php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --debug ./${{env.EXTENSION_PATH}}/tests/Unit --testdox