mirror of
https://github.com/chenasraf/workflows.git
synced 2026-05-18 09:38:59 +00:00
Compare commits
7 Commits
nextcloud-
...
homebrew-v
| Author | SHA1 | Date | |
|---|---|---|---|
| a69ee802a6 | |||
| 70151d294e | |||
| dd6e138c7a | |||
| 94a677ab82 | |||
| 5755a7bfd8 | |||
| 388711cc86 | |||
| e203813f6f |
89
.github/workflows/homebrew-release.yml
vendored
Normal file
89
.github/workflows/homebrew-release.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
# Reusable Homebrew Release Workflow
|
||||
#
|
||||
# Dispatches a homebrew formula update to a tap repo.
|
||||
# Does not include any build steps — suitable for shell-only packages.
|
||||
#
|
||||
# Call from other repos:
|
||||
# jobs:
|
||||
# homebrew:
|
||||
# uses: chenasraf/workflows/.github/workflows/homebrew-release.yml@master
|
||||
# with:
|
||||
# homebrew-tap-repo: owner/homebrew-tap
|
||||
# tag: ${{ needs.release.outputs.tag_name }}
|
||||
# secrets:
|
||||
# REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
|
||||
|
||||
name: Homebrew Release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
homebrew-tap-repo:
|
||||
description: 'Homebrew tap repo to dispatch to (e.g., owner/homebrew-tap)'
|
||||
required: true
|
||||
type: string
|
||||
tag:
|
||||
description: 'Release tag to dispatch (e.g., v1.0.0). If empty, uses the latest release tag.'
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
secrets:
|
||||
REPO_DISPATCH_PAT:
|
||||
description: 'PAT for dispatching to homebrew tap repo'
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release-homebrew:
|
||||
name: Trigger Homebrew Formula Update
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get release info
|
||||
id: release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
tag="${{ inputs.tag }}"
|
||||
if [[ -z "$tag" ]]; then
|
||||
tag=$(gh release view --json tagName -q .tagName)
|
||||
echo "Using latest release tag: $tag"
|
||||
else
|
||||
echo "Using provided tag: $tag"
|
||||
fi
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
body=$(gh release view "$tag" --json body -q .body)
|
||||
echo "body<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$body" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Send dispatch to homebrew-tap
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.REPO_DISPATCH_PAT }}
|
||||
run: |
|
||||
tag="${{ steps.release.outputs.tag }}"
|
||||
repo="${{ github.event.repository.name }}"
|
||||
body=$(cat <<'BODY_EOF'
|
||||
${{ steps.release.outputs.body }}
|
||||
BODY_EOF
|
||||
)
|
||||
data=$(jq -n \
|
||||
--arg tag "$tag" \
|
||||
--arg repo "$repo" \
|
||||
--arg body "$body" \
|
||||
'{event_type: "trigger-from-release", client_payload: {tag: $tag, repo: $repo, body: $body}}')
|
||||
echo "Dispatching tag $tag from $repo"
|
||||
echo "Data: $data"
|
||||
curl -X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $GH_TOKEN" \
|
||||
"https://api.github.com/repos/${{ inputs.homebrew-tap-repo }}/dispatches" \
|
||||
-d "$data"
|
||||
echo "Dispatched tag $tag from $repo"
|
||||
echo "Created job on https://github.com/${{ inputs.homebrew-tap-repo }}/actions"
|
||||
75
.github/workflows/manual-homebrew-release.yml
vendored
Normal file
75
.github/workflows/manual-homebrew-release.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# Reusable Manual Homebrew Release Workflow
|
||||
#
|
||||
# Call from other repos:
|
||||
# jobs:
|
||||
# homebrew:
|
||||
# uses: chenasraf/workflows/.github/workflows/manual-homebrew-release.yml@master
|
||||
# with:
|
||||
# homebrew-tap-repo: owner/homebrew-tap
|
||||
# secrets:
|
||||
# REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
|
||||
|
||||
name: Manual Homebrew Release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
homebrew-tap-repo:
|
||||
description: 'Homebrew tap repo to dispatch to (e.g., owner/homebrew-tap)'
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
REPO_DISPATCH_PAT:
|
||||
description: 'PAT for dispatching to homebrew tap repo'
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release-homebrew:
|
||||
name: Trigger Homebrew Formula Update
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest release info
|
||||
id: latest
|
||||
run: |
|
||||
tag=$(gh release view --json tagName -q .tagName)
|
||||
echo "Latest release tag: $tag"
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
body=$(gh release view --json body -q .body)
|
||||
echo "body<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$body" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Send dispatch to homebrew-tap
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.REPO_DISPATCH_PAT }}
|
||||
run: |
|
||||
tag="${{ steps.latest.outputs.tag }}"
|
||||
repo="${{ github.event.repository.name }}"
|
||||
body=$(cat <<'BODY_EOF'
|
||||
${{ steps.latest.outputs.body }}
|
||||
BODY_EOF
|
||||
)
|
||||
data=$(jq -n \
|
||||
--arg tag "$tag" \
|
||||
--arg repo "$repo" \
|
||||
--arg body "$body" \
|
||||
'{event_type: "trigger-from-release", client_payload: {tag: $tag, repo: $repo, body: $body}}')
|
||||
echo "Dispatching tag $tag from $repo"
|
||||
echo "Data: $data"
|
||||
curl -X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer $GH_TOKEN" \
|
||||
"https://api.github.com/repos/${{ inputs.homebrew-tap-repo }}/dispatches" \
|
||||
-d "$data"
|
||||
echo "Dispatched tag $tag from $repo"
|
||||
echo "Created job on https://github.com/${{ inputs.homebrew-tap-repo }}/actions"
|
||||
4
.github/workflows/nextcloud-build-npm.yml
vendored
4
.github/workflows/nextcloud-build-npm.yml
vendored
@@ -46,7 +46,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
@@ -45,7 +45,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
4
.github/workflows/nextcloud-lint-eslint.yml
vendored
4
.github/workflows/nextcloud-lint-eslint.yml
vendored
@@ -46,7 +46,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
4
.github/workflows/nextcloud-lint-openapi.yml
vendored
4
.github/workflows/nextcloud-lint-openapi.yml
vendored
@@ -46,7 +46,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
4
.github/workflows/nextcloud-lint-php-cs.yml
vendored
4
.github/workflows/nextcloud-lint-php-cs.yml
vendored
@@ -46,7 +46,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
4
.github/workflows/nextcloud-lint-php.yml
vendored
4
.github/workflows/nextcloud-lint-php.yml
vendored
@@ -45,7 +45,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
@@ -66,7 +66,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
@@ -64,7 +64,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
@@ -54,7 +54,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
4
.github/workflows/nextcloud-psalm.yml
vendored
4
.github/workflows/nextcloud-psalm.yml
vendored
@@ -46,7 +46,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
4
.github/workflows/nextcloud-vitest.yml
vendored
4
.github/workflows/nextcloud-vitest.yml
vendored
@@ -52,7 +52,9 @@ jobs:
|
||||
run: |
|
||||
echo "yaml<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "src:" >> $GITHUB_OUTPUT
|
||||
echo '${{ inputs.path-filters }}' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
cat <<'INPUT_EOF' | sed 's/^/ /' >> $GITHUB_OUTPUT
|
||||
${{ inputs.path-filters }}
|
||||
INPUT_EOF
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
|
||||
12
Makefile
12
Makefile
@@ -27,18 +27,10 @@ else
|
||||
if [ -z "$$latest" ]; then echo 1; else echo $$((latest + 1)); fi \
|
||||
))
|
||||
$(eval VERSION := $(or $(VERSION),$(_detected_version)))
|
||||
@# Get latest global version
|
||||
$(eval GLOBAL_VERSION := $(shell \
|
||||
latest=$$(git tag --list 'v*' | grep -E '^v[0-9]+$$' | sed 's/v//' | sort -n | tail -1); \
|
||||
if [ -z "$$latest" ]; then echo 1; else echo $$((latest + 1)); fi \
|
||||
))
|
||||
@echo "Tagging with:"
|
||||
@echo " Global version: v$(GLOBAL_VERSION)"
|
||||
@echo " Tag version: $(TAG)-v$(VERSION)"
|
||||
@echo " Latest tag: $(TAG)-latest"
|
||||
@echo ""
|
||||
@# Create global version tag
|
||||
git tag -f v$(GLOBAL_VERSION)
|
||||
@# Create tag-specific version
|
||||
git tag -f $(TAG)-v$(VERSION)
|
||||
@# Remove old latest tag and re-create
|
||||
@@ -50,8 +42,8 @@ else
|
||||
answer=$${answer:-y}; \
|
||||
if echo "$$answer" | grep -iq "^y"; then \
|
||||
echo "Pushing tags to remote..."; \
|
||||
git push origin v$(GLOBAL_VERSION) $(TAG)-v$(VERSION) $(TAG)-latest --force; \
|
||||
git push origin $(TAG)-v$(VERSION) $(TAG)-latest --force; \
|
||||
else \
|
||||
echo "To push tags later, run: git push origin v$(GLOBAL_VERSION) $(TAG)-v$(VERSION) $(TAG)-latest --force"; \
|
||||
echo "To push tags later, run: git push origin $(TAG)-v$(VERSION) $(TAG)-latest --force"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
332
README.md
332
README.md
@@ -2,6 +2,26 @@
|
||||
|
||||
A collection of reusable GitHub Actions workflows.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Workflows](#workflows)
|
||||
- [Go Release](#go-release-go-releaseyml)
|
||||
- [Manual Homebrew Release](#manual-homebrew-release-manual-homebrew-releaseyml)
|
||||
- [Nextcloud Workflows](#nextcloud-workflows)
|
||||
- [PHPUnit MySQL](#phpunit-mysql-nextcloud-phpunit-mysqlyml)
|
||||
- [PHPUnit PostgreSQL](#phpunit-postgresql-nextcloud-phpunit-pgsqlyml)
|
||||
- [PHPUnit Incremental Migration](#phpunit-incremental-migration-nextcloud-phpunit-incrementalyml)
|
||||
- [Psalm Static Analysis](#psalm-static-analysis-nextcloud-psalmyml)
|
||||
- [PHP Lint](#php-lint-nextcloud-lint-phpyml)
|
||||
- [PHP-CS-Fixer](#php-cs-fixer-nextcloud-lint-php-csyml)
|
||||
- [ESLint](#eslint-nextcloud-lint-eslintyml)
|
||||
- [OpenAPI Lint](#openapi-lint-nextcloud-lint-openapiyml)
|
||||
- [AppInfo XML Lint](#appinfo-xml-lint-nextcloud-lint-appinfo-xmlyml)
|
||||
- [NPM Build](#npm-build-nextcloud-build-npmyml)
|
||||
- [Vitest](#vitest-nextcloud-vitestyml)
|
||||
- [Block Unconventional Commits](#block-unconventional-commits-nextcloud-block-unconventional-commitsyml)
|
||||
- [License](#license)
|
||||
|
||||
## Workflows
|
||||
|
||||
### Go Release (`go-release.yml`)
|
||||
@@ -29,9 +49,13 @@ on:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: chenasraf/workflows/.github/workflows/go-release.yml@main
|
||||
uses: chenasraf/workflows/.github/workflows/go-release.yml@master
|
||||
with:
|
||||
name: my-binary
|
||||
name: my-cli
|
||||
go-version: '1.24'
|
||||
platforms: '["linux/amd64", "darwin/arm64"]'
|
||||
main-branch: main
|
||||
homebrew-tap-repo: myorg/homebrew-tap
|
||||
secrets:
|
||||
REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
|
||||
```
|
||||
@@ -56,22 +80,312 @@ jobs:
|
||||
| ------------------- | ---------------------------------------- | -------- |
|
||||
| `REPO_DISPATCH_PAT` | PAT for dispatching to homebrew tap repo | No |
|
||||
|
||||
#### Example with Custom Options
|
||||
---
|
||||
|
||||
### Manual Homebrew Release (`manual-homebrew-release.yml`)
|
||||
|
||||
Manually triggers a Homebrew tap update for the latest release. Useful when you need to re-trigger a Homebrew formula update without creating a new release.
|
||||
|
||||
#### Features
|
||||
|
||||
- Fetches the latest release tag and body from the repository
|
||||
- Sends a repository dispatch event to your Homebrew tap repo
|
||||
- Works with any Homebrew tap that listens for `trigger-from-release` events with payload: `{ tag, repo, body }`
|
||||
|
||||
#### Usage
|
||||
|
||||
```yaml
|
||||
name: Manual Homebrew Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: chenasraf/workflows/.github/workflows/go-release.yml@master
|
||||
homebrew:
|
||||
uses: chenasraf/workflows/.github/workflows/manual-homebrew-release.yml@master
|
||||
with:
|
||||
name: my-cli
|
||||
go-version: '1.24'
|
||||
platforms: '["linux/amd64", "darwin/arm64"]'
|
||||
main-branch: main
|
||||
homebrew-tap-repo: myorg/homebrew-tap
|
||||
secrets:
|
||||
REPO_DISPATCH_PAT: ${{ secrets.REPO_DISPATCH_PAT }}
|
||||
```
|
||||
|
||||
#### Inputs
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
| ------------------- | ------------------------------------------------ | -------- | ------- |
|
||||
| `homebrew-tap-repo` | Homebrew tap repo to dispatch to (e.g., owner/homebrew-tap) | Yes | - |
|
||||
|
||||
#### Secrets
|
||||
|
||||
| Secret | Description | Required |
|
||||
| ------------------- | ---------------------------------------- | -------- |
|
||||
| `REPO_DISPATCH_PAT` | PAT for dispatching to homebrew tap repo | Yes |
|
||||
|
||||
---
|
||||
|
||||
## Nextcloud Workflows
|
||||
|
||||
Reusable workflows for Nextcloud app development. These workflows include automatic path filtering to skip unnecessary runs when irrelevant files change.
|
||||
|
||||
### PHPUnit MySQL (`nextcloud-phpunit-mysql.yml`)
|
||||
|
||||
Runs PHPUnit tests with MySQL database.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
phpunit:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-mysql.yml@nextcloud-latest
|
||||
with:
|
||||
php-versions-min: '8.1'
|
||||
php-versions-max: '8.4'
|
||||
mysql-version: '8.0'
|
||||
path-filters: |
|
||||
- 'lib/**'
|
||||
- 'tests/**'
|
||||
- 'composer.json'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `php-versions-min` | Minimum PHP version | No | `8.2` |
|
||||
| `php-versions-max` | Maximum PHP version | No | `8.3` |
|
||||
| `mysql-version` | MySQL version | No | `8.4` |
|
||||
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | _(lib, tests, etc.)_ |
|
||||
|
||||
### PHPUnit PostgreSQL (`nextcloud-phpunit-pgsql.yml`)
|
||||
|
||||
Runs PHPUnit tests with PostgreSQL database.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
phpunit:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-pgsql.yml@nextcloud-latest
|
||||
with:
|
||||
php-version: '8.2'
|
||||
path-filters: |
|
||||
- 'lib/**'
|
||||
- 'tests/**'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `php-version` | PHP version | No | `8.3` |
|
||||
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | _(lib, tests, etc.)_ |
|
||||
|
||||
### PHPUnit Incremental Migration (`nextcloud-phpunit-incremental.yml`)
|
||||
|
||||
Tests database migrations by upgrading from a baseline version.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
incremental:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-phpunit-incremental.yml@nextcloud-latest
|
||||
with:
|
||||
baseline-version: v1.0.0
|
||||
php-version: '8.2'
|
||||
validation-query: 'SELECT COUNT(*) FROM oc_myapp_users'
|
||||
path-filters: |
|
||||
- 'lib/Migration/**'
|
||||
- 'appinfo/info.xml'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `baseline-version` | Git tag/ref to upgrade from | Yes | - |
|
||||
| `php-version` | PHP version | No | `8.3` |
|
||||
| `php-extensions-mysql` | PHP extensions for MySQL tests | No | _(common extensions)_ |
|
||||
| `php-extensions-pgsql` | PHP extensions for PostgreSQL tests | No | _(common extensions)_ |
|
||||
| `validation-query` | SQL query to validate migration | No | _(empty)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | _(lib, tests, etc.)_ |
|
||||
|
||||
### Psalm Static Analysis (`nextcloud-psalm.yml`)
|
||||
|
||||
Runs Psalm static analysis across supported Nextcloud versions.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
psalm:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-psalm.yml@nextcloud-latest
|
||||
with:
|
||||
psalm-command: 'composer run psalm -- --show-info=true'
|
||||
path-filters: |
|
||||
- 'lib/**/*.php'
|
||||
- 'psalm.xml'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `psalm-command` | Command to run Psalm | No | `composer run psalm` |
|
||||
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `**.php`, `psalm.xml` |
|
||||
|
||||
### PHP Lint (`nextcloud-lint-php.yml`)
|
||||
|
||||
Runs PHP syntax linting across supported PHP versions.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
lint:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-lint-php.yml@nextcloud-latest
|
||||
with:
|
||||
lint-command: 'composer run lint -- --colors'
|
||||
path-filters: |
|
||||
- 'lib/**/*.php'
|
||||
- 'appinfo/**/*.php'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `lint-command` | Command to run lint | No | `composer run lint` |
|
||||
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `**.php` |
|
||||
|
||||
### PHP-CS-Fixer (`nextcloud-lint-php-cs.yml`)
|
||||
|
||||
Checks PHP code style with PHP-CS-Fixer.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
cs:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-lint-php-cs.yml@nextcloud-latest
|
||||
with:
|
||||
cs-check-command: 'vendor/bin/php-cs-fixer fix --dry-run --diff'
|
||||
path-filters: |
|
||||
- 'lib/**/*.php'
|
||||
- 'tests/**/*.php'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `cs-check-command` | Command to check code style | No | `composer run cs:check` |
|
||||
| `php-extensions` | PHP extensions to install | No | _(common extensions)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `**.php`, `.php-cs-fixer.dist.php` |
|
||||
|
||||
### ESLint (`nextcloud-lint-eslint.yml`)
|
||||
|
||||
Runs ESLint on frontend code.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
eslint:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-lint-eslint.yml@nextcloud-latest
|
||||
with:
|
||||
lint-command: 'pnpm lint --max-warnings 0'
|
||||
path-filters: |
|
||||
- 'src/**/*.ts'
|
||||
- 'src/**/*.vue'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `lint-command` | Command to run lint | No | `pnpm lint` |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `src/**`, `*.ts`, `*.js`, etc. |
|
||||
|
||||
### OpenAPI Lint (`nextcloud-lint-openapi.yml`)
|
||||
|
||||
Validates OpenAPI spec is up to date.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
openapi:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-lint-openapi.yml@nextcloud-latest
|
||||
with:
|
||||
openapi-command: 'composer run generate-openapi'
|
||||
typescript-types-pattern: 'src/api/types/*.ts'
|
||||
path-filters: |
|
||||
- 'lib/Controller/**/*.php'
|
||||
- 'openapi.json'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `openapi-command` | Command to regenerate OpenAPI | No | `composer run openapi` |
|
||||
| `typescript-types-pattern` | Glob for TypeScript types | No | `src/types/openapi/openapi*.ts` |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `lib/**/*.php`, `openapi.json` |
|
||||
|
||||
### AppInfo XML Lint (`nextcloud-lint-appinfo-xml.yml`)
|
||||
|
||||
Validates `appinfo/info.xml` against schema.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
xml:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-lint-appinfo-xml.yml@nextcloud-latest
|
||||
with:
|
||||
xml-file: './custom/path/info.xml'
|
||||
path-filters: |
|
||||
- 'custom/path/info.xml'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `xml-file` | Path to the info.xml file | No | `./appinfo/info.xml` |
|
||||
| `schema-url` | URL to XML schema | No | _(Nextcloud schema)_ |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `appinfo/info.xml` |
|
||||
|
||||
### NPM Build (`nextcloud-build-npm.yml`)
|
||||
|
||||
Builds frontend assets with pnpm.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-build-npm.yml@nextcloud-latest
|
||||
with:
|
||||
build-command: 'pnpm build:prod'
|
||||
path-filters: |
|
||||
- 'src/**'
|
||||
- 'package.json'
|
||||
- 'pnpm-lock.yaml'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `build-command` | Command to run build | No | `pnpm build` |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `src/**`, `*.json`, etc. |
|
||||
|
||||
### Vitest (`nextcloud-vitest.yml`)
|
||||
|
||||
Runs Vitest frontend tests.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
vitest:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-vitest.yml@nextcloud-latest
|
||||
with:
|
||||
node-version: '20'
|
||||
test-command: 'pnpm vitest run --coverage'
|
||||
path-filters: |
|
||||
- 'src/**'
|
||||
- 'tests/**'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `node-version` | Node.js version to use | No | `22` |
|
||||
| `test-command` | Command to run tests | No | `pnpm test:run` |
|
||||
| `path-filters` | Paths to trigger on (YAML list) | No | `src/**`, `*.ts`, etc. |
|
||||
|
||||
### Block Unconventional Commits (`nextcloud-block-unconventional-commits.yml`)
|
||||
|
||||
Blocks commits that don't follow conventional commit format.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
commits:
|
||||
uses: chenasraf/workflows/.github/workflows/nextcloud-block-unconventional-commits.yml@nextcloud-latest
|
||||
with:
|
||||
allowed-types: 'feat,fix,docs,chore,refactor'
|
||||
```
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `allowed-types` | Comma-separated list of allowed commit types | No | _(feat, fix, docs, etc.)_ |
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user