Skip to content

Commit

Permalink
[TASK] Add automatic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed May 7, 2024
1 parent bec1b32 commit 4f5b61e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Main"

on: # yamllint disable-line rule:truthy
pull_request: null
push:
branches:
- "main"

env:
DEFAULT_PHP_VERSION: "8.2"
RUN_ENVIRONMENT: "local"

jobs:
tests:
name : Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.2'
- '8.3'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "locked"

- name: "Run unit tests"
run: "make test-unit ENV=${{ env.RUN_ENVIRONMENT }}"

quality:
name: Quality
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ env.DEFAULT_PHP_VERSION }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "locked"

- name: "CGL"
run: "make code-style ENV=${{ env.RUN_ENVIRONMENT }}"
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PHP_BIN = docker run -it --rm --user $$(id -u):$$(id -g) -v${PWD}:/opt/project -w /opt/project php:8.2-cli php -d memory_limit=1024M
PHP_BIN = docker run --rm --user $$(id -u):$$(id -g) -v${PWD}:/opt/project -w /opt/project php:8.2-cli php -d memory_limit=1024M

.PHONY: help
help: ## Displays this list of targets with descriptions
Expand All @@ -21,3 +21,8 @@ test-unit: ## Run unit test

.PHONY: test
test: fix-code-style test-unit ## Runs all test

.PHONY: code-style
code-style: ## Executes php-cs-fixer with "check" option
@echo "$(ENV_INFO)"
$(PHP_BIN) vendor/bin/php-cs-fixer check

0 comments on commit 4f5b61e

Please sign in to comment.