Skip to content

Integrate SonarQube Cloud analysis and quality badge #287

Integrate SonarQube Cloud analysis and quality badge

Integrate SonarQube Cloud analysis and quality badge #287

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
action-policy:
name: Central action policy preflight
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out candidate source
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- name: Check out central action policy
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
repository: durable-workflow/.github
ref: main
path: .central-action-policy
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.13"
- name: Install policy dependencies
run: python -m pip install PyYAML==6.0.2
- name: Require centrally approved immutable action commits
run: >-
python .central-action-policy/scripts/qualification_policy.py validate
--policy .central-action-policy/qualification/policy.json
--target cli
--workflow-directory .github/workflows
test:
name: Test (PHP ${{ matrix.php }})
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: ${{ matrix.php }}
extensions: pcntl, posix
tools: composer:v2
coverage: none
- run: composer install --prefer-dist --no-interaction
- name: Validate installer scripts
run: |
sh -n scripts/install.sh
sh -n scripts/generate-homebrew-formula.sh
sh -n scripts/verify-release.sh
node --check scripts/ci/release-version.js
node --check scripts/ci/verify-cli-release-channel.js
node --check scripts/ci/verify-cli-upgrade-result.js
bash -n scripts/ci/verify-release-tag-source.sh
bash -n scripts/ci/establish-native-prerequisites.sh
bash -n scripts/ci/reconcile-release-metadata.sh
bash -n scripts/verify-public-release-assets.sh
bash -n scripts/verify-reproducible-build.sh
pwsh -NoProfile -Command '$null = [scriptblock]::Create((Get-Content -Raw scripts/install.ps1))'
- name: Verify release contracts
run: |
python scripts/ci/test-native-prerequisites.py
node --test scripts/ci/test-release-workflow-metadata.js
node --test scripts/ci/test-cli-release-channel.js
node --test scripts/ci/test-cli-upgrade-result.js
node --test scripts/ci/test-release-metadata.js
- run: composer test
build-phar:
name: Build PHAR (smoke test)
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.4'
tools: composer:v2, box:4.6.6
coverage: none
ini-values: phar.readonly=0
- run: php scripts/generate-build-info.php
- run: composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader
- run: box compile --no-parallel
- run: box info build/dw.phar
- run: php build/dw.phar list
reproducible-build:
name: Reproducible build (PHAR is bit-identical across rebuilds)
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.4'
tools: composer:v2, box:4.6.6
coverage: none
ini-values: phar.readonly=0
- name: Verify dw.phar reproduces bit-for-bit
run: scripts/verify-reproducible-build.sh
target-branch-qualification:
name: Target branch qualification
if: ${{ always() && github.server_url == 'https://github.com' }}
needs: [action-policy, test, build-phar, reproducible-build]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Require central action policy preflight
if: ${{ github.server_url == 'https://github.com' }}
env:
ACTION_POLICY_RESULT: ${{ needs.action-policy.result }}
run: test "$ACTION_POLICY_RESULT" = success
- name: Require every build cell
env:
TEST_RESULT: ${{ needs.test.result }}
PHAR_RESULT: ${{ needs.build-phar.result }}
REPRODUCIBLE_RESULT: ${{ needs.reproducible-build.result }}
run: |
test "$TEST_RESULT" = success
test "$PHAR_RESULT" = success
test "$REPRODUCIBLE_RESULT" = success