temp commit. #6251
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| # Prevent duplicate jobs on Dependabot PRs that interfere with automerge. | |
| branches-ignore: | |
| - 'dependabot/**' | |
| pull_request: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| # Run Git Bash on Windows. Otherwise, it uses PowerShell Core, and we'd need | |
| # to install more dependencies. Ubuntu default shell is already Bash. | |
| # @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell | |
| shell: bash | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ['ubuntu-24.04'] | |
| php: ['8.2', '8.3', '8.4', '8.5'] | |
| coverage: ['none'] | |
| include: | |
| - os: 'ubuntu-24.04' | |
| php: '8.5' | |
| coverage: 'pcov' | |
| # Only test pre-installed (i.e. fast) versions of PHP on Windows. | |
| # https://github.com/shivammathur/setup-php?tab=readme-ov-file#github-hosted-runners | |
| - os: 'windows-2022' | |
| php: '8.3' | |
| coverage: 'none' | |
| steps: | |
| - name: Prepare Git | |
| # Windows corrupts line endings on checkout, causing test failures. | |
| run: git config --global core.autocrlf false | |
| - uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| ini-file: development | |
| php-version: ${{ matrix.php }} | |
| # Only report coverage once | |
| coverage: ${{ matrix.coverage }} | |
| - name: Check for abandoned dependencies | |
| if: matrix.os == 'ubuntu-24.04' | |
| run: cat composer.lock | jq '.packages[] | select(.abandoned)' | grep -q ^ && echo 'Abandoned Composer packages found' && exit 1 || exit 0 | |
| - name: Check for insecure dependencies | |
| run: composer audit | |
| - name: Composer install | |
| run: composer install --prefer-dist --no-interaction --optimize-autoloader | |
| - name: Check dependency licenses | |
| if: matrix.os == 'ubuntu-24.04' | |
| run: ./vendor/bin/composer-license-checker check --allowlist GPL-2.0-or-later --allowlist MIT --allowlist BSD-2-Clause --allowlist Apache-2.0 --allowlist LGPL-3.0-or-later --allowlist BSD-3-Clause --allowlist GPL-2.0-only --allow ltd-beget | |
| - name: Run tests | |
| if: matrix.coverage == 'none' | |
| run: | | |
| composer validate --no-check-all --ansi | |
| # Catch PSR issues to prevent phantom tests. | |
| # @see https://github.com/acquia/cli/pull/1065 | |
| composer dump-autoload --strict-psr | |
| composer test | |
| - name: Run coverage | |
| if: matrix.coverage == 'pcov' | |
| run: composer coverage | |
| - name: Upload coverage results to Codecov | |
| if: matrix.coverage == 'pcov' | |
| uses: codecov/codecov-action@v6 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| build-release: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| coverage: none | |
| php-version: '8.5' | |
| - name: 'Get ACLI version' | |
| id: acli-version | |
| run: | | |
| if [[ "$GITHUB_REF_TYPE" == 'tag' ]]; then | |
| echo "ACLI_VERSION=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT | |
| else | |
| echo "ACLI_VERSION=dev-$GITHUB_REF_NAME-$GITHUB_SHA" >> $GITHUB_OUTPUT | |
| fi | |
| - name: 'Create env file' | |
| run: | | |
| touch .env | |
| echo BUGSNAG_KEY=${{ secrets.BUGSNAG_KEY }} >> .env | |
| echo AMPLITUDE_KEY=${{ secrets.AMPLITUDE_KEY }} >> .env | |
| echo ACLI_VERSION=${{ steps.acli-version.outputs.ACLI_VERSION }} >> .env | |
| echo ACLI_BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") >> .env | |
| - name: 'Extract additional API specs from secrets' | |
| run: | | |
| if [ -n '${{ secrets.ACQUIA_SPEC_ADDITIONAL }}' ]; then | |
| echo '${{ secrets.ACQUIA_SPEC_ADDITIONAL }}' | jq . > assets/acquia-spec-additional.json | |
| fi | |
| - name: 'Debug: Print additional spec' | |
| run: | | |
| if [ -f assets/acquia-spec-additional.json ]; then | |
| cat assets/acquia-spec-additional.json | |
| else | |
| echo "No additional spec file found" | |
| fi | |
| - name: 'Merge additional specs into base spec' | |
| run: | | |
| if [ -f assets/acquia-spec-additional.json ]; then | |
| # Merge paths: combine paths, and if a path exists in both, merge HTTP methods within that path | |
| # Merge components: combine all component types | |
| jq -s ' | |
| .[0] as $base | | |
| .[1] as $add | | |
| $base | | |
| .paths = ( | |
| ($base.paths // {}) as $bp | | |
| ($add.paths // {}) as $ap | | |
| reduce ($ap | keys_unsorted[]) as $k ($bp; .[$k] = (.[$k] // {}) + ($ap[$k] // {})) | |
| ) | | |
| .components = (($base.components // {}) * ($add.components // {})) | |
| ' assets/acquia-spec.json assets/acquia-spec-additional.json > assets/acquia-spec-merged.json | |
| # Replace base spec with merged spec | |
| mv assets/acquia-spec-merged.json assets/acquia-spec.json | |
| echo "Merged additional spec into base spec" | |
| else | |
| echo "No additional spec file found, using base spec only" | |
| fi | |
| - name: Build | |
| run: | | |
| composer install --no-dev --optimize-autoloader | |
| composer box-install | |
| # Warm the symfony cache so it gets bundled with phar. | |
| ./bin/acli | |
| composer box-compile | |
| - name: Store artifact in Actions | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: acli.phar | |
| path: var/acli.phar | |
| - name: Release | |
| uses: softprops/action-gh-release@v3 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: var/acli.phar | |
| - name: Publish docs | |
| if: github.event_name == 'push' | |
| run: | | |
| ./bin/acli self:make-docs -d docs | |
| aws s3 sync docs s3://acquia-cli/docs | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_DEFAULT_REGION: us-east-1 | |
| build-native: | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: write | |
| needs: build-release | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| platform: linux-x86_64 | |
| - os: macos-15 | |
| platform: macos-aarch64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download acli.phar artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: acli.phar | |
| - name: "Download SPC and phpmicro" | |
| run: | | |
| curl -fsSL "https://acquia-cli.s3.us-east-1.amazonaws.com/static-php-cli/php-micro-8.4-${{ matrix.platform }}.tar.gz" -o tmp.tar.gz | |
| tar -xzf tmp.tar.gz | |
| curl -fsSL "https://github.com/crazywhalecc/static-php-cli/releases/download/2.7.4/spc-${{ matrix.platform }}.tar.gz" -o spc.tar.gz | |
| tar -xzf spc.tar.gz | |
| chmod +x spc | |
| - name: "Generate Executable" | |
| run: | | |
| ./spc micro:combine acli.phar -M micro.sfx -O acli -I "memory_limit=2G" | |
| chmod +x acli | |
| tar -czvf native-acli-${{ matrix.platform }}.tar.gz acli | |
| - name: "Upload Artifact" | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: acli | |
| name: native-acli-${{ matrix.platform }} | |
| - name: Release | |
| uses: softprops/action-gh-release@v3 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: native-acli-${{ matrix.platform }}.tar.gz | |
| # Require all checks to pass without having to enumerate them in the branch protection UI. | |
| # @see https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957 | |
| check: | |
| if: always() | |
| needs: | |
| - test | |
| - build-release | |
| - build-native | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |