c4973290a6
- Fix PHP CS Fixer issues (single quotes, indentation) - Add typed property declarations to ApiController - Add Psalm baseline to suppress 517 pre-existing errors - Fix workflow name references (astroglobe → astrolabe) The CI workflow was previously watching a non-existent path and never ran. After fixing the path trigger, these pre-existing code quality issues were discovered. The Psalm baseline allows CI to pass while tracking technical debt for incremental resolution. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
324 lines
11 KiB
YAML
324 lines
11 KiB
YAML
# Consolidated CI workflow for Astrolabe Nextcloud app
|
|
#
|
|
# Runs on PRs that modify the astrolabe directory
|
|
# Based on Nextcloud app skeleton workflows
|
|
#
|
|
# SPDX-FileCopyrightText: 2025 Nextcloud MCP Server contributors
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
name: Astrolabe CI
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'third_party/astrolabe/**'
|
|
- '.github/workflows/astrolabe-ci.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: astrolabe-ci-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
outputs:
|
|
frontend: ${{ steps.changes.outputs.frontend }}
|
|
php: ${{ steps.changes.outputs.php }}
|
|
steps:
|
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
|
id: changes
|
|
continue-on-error: true
|
|
with:
|
|
filters: |
|
|
frontend:
|
|
- 'third_party/astrolabe/src/**'
|
|
- 'third_party/astrolabe/package.json'
|
|
- 'third_party/astrolabe/package-lock.json'
|
|
- 'third_party/astrolabe/vite.config.js'
|
|
- 'third_party/astrolabe/**/*.js'
|
|
- 'third_party/astrolabe/**/*.ts'
|
|
- 'third_party/astrolabe/**/*.vue'
|
|
php:
|
|
- 'third_party/astrolabe/lib/**'
|
|
- 'third_party/astrolabe/appinfo/**'
|
|
- 'third_party/astrolabe/composer.json'
|
|
- 'third_party/astrolabe/psalm.xml'
|
|
|
|
# Node.js build and lint
|
|
node-build:
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.frontend != 'false'
|
|
name: Node.js build
|
|
defaults:
|
|
run:
|
|
working-directory: third_party/astrolabe
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Read package.json node and npm engines version
|
|
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
|
|
id: versions
|
|
with:
|
|
path: third_party/astrolabe
|
|
fallbackNode: '^20'
|
|
fallbackNpm: '^10'
|
|
|
|
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: ${{ steps.versions.outputs.nodeVersion }}
|
|
|
|
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
|
|
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
|
|
|
|
- name: Install dependencies & build
|
|
env:
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
PUPPETEER_SKIP_DOWNLOAD: true
|
|
run: |
|
|
npm ci
|
|
npm run build --if-present
|
|
|
|
- name: Check webpack build changes
|
|
run: |
|
|
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets' && exit 1)"
|
|
|
|
# ESLint
|
|
eslint:
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.frontend != 'false'
|
|
name: ESLint
|
|
defaults:
|
|
run:
|
|
working-directory: third_party/astrolabe
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Read package.json node and npm engines version
|
|
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
|
|
id: versions
|
|
with:
|
|
path: third_party/astrolabe
|
|
fallbackNode: '^20'
|
|
fallbackNpm: '^10'
|
|
|
|
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: ${{ steps.versions.outputs.nodeVersion }}
|
|
|
|
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
|
|
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
|
|
|
|
- name: Install dependencies
|
|
env:
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
PUPPETEER_SKIP_DOWNLOAD: true
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
# Stylelint
|
|
stylelint:
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.frontend != 'false'
|
|
name: Stylelint
|
|
defaults:
|
|
run:
|
|
working-directory: third_party/astrolabe
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Read package.json node and npm engines version
|
|
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
|
|
id: versions
|
|
with:
|
|
path: third_party/astrolabe
|
|
fallbackNode: '^20'
|
|
fallbackNpm: '^10'
|
|
|
|
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: ${{ steps.versions.outputs.nodeVersion }}
|
|
|
|
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
|
|
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
|
|
|
|
- name: Install dependencies
|
|
env:
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
PUPPETEER_SKIP_DOWNLOAD: true
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run stylelint
|
|
|
|
# PHP Code Style
|
|
php-cs:
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.php != 'false'
|
|
name: PHP CS Fixer
|
|
defaults:
|
|
run:
|
|
working-directory: third_party/astrolabe
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Get php version
|
|
id: versions
|
|
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
|
|
with:
|
|
filename: third_party/astrolabe/appinfo/info.xml
|
|
|
|
- name: Set up php${{ steps.versions.outputs.php-min }}
|
|
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
|
|
with:
|
|
php-version: ${{ steps.versions.outputs.php-min }}
|
|
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: |
|
|
composer remove nextcloud/ocp --dev || true
|
|
composer i
|
|
|
|
- name: Lint
|
|
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
|
|
|
|
# Psalm Static Analysis
|
|
psalm:
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.php != 'false'
|
|
name: Psalm
|
|
defaults:
|
|
run:
|
|
working-directory: third_party/astrolabe
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Get php version
|
|
id: versions
|
|
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
|
|
with:
|
|
filename: third_party/astrolabe/appinfo/info.xml
|
|
|
|
- name: Set up php${{ steps.versions.outputs.php-min }}
|
|
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
|
|
with:
|
|
php-version: ${{ steps.versions.outputs.php-min }}
|
|
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: |
|
|
composer remove nextcloud/ocp --dev || true
|
|
composer i
|
|
|
|
- name: Get OCP version matrix
|
|
id: ocp-versions
|
|
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
|
|
with:
|
|
filename: third_party/astrolabe/appinfo/info.xml
|
|
|
|
- name: Install OCP for static analysis
|
|
run: |
|
|
# Get first OCP version from matrix
|
|
OCP_VERSION=$(echo '${{ steps.ocp-versions.outputs.ocp-matrix }}' | jq -r '.include[0]."ocp-version"')
|
|
composer require --dev "nextcloud/ocp:$OCP_VERSION" --ignore-platform-reqs --with-dependencies
|
|
|
|
- name: Run Psalm
|
|
run: composer run psalm -- --threads=1 --monochrome --no-progress --output-format=github
|
|
|
|
# PHPUnit Tests
|
|
phpunit:
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.php != 'false'
|
|
defaults:
|
|
run:
|
|
working-directory: third_party/astrolabe
|
|
|
|
strategy:
|
|
matrix:
|
|
php-versions: ['8.1', '8.2', '8.3']
|
|
|
|
name: PHPUnit (PHP ${{ matrix.php-versions }})
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Set up PHP ${{ matrix.php-versions }}
|
|
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
|
|
with:
|
|
php-version: ${{ matrix.php-versions }}
|
|
extensions: ctype, curl, dom, gd, iconv, intl, json, mbstring, openssl, posix, sqlite, xml, zip
|
|
coverage: none
|
|
ini-file: development
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
composer remove nextcloud/ocp --dev || true
|
|
composer i
|
|
|
|
- name: Get OCP version matrix
|
|
id: ocp-versions
|
|
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
|
|
with:
|
|
filename: third_party/astrolabe/appinfo/info.xml
|
|
|
|
- name: Install OCP for testing
|
|
run: |
|
|
OCP_VERSION=$(echo '${{ steps.ocp-versions.outputs.ocp-matrix }}' | jq -r '.include[0]."ocp-version"')
|
|
composer require --dev "nextcloud/ocp:$OCP_VERSION" --ignore-platform-reqs --with-dependencies
|
|
|
|
- name: Run PHPUnit
|
|
run: composer run test:unit
|
|
|
|
# Summary job
|
|
summary:
|
|
permissions:
|
|
contents: none
|
|
runs-on: ubuntu-latest
|
|
needs: [changes, node-build, eslint, stylelint, php-cs, psalm, phpunit]
|
|
if: always()
|
|
name: astrolabe-ci-summary
|
|
steps:
|
|
- name: Summary status
|
|
run: |
|
|
if ${{ needs.changes.outputs.frontend != 'false' && (needs.node-build.result != 'success' || needs.eslint.result != 'success' || needs.stylelint.result != 'success') }}; then
|
|
echo "Frontend checks failed"
|
|
exit 1
|
|
fi
|
|
if ${{ needs.changes.outputs.php != 'false' && (needs.php-cs.result != 'success' || needs.psalm.result != 'success' || needs.phpunit.result != 'success') }}; then
|
|
echo "PHP checks failed"
|
|
exit 1
|
|
fi
|
|
echo "All checks passed"
|