feat: Support Alpine #1566
Workflow file for this run
This file contains 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: Code Analysis & Test | |
on: | |
push: | |
pull_request: | |
# Once on the first of the month at 06:00 UTC | |
schedule: | |
- cron: 0 6 1 * * | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
php-cs: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
coverage: none | |
- uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: 'locked' | |
- name: Code Style Analysis | |
run: composer run lint | |
- name: Static Code Analysis | |
run: composer run static-code-analysis | |
examples: | |
runs-on: ${{ matrix.os }} | |
needs: | |
- php-cs | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
php: 8.1 | |
- os: macos-12 | |
php: 8.3 | |
- os: macos-14 | |
php: 8.2 | |
- os: windows-latest | |
example: 'json' | |
php: 8.2 | |
- os: windows-latest | |
example: 'binary' | |
php: 8.2 | |
- os: windows-latest | |
example: 'multipart' | |
php: 8.2 | |
- os: windows-latest | |
example: 'xml' | |
php: 8.2 | |
- os: windows-latest | |
example: 'message' | |
php: 8.2 | |
- os: windows-latest | |
example: 'matchers' | |
php: 8.2 | |
- os: windows-latest | |
example: 'generators' | |
php: 8.2 | |
- os: windows-latest | |
example: 'csv' | |
php: 8.2 | |
- os: windows-latest | |
example: 'protobuf-sync-message' | |
php: 8.1 | |
- os: windows-latest | |
example: 'protobuf-async-message' | |
php: 8.2 | |
- os: windows-latest | |
example: 'stub-server' | |
php: 8.2 | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
extensions: sockets, curl, zip, ffi ${{ (!matrix.example || matrix.example == 'protobuf-sync-message') && ', grpc' || '' }} | |
php-version: ${{ matrix.php }} | |
coverage: none | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Composer install | |
uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: 'locked' | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ !matrix.example || contains(matrix.example, 'protobuf') }} | |
- name: Generate Library | |
run: composer gen-lib | |
if: ${{ !matrix.example || contains(matrix.example, 'protobuf') }} | |
- name: Cache Pact Plugins | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pact/plugins | |
key: ${{ matrix.os }}-pact-plugins | |
if: ${{ !matrix.example || matrix.example == 'csv' || contains(matrix.example, 'protobuf') }} | |
- name: Run example(s) | |
run: composer test -- --exclude-testsuite unit ${{ matrix.example && format('--testsuite {0}-example', matrix.example) || '' }} | |
env: | |
PACT_DO_NOT_TRACK: true | |
unit: | |
runs-on: ubuntu-latest | |
needs: | |
- php-cs | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ '8.1', '8.2', '8.3' ] | |
dependencies: [ 'lowest', 'locked' ] | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
extensions: 'sockets, curl, zip, ffi' | |
php-version: ${{ matrix.php }} | |
coverage: pcov | |
- name: Composer install | |
uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: ${{ matrix.dependencies }} | |
- name: Test Unit | |
run: vendor/bin/phpunit --testsuite unit | |
env: | |
PACT_DO_NOT_TRACK: true | |
- name: Coveralls Parallel | |
uses: coverallsapp/github-action@v2 | |
with: | |
flag-name: ${{ matrix.php }}-${{ matrix.dependencies }} | |
parallel: true | |
file: test_results/reports/test_coverage_results.xml | |
finish: | |
needs: unit | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true | |
test-alpine: | |
runs-on: ubuntu-latest | |
needs: | |
- php-cs | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [ amd64, arm64 ] | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout repository | |
- name: Set up QEMU | |
if: matrix.arch == 'arm64' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: matrix.arch == 'arm64' | |
uses: docker/setup-buildx-action@v3 | |
- name: run musl # If shared-mime-info not installed - Expected binary contents to have content type 'image/jpeg' but detected contents was 'application/octet-stream' | |
run: docker run --env PACT_DO_NOT_TRACK=1 --platform=linux/${{ matrix.arch }} --rm -v $PWD:/home alpine:3.19 /bin/sh -c 'apk add --no-cache shared-mime-info php82-dev php82-ffi php82-pecl-grpc php82-sockets php82-tokenizer php82-dom php82-xml php82-xmlwriter php82-simplexml composer protoc protobuf-dev && cd /home && composer install && composer gen-lib && composer test' |