-
-
Notifications
You must be signed in to change notification settings - Fork 20
106 lines (90 loc) · 3.54 KB
/
callable-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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Callable Test
on:
workflow_call:
inputs:
directory:
required: true
type: string
docker:
required: true
type: boolean
jobs:
test:
name: "PHP ${{ matrix.php-version }}"
runs-on: ubuntu-latest
env: ${{ secrets }}
strategy:
fail-fast: false
matrix:
include:
- php-version: '8.2'
dependency-versions: 'lowest'
- php-version: '8.3'
dependency-versions: 'highest'
- php-version: '8.4'
dependency-versions: 'highest'
steps:
- name: Output infos
run: |
echo "${{ github.event.pull_request.merge_commit_sha }}"
echo "${{ github.event.pull_request.head.sha }}"
- name: Checkout project
uses: actions/checkout@v4
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Git infos
run: |
git rev-parse HEAD
git branch --show-current
- name: Start Docker services
if: ${{ inputs.docker }}
working-directory: ${{ inputs.directory }}
run: |
docker compose up --wait
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: 'composer:v2'
ini-values: memory_limit=-1, zend.assertions=1
coverage: none
- name: Install composer dependencies
uses: ramsey/composer-install@v2
env:
COMPOSER_ROOT_VERSION: 0.6.x-dev
with:
working-directory: ${{ inputs.directory }}
dependency-versions: ${{ matrix.dependency-versions }}
- name: Check symlinks
working-directory: ${{ inputs.directory }}
run: |
ls -lah vendor/cmsig || true
check_directory() {
directory="vendor/cmsig"
# Check if the directory exists
if [ -d "$directory" ]; then
# Loop through all directories in the specified directory
for dir in "$directory"/*; do
# Check if the directory is a symlink
if [ ! -L "$dir" ]; then
echo "Directory $dir is not a symlink"
return 1
fi
done
echo "All directories in $directory are symlinks"
return 0
fi
}
check_directory
- name: Generate UUID
id: uuid
# GitHub does not provide any parameter which is unique inside a workflow
# so instead of using GitHub variables we require to generate a unique id
run: |
echo "uuid=$(uuidgen)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Run tests
run: composer test
working-directory: ${{ inputs.directory }}
env:
TEST_INDEX_PREFIX: 'test_${{ steps.uuid.outputs.uuid }}_'