|
| 1 | +name: StructArmed |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + paths: |
| 8 | + - '**.php' |
| 9 | + - 'composer.*' |
| 10 | + - 'structarmed.php' |
| 11 | + - '.github/workflows/structarmed.yml' |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - develop |
| 15 | + paths: |
| 16 | + - '**.php' |
| 17 | + - 'composer.*' |
| 18 | + - 'structarmed.php' |
| 19 | + - '.github/workflows/structarmed.yml' |
| 20 | + workflow_call: |
| 21 | + inputs: |
| 22 | + php-version: |
| 23 | + required: false |
| 24 | + type: string |
| 25 | + default: '8.2' |
| 26 | + |
| 27 | +permissions: |
| 28 | + contents: read |
| 29 | + |
| 30 | +jobs: |
| 31 | + build: |
| 32 | + name: Dependency Tracing |
| 33 | + runs-on: ubuntu-latest |
| 34 | + if: (! contains(github.event.head_commit.message, '[ci skip]')) |
| 35 | + |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 39 | + |
| 40 | + - name: Set up PHP |
| 41 | + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2 |
| 42 | + with: |
| 43 | + php-version: ${{ inputs['php-version'] }} |
| 44 | + tools: composer |
| 45 | + extensions: intl, json, mbstring, xml |
| 46 | + coverage: none |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + |
| 50 | + - name: Get composer cache directory |
| 51 | + run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV |
| 52 | + |
| 53 | + - name: Cache composer dependencies |
| 54 | + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 |
| 55 | + with: |
| 56 | + path: ${{ env.COMPOSER_CACHE_FILES_DIR }} |
| 57 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} |
| 58 | + restore-keys: ${{ runner.os }}-composer- |
| 59 | + |
| 60 | + - name: Install dependencies |
| 61 | + run: | |
| 62 | + if [ -f composer.lock ]; then |
| 63 | + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 64 | + else |
| 65 | + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 66 | + fi |
| 67 | +
|
| 68 | + - name: Structarmed Cache |
| 69 | + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 70 | + with: |
| 71 | + path: /tmp/structarmed |
| 72 | + key: ${{ runner.os }}-structarmed-${{ github.run_id }} |
| 73 | + restore-keys: ${{ runner.os }}-structarmed- |
| 74 | + |
| 75 | + - run: mkdir -p /tmp/structarmed |
| 76 | + |
| 77 | + - name: Run static analysis |
| 78 | + run: vendor/bin/structarmed analyze |
0 commit comments