Skip to content

release-drafter: On workflow_dispatch instead of workflow_call #257

release-drafter: On workflow_dispatch instead of workflow_call

release-drafter: On workflow_dispatch instead of workflow_call #257

Workflow file for this run

name: Test
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
permissions: {}
jobs:
positive:
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
runs-on:
- ubuntu-latest
composer-json:
- composer.json
- not-named-composer.json
- sub/dir/composer.json
- ../not/under/workdpace/composer.json
mode:
- minor-only
- full
source:
- auto
- php.net
- offline
case:
- caret-7-3
- exactly-7-3-5
- complex
verify-attestation:
- false
include:
- runs-on: ubuntu-24.04-arm
composer-json: sub/dir/composer.json
mode: full
source: offline
case: complex
verify-attestation: true
- runs-on: ubuntu-latest
composer-json: sub/dir/composer.json
mode: full
source: offline
case: complex
verify-attestation: true
- runs-on: macos-latest
composer-json: sub/dir/composer.json
mode: full
source: offline
case: complex
verify-attestation: true
- runs-on: macos-15-intel
composer-json: sub/dir/composer.json
mode: full
source: offline
case: complex
verify-attestation: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: local-action
- name: Create fake composer.json
run: |
DIR=$(dirname "$COMPOSER_JSON")
mkdir -p "${DIR}"
cp "local-action/testdata/${CASE}.composer.json" "${COMPOSER_JSON}"
env:
COMPOSER_JSON: ${{ matrix.composer-json }}
CASE: ${{ matrix.case }}
- uses: ./local-action
id: subject
with:
composer-json: ${{ matrix.composer-json }}
mode: ${{ matrix.mode }}
source: ${{ matrix.source }}
verify-attestation: ${{ matrix.verify-attestation }}
- run: |
{
echo "{"
echo '"constraint": "${{ steps.subject.outputs.constraint }}",'
echo '"highest": "${{ steps.subject.outputs.highest }}",'
echo '"lowest": "${{ steps.subject.outputs.lowest }}",'
echo '"versions": ${{ steps.subject.outputs.versions }}'
echo "}"
} >> actual.json
- run: diff <(jq --sort-keys . actual.json) <(jq --sort-keys . local-action/testdata/${{ matrix.case }}.${{ matrix.mode }}.golden.json)
outputs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: local-action
- uses: ./local-action
id: subject
with:
composer-json: local-action/testdata/complex.composer.json
mode: minor-only
source: offline
verify-attestation: false
- name: Assert constraint output
run: exit 1
if: steps.subject.outputs.constraint != '^7.3.32 || ^8.1 <=8.1.9'
- name: Assert versions output
run: exit 1
if: steps.subject.outputs.versions != toJSON(fromJSON('["7.3","7.4","8.1"]'))
- name: Assert lowest output
run: exit 1
if: steps.subject.outputs.lowest != '7.3'
- name: Assert highest output
run: exit 1
if: steps.subject.outputs.highest != '8.1'
negative:
runs-on: ubuntu-latest
strategy:
matrix:
mode:
- minor-only
- full
source:
- auto
- php.net
- offline
case:
- empty-json
- invalid-constraint
- invalid-json
- match-none
- missing-php
- missing-require
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: local-action
- name: Create fake composer.json
run: cp local-action/testdata/${{ matrix.case }}.composer.json composer.json
- uses: ./local-action
id: subject
with:
mode: ${{ matrix.mode }}
source: ${{ matrix.source }}
continue-on-error: true
- name: Assert action failed
if: steps.subject.outcome != 'failure'
run: exit 1
missing:
runs-on: ubuntu-latest
strategy:
matrix:
mode:
- minor-only
- full
source:
- auto
- php.net
- offline
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: local-action
- name: Ensure no composer.json
run: rm -f composer.json
- uses: ./local-action
id: subject
with:
mode: ${{ matrix.mode }}
source: ${{ matrix.source }}
continue-on-error: true
- name: Assert action failed
if: steps.subject.outcome != 'failure'
run: exit 1
wait-for-all-tests:
if: cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure')
needs:
- positive
- outputs
- negative
- missing
runs-on: ubuntu-latest
steps:
- name: Assert no required jobs were cancelled or failed
run: exit 1