Skip to content

Automation

Automation #39278

Workflow file for this run

name: Automation
on:
pull_request:
push:
branches:
# Default branch
- "main"
# Release branches
## 1.2.x - e.g. Semantic Versioning
- "[0-9]+.[0-9]+.x"
## v1 - e.g. GitHub Actions Versioning
- "v[0-9]+"
schedule:
- cron: "*/15 * * * *"
workflow_dispatch:
workflow_run:
workflows: [ "Docker Build" ]
types:
- completed
workflow_call:
secrets:
GPG_PRIVATE_KEY:
required: false
INFECTION_DASHBOARD_API_KEY:
required: false
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
# values: read, write, none
permissions:
# actions: Work with GitHub Actions. For example, actions: write permits an action to cancel a workflow run.
actions: write
# checks: Work with check runs and check suites. For example, checks: write permits an action to create a check run.
checks: write
# contents: Work with the contents of the repository. For example, contents: read permits an action to list the commits, and contents:write allows the action to create a release.
contents: write
# deployments: Work with deployments. For example, deployments: write permits an action to create a new deployment.
deployments: write
# discussions: Work with GitHub Discussions. For example, discussions: write permits an action to close or delete a discussion.
discussions: write
# id-token: Fetch an OpenID Connect (OIDC) token. This requires id-token: write.
id-token: none
# issues: Work with issues. For example, issues: write permits an action to add a comment to an issue.
issues: write
# packages: Work with GitHub Packages. For example, packages: write permits an action to upload and publish packages on GitHub Packages.
packages: write
# pages: Work with GitHub Pages. For example, pages: write permits an action to request a GitHub Pages build.
pages: write
# pull-requests: Work with pull requests. For example, pull-requests: write permits an action to add a label to a pull request.
pull-requests: write
# repository-projects: Work with GitHub projects (classic). For example, repository-projects: write permits an action to add a column to a project (classic).
repository-projects: write
# security-events: Work with GitHub code scanning and Dependabot alerts. For example, security-events: read permits an action to list the Dependabot alerts for the repository, and security-events: write allows an action to update the status of a code scanning alert.
security-events: write
# statuses: Work with commit statuses. For example, statuses:read permits an action to list the commit statuses for a given reference.
statuses: write
jobs:
matrix:
name: Generate job matrix
container:
image: ghcr.io/ghostwriter/php:8.5
concurrency:
group: ${{ github.head_ref || github.ref }}-${{ github.event_name }}-${{ github.workflow }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v6
# - name: Install nix
# uses: cachix/install-nix-action@v31
# with:
# github_access_token: ${{ secrets.GITHUB_TOKEN }}
# install_options: --no-daemon
# - name: Determine CI Jobs (dev)
# id: matrix
# if: github.event_name == 'push' || github.event_name == 'pull_request'
# uses: ghostwriter/compliance@v1
# with:
# command: matrix
- name: Determine CI Jobs
id: matrix
uses: docker://ghcr.io/ghostwriter/compliance:v1
qa:
defaults:
run:
shell: bash
name: "[PHP${{ matrix.php }}][${{ matrix.dependency }}]${{ matrix.name }} on ${{ matrix.os }}"
needs: [ matrix ]
runs-on: ${{ matrix.os }}-latest
continue-on-error: ${{ matrix.dependency == 'lowest' || matrix.experimental }}
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_EVENT_PATH: ${{ github.event_path }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKSPACE: ${{ github.workspace }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
INFECTION_DASHBOARD_API_KEY: ${{ secrets.INFECTION_DASHBOARD_API_KEY || secrets.STRYKER_DASHBOARD_API_KEY }}
XDEBUG_MODE: coverage
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
# - name: Install nix
# uses: cachix/install-nix-action@v31
# with:
# github_access_token: ${{ secrets.GITHUB_TOKEN }}
# install_options: --no-daemon
- name: Setup PHP ${{ matrix.php }} with ${{ join(matrix.extensions, ', ') }} extensions.
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
extensions: pcov, xdebug, :php-psr, xdebug, :php-psr, apcu, bcmath, ctype, curl, dom, ds, event, exif, fileinfo, filter, gd, gettext, hash, iconv, igbinary, intl, json, libxml, mbstring, memcache, mysqli, openssl, pcntl, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phar, posix, protobuf, readline, redis, session, simplexml, sockets, sodium, sqlite3, tokenizer, xml, xmlreader, xmlwriter, xsl, yaml, zend-opcache, zip, zlib, ${{ join(matrix.extensions, ', ') }}
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
php-version: ${{ matrix.php }}
tools: infection, phpunit, psalm
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Setup Cache
uses: actions/cache@v5
with:
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency }}-${{ hashFiles('composer.lock') }}
path: ${{ matrix.cacheDirectory }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.dependency }}-
- name: Run ${{ matrix.name }}
working-directory: ${{ github.workspace }}
run: |
composer config --global github-oauth.github.com ${{secrets.GITHUB_TOKEN}};
${{ matrix.command }};
composer config --global --auth --unset github-oauth.github.com