Skip to content

Commit 0ec544d

Browse files
authored
Merge pull request #25 from lion-packages/support
Updated Github Actions settings
2 parents d5fedd6 + 7d38f53 commit 0ec544d

25 files changed

+294
-3762
lines changed

.github/workflows/php.yml

Lines changed: 39 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Lion-Route (CI Workflow)
33
on:
44
push:
55
branches:
6-
- actions-sleon
7-
- actions-saco
6+
- main
7+
- actions
88
pull_request:
99
branches:
1010
- main
@@ -34,43 +34,23 @@ jobs:
3434
php-version: '8.4'
3535
extensions: mbstring, gd, zip
3636

37+
- name: Composer Install
38+
run: composer install
39+
3740
- name: Composer Validate
3841
run: composer validate --strict
3942

4043
- name: Composer Check for vulnerabilities
4144
run: composer audit --locked
4245

43-
- name: Composer Install
44-
run: composer install
45-
4646
- name: Composer Dump-Autoload
4747
run: composer dump-autoload --optimize --strict-psr
4848

49-
docker-validation:
50-
runs-on: ubuntu-latest
51-
name: Docker Validation
52-
53-
steps:
54-
- name: Check out the repository
55-
uses: actions/checkout@v4
56-
57-
- name: Cache Docker layers
58-
uses: actions/cache@v3
59-
with:
60-
path: /tmp/.buildx-cache
61-
key: ${{ runner.os }}-buildx-${{ github.sha }}
62-
restore-keys: |
63-
${{ runner.os }}-buildx-
64-
65-
- name: Validate Docker Compose configuration
66-
run: docker compose config
67-
6849
code-analyze:
6950
runs-on: ubuntu-latest
7051
name: PHP Code Analyze
7152
needs:
7253
- composer-validation
73-
- docker-validation
7454

7555
steps:
7656
- name: Check out the repository
@@ -83,13 +63,19 @@ jobs:
8363
extensions: mbstring, gd, zip
8464

8565
- name: Composer Install
86-
run: composer install
66+
run: composer install --dev
8767

8868
- name: PHP CodeSnifer (Src)
89-
run: php -d memory_limit=-1 vendor/bin/phpcs --standard=PSR12 src/
69+
run: php -d memory_limit=-1 vendor/bin/phpcs --standard=PSR12 src
70+
71+
- name: PHPStan (Src)
72+
run: php -d memory_limit=-1 vendor/bin/phpstan analyse --level max src
73+
74+
- name: PHP CodeSnifer (Tests)
75+
run: php -d memory_limit=-1 vendor/bin/phpcs --standard=PSR12 --ignore=tests/build/\* tests
9076

91-
# - name: PHPStan (Src)
92-
# run: php -d memory_limit=-1 vendor/bin/phpstan analyse --level max src
77+
- name: PHPStan (Tests)
78+
run: php -d memory_limit=-1 vendor/bin/phpstan analyse --level max tests
9379

9480
tests:
9581
runs-on: ubuntu-latest
@@ -100,28 +86,30 @@ jobs:
10086
- name: Checkout repository
10187
uses: actions/checkout@v4
10288

103-
- name: Set up Docker Buildx
104-
uses: docker/setup-buildx-action@v2
105-
106-
- name: Tear down containers
107-
run: docker compose down --volumes --remove-orphans
108-
109-
- name: Stop running Docker containers (if any)
110-
run: |
111-
docker ps -q | xargs -r docker stop
112-
docker ps -aq | xargs -r docker rm
113-
114-
- name: Build the Docker image
115-
run: docker build -t route-app .
89+
- name: Setup PHP
90+
uses: shivammathur/setup-php@v2
91+
with:
92+
php-version: 8.4
93+
extensions: mbstring, gd, zip, xdebug
94+
coverage: xdebug
95+
ini-values: |
96+
opcache.jit=0
97+
xdebug.mode=coverage
98+
xdebug.start_with_request=yes
99+
xdebug.log_level=0
100+
tools: composer
101+
102+
- name: Install php dependencies
103+
run: composer install
116104

117-
- name: Start services using Docker Compose
118-
run: |
119-
docker compose -f docker-compose.yml up -d
120-
env:
121-
COMPOSE_PROJECT_NAME: test
105+
- name: Run local server
106+
run: php -S 0.0.0.0:8000 -t public &
122107

123-
- name: Install Composer dependencies
124-
run: docker exec route-app composer install
108+
- name: Run tests
109+
run: php vendor/bin/phpunit --coverage-clover tests/build/logs/clover.xml --coverage-html tests/build/coverage
125110

126-
- name: Run PHP Tests
127-
run: docker exec route-app php vendor/bin/phpunit
111+
- name: Upload coverage reports to Codecov
112+
uses: codecov/codecov-action@v5
113+
with:
114+
files: tests/build/logs/clover.xml
115+
token: ${{ secrets.CODECOV_TOKEN_LION_ROUTE }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea/
22
/vendor/
3-
.phpunit.result.cache
43
/tests/build/
4+
.phpunit.result.cache
5+
composer.lock

Dockerfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ USER lion
3737

3838
SHELL ["/bin/bash", "--login", "-i", "-c"]
3939

40-
# Install nvm, Node.js and npm
41-
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
42-
&& source /home/lion/.bashrc \
43-
&& nvm install 20 \
44-
&& npm install -g npm
45-
4640
# Install OhMyZsh
4741
RUN sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
4842
# ----------------------------------------------------------------------------------------------------------------------
@@ -57,10 +51,7 @@ RUN wget https://github.com/Yash-Handa/logo-ls/releases/download/v1.3.7/logo-ls_
5751
&& curl https://raw.githubusercontent.com/UTFeight/logo-ls-modernized/master/INSTALL | bash
5852

5953
# Add configuration in .zshrc
60-
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> /home/lion/.zshrc \
61-
&& echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /home/lion/.zshrc \
62-
&& echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> /home/lion/.zshrc \
63-
&& echo 'alias ls="logo-ls"' >> /home/lion/.zshrc \
54+
RUN echo 'alias ls="logo-ls"' >> /home/lion/.zshrc \
6455
&& source /home/lion/.zshrc
6556
# ----------------------------------------------------------------------------------------------------------------------
6657
# Copy Data

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"lion/phroute": "^2.3"
1919
},
2020
"require-dev": {
21-
"guzzlehttp/guzzle": "^7.8",
22-
"lion/test": "^2.0",
23-
"phpunit/phpunit": "^11.1",
24-
"lion/security": "^9.1",
25-
"lion/request": "^6.9",
26-
"lion/exceptions": "^1.2",
27-
"lion/dependency-injection": "^3.0",
21+
"lion/test": "^3.2",
22+
"guzzlehttp/guzzle": "^7.9",
23+
"phpunit/phpunit": "^11.5",
24+
"lion/security": "^11.1",
25+
"lion/request": "^7.2",
26+
"lion/exceptions": "^2.0",
2827
"phpstan/phpstan": "^2.1",
29-
"squizlabs/php_codesniffer": "^3.11"
28+
"squizlabs/php_codesniffer": "^3.11",
29+
"lion/dependency-injection": "^4.2"
3030
}
3131
}

0 commit comments

Comments
 (0)