Skip to content

Bump actions/checkout from 5 to 6 #221

Bump actions/checkout from 5 to 6

Bump actions/checkout from 5 to 6 #221

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@v6
with:
path: local-action
- name: Create fake composer.json
run: |
mkdir -p $(dirname ${{ matrix.composer-json }})
cp local-action/testdata/${{ matrix.case }}.composer.json ${{ matrix.composer-json }}
- 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@v6
with:
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@v6
with:
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@v6
with:
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:
needs:
- positive
- outputs
- negative
- missing
runs-on: ubuntu-latest
steps:
- run: echo "All tests passed!"