Skip to content

Commit 88997dd

Browse files
committed
Improve CI/CD config file.
2 parents 9ddbeba + e9ff73f commit 88997dd

File tree

1 file changed

+58
-8
lines changed

1 file changed

+58
-8
lines changed

.github/workflows/main.yml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,57 @@
1+
---
12
name: Build and Test
23

4+
permissions:
5+
contents: read
6+
pull-requests: read
7+
38
on:
49
push:
10+
paths-ignore:
11+
- "*.md"
512
branches:
613
- main
714
pull_request:
15+
paths-ignore:
16+
- "*.md"
817
branches:
918
- main
1019
workflow_dispatch:
1120

21+
env:
22+
COMPOSER_NO_INTERACTION: 1
23+
COMPOSER_PROCESS_TIMEOUT: 300 # Seconds.
24+
1225
jobs:
1326
build:
1427
name: Build & Test
1528
runs-on: ubuntu-latest
29+
continue-on-error: false
1630

1731
steps:
32+
- name: Update platform's packages database
33+
run: sudo apt-get update
34+
35+
- name: Install platform tools
36+
run: sudo apt-get install -y libxml2-utils yamllint jq
37+
1838
- name: Clone project
19-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
40+
41+
- name: Lint YAML files
42+
run: |
43+
find . -type f -name "*.yml" -not -path "./vendor/*" \
44+
-not -path "./.git/*" -exec yamllint {} +
45+
46+
- name: Lint XML files
47+
run: |
48+
find . -type f -name "*.xml" -not -path "./vendor/*" \
49+
-not -path "./.git/*" -exec xmllint --noout {} \;
50+
51+
- name: Lint JSON files
52+
run: |
53+
find . -type f -name "*.json" -not -path "./vendor/*" \
54+
-not -path "./.git/*" -exec sh -c 'jq empty "$0"' {} \;
2055
2156
- name: Setup PHP
2257
uses: shivammathur/setup-php@v2
@@ -25,6 +60,17 @@ jobs:
2560
coverage: none
2661
extensions: pcre
2762
tools: composer:v2
63+
ini-values: memory_limit=256M, zend.assertions=1, \
64+
error_reporting=-1, display_errors=On
65+
66+
- name: Lint PHP files
67+
run: |
68+
set -e
69+
set -o nounset
70+
set -o errexit
71+
set -o pipefail
72+
find . -path ./vendor -prune -o -name "*.php" -print0 \
73+
| xargs -0 -n 1 php -l
2874
2975
- name: Validate manifest file
3076
run: composer validate --strict
@@ -37,22 +83,26 @@ jobs:
3783
restore-keys: ${{ runner.os }}-composer-
3884

3985
- name: Install dependencies
40-
run: composer install --no-interaction --no-progress
86+
run: composer install --no-interaction --no-progress --prefer-dist
4187

4288
- name: Lint project files
4389
run: |
44-
set -e # Stop on error.
45-
find . -path ./vendor -prune -o -name "*.php" -print0 | xargs -0 -n 1 php -l
90+
set -e
91+
set -o nounset
92+
set -o errexit
93+
set -o pipefail
94+
find . -path ./vendor -prune -o -name "*.php" -print0 \
95+
| xargs -0 -n 1 php -l
4696
4797
- name: Lint codes
4898
run: composer lint
4999

50-
- name: Check coding convention
51-
run: composer format-check
52-
53-
- name: Check code refactoring rules
100+
- name: Check refactoring
54101
run: composer refactor-check
55102

103+
- name: Check coding style
104+
run: composer format-check
105+
56106
- name: Security check
57107
run: composer audit
58108

0 commit comments

Comments
 (0)