Enh/ci #2
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
# This workflow is provided via the organization template repository | |
# | |
# https://github.com/nextcloud/.github | |
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization | |
# | |
# SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors | |
# SPDX-License-Identifier: MIT | |
name: Static analysis | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- main | |
- stable* | |
concurrency: | |
group: psalm-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
matrix: | |
runs-on: ubuntu-latest-low | |
outputs: | |
ocp-matrix: ${{ steps.merge-matrix.outputs.merged-matrix }} | |
steps: | |
- name: Checkout app | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Get version matrix | |
id: versions | |
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1 | |
with: | |
filename: ./socialsharing_diaspora/appinfo/info.xml | |
# Merge the base matrix with custom elements | |
- name: Merge matrix with custom elements | |
id: merge-matrix | |
run: | | |
# Custom matrix elements you want to add | |
custom_matrix='{"APP_NAME": [ "socialsharing_diaspora", "socialsharing_email", "socialsharing_facebook", "socialsharing_telegram", "socialsharing_twitter" ]}' | |
# Base matrix from the previous job | |
base_matrix='${{ steps.versions.outputs.ocp-matrix }}' | |
# Merge the base matrix with custom matrix using jq | |
merged_matrix=$(echo "$base_matrix" | jq --argjson custom "$custom_matrix" '. + $custom') | |
# Set the merged matrix as the output | |
echo "::set-output name=merged-matrix::$merged_matrix" | |
static-analysis: | |
runs-on: ubuntu-latest | |
needs: matrix | |
strategy: | |
# do not stop on another job's failure | |
fail-fast: false | |
matrix: ${{ fromJson(needs.matrix.outputs.ocp-matrix) }} | |
name: static-psalm-analysis ${{ matrix.ocp-version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up php${{ matrix.php-versions }} | |
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite | |
coverage: none | |
ini-file: development | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
run: | | |
cs ${{matrix.APP_NAME}} | |
composer remove nextcloud/ocp --dev | |
composer i | |
- name: Install dependencies | |
run: | | |
cs ${{matrix.APP_NAME}} | |
composer require --dev 'nextcloud/ocp:${{ matrix.ocp-version }}' --ignore-platform-reqs --with-dependencies | |
- name: Run coding standards check | |
run: | | |
cs ${{matrix.APP_NAME}} | |
composer run psalm | |
summary: | |
runs-on: ubuntu-latest-low | |
needs: static-analysis | |
if: always() | |
name: static-psalm-analysis-summary | |
steps: | |
- name: Summary status | |
run: if ${{ needs.static-analysis.result != 'success' }}; then exit 1; fi |