forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (91 loc) · 3.52 KB
/
test-autoreview.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Automatic Code Review
on:
pull_request:
paths:
- composer.json
- spark
- '**.php'
- .github/workflows/test-autoreview.yml
push:
paths:
- composer.json
- spark
- '**.php'
- .github/workflows/test-autoreview.yml
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
auto-review-tests:
uses: ./.github/workflows/reusable-serviceless-phpunit-test.yml # @TODO Extract to codeigniter4/.github repo
with:
job-name: Automatic Code Review [PHP 8.1]
php-version: '8.1'
job-id: auto-review-tests
group-name: AutoReview
composer-normalize-tests:
name: Check normalized composer.json
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Install dependencies
run: composer update
- name: Run on root composer.json
id: normalize-root-composer
if: ${{ always() }}
run: |
echo "ROOT_COMPOSER_RESULT<<RCR" >> $GITHUB_OUTPUT
echo "$(composer normalize)" >> $GITHUB_OUTPUT
echo "RCR" >> $GITHUB_OUTPUT
- name: Run on framework composer.json
id: normalize-framework-composer
if: ${{ always() }}
working-directory: admin/framework
run: |
echo "FRAMEWORK_COMPOSER_RESULT<<FCR" >> $GITHUB_OUTPUT
echo "$(composer normalize)" >> $GITHUB_OUTPUT
echo "FCR" >> $GITHUB_OUTPUT
- name: Run on starter composer.json
id: normalize-starter-composer
if: ${{ always() }}
working-directory: admin/starter
run: |
echo "STARTER_COMPOSER_RESULT<<SCR" >> $GITHUB_OUTPUT
echo "$(composer normalize)" >> $GITHUB_OUTPUT
echo "SCR" >> $GITHUB_OUTPUT
- name: Analyse normalization results
run: |
if [[ '${{ steps.normalize-root-composer.conclusion }}' == 'failure' ]]; then
echo 'Normalization of root composer.json encountered a problem.';
echo 'Please run it locally: `composer normalize`';
exit 1;
fi
if [[ ${{ contains(steps.normalize-root-composer.outputs.ROOT_COMPOSER_RESULT, 'Successfully normalized') }} == true ]]; then
echo 'Root composer.json is not yet normalized.';
exit 1;
fi
if [[ '${{ steps.normalize-framework-composer.conclusion }}' == 'failure' ]]; then
echo 'Normalization of framework composer.json encountered a problem.';
echo 'Please run it locally: `composer normalize -d admin/framework`';
exit 1;
fi
if [[ ${{ contains(steps.normalize-framework-composer.outputs.FRAMEWORK_COMPOSER_RESULT, 'Successfully normalized') }} == true ]]; then
echo 'Framework composer.json is not yet normalized.';
exit 1;
fi
if [[ '${{ steps.normalize-starter-composer.conclusion }}' == 'failure' ]]; then
echo 'Normalization of starter composer.json encountered a problem.';
echo 'Please run it locally: `composer normalize -d admin/starter`';
exit 1;
fi
if [[ ${{ contains(steps.normalize-starter-composer.outputs.STARTER_COMPOSER_RESULT, 'Successfully normalized') }} == true ]]; then
echo 'Starter composer.json is not yet normalized.';
exit 1;
fi