This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
generated from narrowspark/php-library-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (103 loc) · 4.25 KB
/
continuous-integration-windows.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
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
118
119
120
121
122
123
124
125
126
127
128
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Continuous Integration on Windows"
on:
push:
paths:
- "**.php"
- "composer.json"
pull_request:
paths:
- "**.php"
- "composer.json"
jobs:
WindowsIntegration:
name: "PHP ${{ matrix.php-versions }} Test on windows-latest OS with ${{ matrix.dependencies }} dependencies"
runs-on: windows-latest
strategy:
matrix:
php-versions: ["7.3", "7.4"]
dependencies: ["highest", "lowest"]
env:
key: "continuous-integration-windows-v1" # change key (version) to clear cache
extensions: "mbstring"
ini-values: "date.timezone=Europe/Berlin, opcache.enable_cli=1, serialize_precision=14"
tools: "composer, composer-prefetcher"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: "Setup cache environment"
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: "Cache extensions"
uses: actions/cache@v1
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
ini-values: ${{ env.ini-values }}
tools: ${{ env.tools }}
coverage: none
- name: "Configure container"
env:
NARROWSPARK_EMAIL: ${{ secrets.NARROWSPARK_EMAIL }}
NARROWSPARK_USERNAME: ${{ secrets.NARROWSPARK_USERNAME }}
run: |
$SOURCE_NAME = ${env:GITHUB_REF} -replace 'refs\/\w+\/', ''
$SOURCE_BRANCH = ${env:GITHUB_REF} -replace 'refs\/heads\/', ''
$SOURCE_TAG = ${env:GITHUB_REF} -replace 'refs\/tags\/', ''
echo "::set-env name=PHPUNIT::.\vendor\bin\phpunit --verbose"
echo "::set-env name=COMPOSER_UP::composer update --no-progress --no-interaction --ansi"
echo "::set-env name=SOURCE_NAME::$SOURCE_NAME"
echo "::set-env name=SOURCE_BRANCH::$SOURCE_BRANCH"
echo "::set-env name=SOURCE_TAG::$SOURCE_TAG"
if (${env:NARROWSPARK_EMAIL}) {
git config --global user.email "${env:NARROWSPARK_EMAIL}"
} else {
git config --global user.email "d.bannert@anolilab.de"
}
if (${env:NARROWSPARK_USERNAME}) {
git config --global user.name "${env:NARROWSPARK_USERNAME}"
} else {
git config --global user.name "prisis"
}
- name: "Setup Problem Matchers for PHP"
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: "Check PHP Version"
run: php -v
#- name: "List all php extensions with versions"
# run: php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
- name: "Setup Problem Matchers for PHPUnit"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: "Check Composer Version"
run: composer -V
- name: "Validate composer.json and composer.lock"
run: composer validate --strict
- name: "Get Composer Cache Directory"
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: "Install highest dependencies"
if: matrix.dependencies == 'highest'
shell: pwsh
run: Invoke-Expression -Command ${env:COMPOSER_UP}
- name: "Install lowest dependencies"
if: matrix.dependencies == 'lowest'
shell: pwsh
run: Invoke-Expression -Command "${env:COMPOSER_UP} --prefer-lowest --prefer-stable"
- name: "Run Test's Suite"
run: Invoke-Expression -Command "${env:PHPUNIT}"