From 5a6205476acfafc923162b63fd8eec02120b56fb Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Mon, 15 Dec 2025 21:54:47 +0100 Subject: [PATCH] ci: add consolidated GitHub workflow for Astroglobe app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create single workflow that includes all key checks from Nextcloud app skeleton instead of copying 14 separate workflow files. Changes: - Create astroglobe-ci.yml workflow: - Triggers on PRs modifying third_party/astroglobe/ - Detects frontend vs PHP changes separately - Frontend checks: Node.js build, ESLint, Stylelint - PHP checks: CS Fixer, Psalm static analysis - Uses official Nextcloud actions (version-matrix, read-package-engines) - Runs checks only for changed file types - Summary job for branch protection rules Benefits: - Consolidated workflow easier to maintain than 14 files - Follows Nextcloud app quality standards - Catches issues before deployment - Automatic checks on every PR Based on Nextcloud app skeleton workflows from: https://github.com/nextcloud/.github 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/astroglobe-ci.yml | 275 ++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 .github/workflows/astroglobe-ci.yml diff --git a/.github/workflows/astroglobe-ci.yml b/.github/workflows/astroglobe-ci.yml new file mode 100644 index 0000000..c48282a --- /dev/null +++ b/.github/workflows/astroglobe-ci.yml @@ -0,0 +1,275 @@ +# Consolidated CI workflow for Astroglobe Nextcloud app +# +# Runs on PRs that modify the astroglobe directory +# Based on Nextcloud app skeleton workflows +# +# SPDX-FileCopyrightText: 2025 Nextcloud MCP Server contributors +# SPDX-License-Identifier: MIT + +name: Astroglobe CI + +on: + pull_request: + paths: + - 'third_party/astroglobe/**' + - '.github/workflows/astroglobe-ci.yml' + +permissions: + contents: read + +concurrency: + group: astroglobe-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/astroglobe/src/**' + - 'third_party/astroglobe/package.json' + - 'third_party/astroglobe/package-lock.json' + - 'third_party/astroglobe/vite.config.js' + - 'third_party/astroglobe/**/*.js' + - 'third_party/astroglobe/**/*.ts' + - 'third_party/astroglobe/**/*.vue' + php: + - 'third_party/astroglobe/lib/**' + - 'third_party/astroglobe/appinfo/**' + - 'third_party/astroglobe/composer.json' + - 'third_party/astroglobe/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/astroglobe + 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/astroglobe + 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/astroglobe + 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/astroglobe + 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/astroglobe + 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/astroglobe + 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/astroglobe + 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/astroglobe/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/astroglobe + 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/astroglobe/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/astroglobe/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 '.[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 + + # Summary job + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: [changes, node-build, eslint, stylelint, php-cs, psalm] + if: always() + name: astroglobe-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') }}; then + echo "PHP checks failed" + exit 1 + fi + echo "All checks passed"