Skip to content

Commit 79c5e82

Browse files
committed
ci(github): add workflow for automated pipeline
1 parent 017efb5 commit 79c5e82

File tree

2 files changed

+90
-5
lines changed

2 files changed

+90
-5
lines changed

.github/workflows/pipeline.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: pipeline
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
jobs:
16+
tests:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
php: ['8.2', '8.3', '8.4']
21+
dependencies: ['lowest', 'highest']
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
coverage: "none"
31+
32+
- name: Install Composer
33+
uses: "ramsey/composer-install@v3"
34+
with:
35+
dependency-versions: "${{ matrix.dependencies }}"
36+
37+
- name: Composer Validation
38+
run: composer validate --strict
39+
40+
- name: Install PHP Dependencies
41+
run: composer install --no-scripts
42+
43+
- name: Tests
44+
run: vendor/bin/phpunit
45+
46+
qa:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Conventional Commit
53+
uses: ytanikin/[email protected]
54+
if: github.event_name == 'pull_request'
55+
with:
56+
task_types: '["feat", "fix", "docs", "test", "ci", "style", "refactor", "perf", "chore", "revert"]'
57+
add_label: 'true'
58+
custom_labels: '{"feat": "feature", "fix": "bug", "docs": "documentation", "test": "test", "ci": "CI/CD", "style": "codestyle", "refactor": "refactor", "perf": "performance", "chore": "chore", "revert": "revert"}'
59+
60+
- name: Setup PHP
61+
uses: shivammathur/setup-php@v2
62+
with:
63+
php-version: '8.2'
64+
coverage: "none"
65+
66+
- name: Install Composer
67+
uses: "ramsey/composer-install@v3"
68+
69+
- name: Composer Validation
70+
run: composer validate --strict
71+
72+
- name: Install PHP Dependencies
73+
run: composer install --no-scripts
74+
75+
- name: Code Style PHP
76+
run: vendor/bin/php-cs-fixer fix --dry-run
77+
78+
- name: Rector
79+
run: vendor/bin/rector --dry-run
80+
81+
- name: PHPStan
82+
run: vendor/bin/phpstan analyse

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ PHPUNIT = vendor/bin/phpunit
88
.DEFAULT_GOAL = help
99

1010
help: ## Show this help
11-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
11+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
1212

1313
install: ## Install dependencies
1414
$(COMPOSER) install
1515

16-
deps-stable: ## Update dependencies
16+
deps-stable: ## Update dependencies to stable
1717
$(COMPOSER) update --prefer-stable
1818

19-
deps-low: ## Update dependencies
19+
deps-low: ## Update dependencies to lowest
2020
$(COMPOSER) update --prefer-lowest
2121

2222
deps-bump:
@@ -45,6 +45,9 @@ rector: # Run rector
4545

4646
ci: rector cs phpstan tests ## Run all ci tools
4747

48-
ci-stable: deps-stable rector cs phpstan tests
48+
ci-stable: deps-stable rector cs phpstan tests ## Install lowest dependencies and run all ci tools
4949

50-
ci-lowest: deps-low rector cs phpstan tests
50+
ci-lowest: deps-low rector cs phpstan tests ## Install highest dependencies and run all ci tools
51+
52+
ci-github: ## Run github pipeline to validate workflow (prevent push-and-pray)
53+
act push --platform ubuntu-latest=catthehacker/ubuntu:act-latest

0 commit comments

Comments
 (0)