-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (46 loc) · 2.13 KB
/
php-docker-compose.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
name: PHP 8.2 with Docker Compose
on:
push:
branches:
- main # Change this to your main branch name
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
if: runner.os == 'Linux'
- name: Log in to Docker Hub (if needed)
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: env.username != '' && env.password != ''
- name: Build and run containers
run: |
docker-compose up composer
docker-compose up --detach php db
docker compose exec php composer install --optimize-autoloader --ignore-platform-reqs
docker-compose exec php vendor/bin/codecept build --quiet
working-directory: ./ # Change this to your project's directory
- name: Execute code sniffer
run: |
docker-compose exec php composer cs-check
working-directory: ./ # Change this to your project's directory
- name: Execute phpstan
run: |
docker-compose exec php composer phpstan
working-directory: ./ # Change this to your project's directory
- name: Run tests
run: |
docker-compose exec php composer tests
working-directory: ./ # Change this to your project's directory
- name: Stop and remove containers
run: |
docker-compose down
working-directory: ./ # Change this to your project's directory