forked from cebe/yii2-openapi
-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (57 loc) · 2.01 KB
/
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
name: yii2-openapi
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
test:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
name: yii2-openapi (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
env:
DB_USERNAME: dbuser
DB_PASSWORD: dbpass
DB_CHARSET: utf8
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- uses: actions/checkout@v3
- name: Set PHP Version
run: echo "PHP_VERSION=${{ matrix.php-versions }}" > .env
# Run every tests inside Docker container
- name: Docker Compose Setup
uses: ndeloof/[email protected]
with:
# version: v3.5 # defaults to 'latest'
legacy: true # will also install in PATH as `docker-compose`
- name: Clean
run: make clean_all
- name: docker-compose up
run: make up
# https://github.com/shivammathur/setup-php?tab=readme-ov-file#cache-composer-dependencies
- name: Get composer cache directory
id: composer-cache
run: echo "dir=./tests/tmp/.composer/cache/files" >> $GITHUB_OUTPUT
- name: Make tests dir writable for restoring cache in next step
run: make tests_dir_write_permission
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Docker and composer dependencies
run: docker-compose exec php php -v && make installdocker
- name: Migrate
run: make UID=0 migrate
- name: Check style
if: "!contains(matrix.php-versions, '8.')"
run: make check-style-from-host
- name: Run tests
run: make UID=0 testdocker