55 - main
66
77jobs :
8- pre-merge-checks :
8+ composer :
9+ name : Build AZQS with composer
910 runs-on : ubuntu-latest
1011 steps :
12+ - name : Set up PHP
13+ uses : shivammathur/setup-php@v2
14+ with :
15+ php-version : ' 8.2'
16+ extensions : mbstring, intl
17+ tools : composer:v2
18+
1119 - name : Checkout branch
1220 uses : actions/checkout@v4
1321 with :
1422 ref : ${{ github.head_ref }}
1523
16- - name : Check for branch in Quickstart repo
24+ - name : Check for matching branch in Quickstart repo
1725 id : check-quickstart-branch
1826 run : |
19- EXISTS=$(gh api repos/az-digital/az_quickstart/branches/${{ github.head_ref }} -q '.name' || echo '')
20- if [[ -z $EXISTS ]]; then
21- echo "QUICKSTART_BRANCH_NAME=main" >> $GITHUB_ENV
27+ if [ $(git ls-remote --heads https://github.com/az-digital/az_quickstart.git ${{ github.head_ref }} | wc -l) = 1 ]; then
28+ echo "QUICKSTART_BRANCH_NAME=${{ github.head_ref }}" >> ${GITHUB_ENV}
2229 else
23- echo "QUICKSTART_BRANCH_NAME=${{ github.head_ref }} " >> $GITHUB_ENV
30+ echo "QUICKSTART_BRANCH_NAME=main " >> ${ GITHUB_ENV}
2431 fi
2532
26- - name : Check for branch in scaffolding repo
33+ - name : Check for matching branch in scaffolding repo
2734 id : check-scaffolding-branch
2835 run : |
29- EXISTS=$(gh api repos/az-digital/az-quickstart-scaffolding/branches/${{ github.head_ref }} -q '.name' || echo '')
30- if [[ -z $EXISTS ]]; then
31- echo "SCAFFOLDING_BRANCH_NAME=main" >> $GITHUB_ENV
36+ if [ $(git ls-remote --heads https://github.com/az-digital/az-quickstart-scaffolding.git ${{ github.head_ref }} | wc -l) = 1 ]; then
37+ echo "SCAFFOLDING_BRANCH_NAME=${{ github.head_ref }}" >> ${GITHUB_ENV}
3238 else
33- echo "SCAFFOLDING_BRANCH_NAME=${{ github.head_ref }} " >> $GITHUB_ENV
39+ echo "SCAFFOLDING_BRANCH_NAME=main " >> ${ GITHUB_ENV}
3440 fi
3541
3642 - name : Checkout scaffolding repo
@@ -40,28 +46,47 @@ jobs:
4046 ref : ${{ env.SCAFFOLDING_BRANCH_NAME }}
4147 path : az-quickstart-scaffolding
4248
43- - name : Set up PHP
44- uses : shivammathur/setup-php@v2
45- with :
46- php-version : ' 8.1'
47- extensions : mbstring, intl
48- tools : composer:v2
49-
5049 - name : Build Arizona Quickstart
5150 run : |
5251 composer self-update
5352 cd $GITHUB_WORKSPACE/az-quickstart-scaffolding
5453 composer config repositories.az_quickstart vcs https://github.com/az-digital/az_quickstart.git
5554 composer config use-github-api false
56- composer require --no-update drupal/core-recommended:* zaporylie/composer-drupal-optimizations:* az-digital/az_quickstart:dev-${{ env.QUICKSTART_BRANCH_NAME }}
55+ composer require --no-update az-digital/az_quickstart:dev-${{ env.QUICKSTART_BRANCH_NAME }}
5756 composer require --no-update --dev az-digital/az-quickstart-dev:dev-${{ github.head_ref }}
5857 composer install -o
5958
59+ - name : Save build artifact
60+ uses : actions/cache/save@v4
61+ with :
62+ path : ${{ github.workspace }}/az-quickstart-scaffolding
63+ key : azqs-build-${{ github.sha }}
64+
65+ phpcs :
66+ name : PHP_CodeSniffer
67+ needs : composer
68+ runs-on : ubuntu-latest
69+ steps :
70+ - name : Restore build artifact cache
71+ uses : actions/cache/restore@v4
72+ with :
73+ path : ${{ github.workspace }}/az-quickstart-scaffolding
74+ key : azqs-build-${{ github.sha }}
6075 - name : Run PHPCS
6176 run : |
6277 cd $GITHUB_WORKSPACE/az-quickstart-scaffolding
6378 composer phpcs
6479
80+ phpstan :
81+ name : PHPStan
82+ needs : composer
83+ runs-on : ubuntu-latest
84+ steps :
85+ - name : Restore build artifact cache
86+ uses : actions/cache/restore@v4
87+ with :
88+ path : ${{ github.workspace }}/az-quickstart-scaffolding
89+ key : azqs-build-${{ github.sha }}
6590 - name : Run PHPStan
6691 run : |
6792 cd $GITHUB_WORKSPACE/az-quickstart-scaffolding
0 commit comments