Skip to content

Commit ff1a20c

Browse files
committed
adding workflows
1 parent 4bb95ac commit ff1a20c

5 files changed

Lines changed: 343 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "03:00"
8+
timezone: Europe/Paris
9+
open-pull-requests-limit: 10
10+
ignore:
11+
- dependency-name: coenjacobs/mozart
12+
versions:
13+
- 0.6.0
14+
- 0.7.0
15+
- package-ecosystem: npm
16+
directory: "/"
17+
schedule:
18+
interval: daily
19+
time: "03:00"
20+
timezone: Europe/Paris
21+
open-pull-requests-limit: 10
22+
ignore:
23+
- dependency-name: webpack-cli
24+
versions:
25+
- 4.4.0

.github/workflows/lint-php-cs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint php-cs
7+
8+
on:
9+
pull_request:
10+
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: lint-php-cs-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
lint:
21+
runs-on: ubuntu-latest
22+
23+
name: php-cs
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
28+
29+
- name: Set up php
30+
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
31+
with:
32+
php-version: 8.1
33+
coverage: none
34+
ini-file: development
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Install dependencies
39+
run: composer i
40+
41+
- name: Lint
42+
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint php
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: lint-php-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
php-lint:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
php-versions: [ "8.0", "8.1", "8.2" ]
29+
30+
name: php-lint
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
35+
36+
- name: Set up php ${{ matrix.php-versions }}
37+
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
38+
with:
39+
php-version: ${{ matrix.php-versions }}
40+
coverage: none
41+
ini-file: development
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Lint
46+
run: composer run lint
47+
48+
summary:
49+
permissions:
50+
contents: none
51+
runs-on: ubuntu-latest
52+
needs: php-lint
53+
54+
if: always()
55+
56+
name: php-lint-summary
57+
58+
steps:
59+
- name: Summary status
60+
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
###
2+
# SPDX-License-Identifier: AGPL-3.0
3+
#
4+
# Author: Bernd rederlechner <bernd.rederlechner@t-systems.com>
5+
#
6+
# Builds a stable release package based on a release assembly
7+
# customisation-<version>-<increment>
8+
#
9+
# As soon as a package is deployed to production, the tag and the branch
10+
# MUST STAY FOR 2 years and not deleted.
11+
#
12+
# Release packages, tags and customisation branches not delivered to production should
13+
# be deleted asap a newer release is available.
14+
#
15+
16+
name: MCLOUD app release
17+
18+
on:
19+
workflow_dispatch:
20+
inputs:
21+
branch:
22+
type: choice
23+
description: Branch to build a package from
24+
options:
25+
- master
26+
- stable25
27+
- stable26
28+
- stable27
29+
- stable28
30+
increment:
31+
description: 'Release increment'
32+
required: true
33+
type: number
34+
35+
jobs:
36+
check-app:
37+
uses: nextmcloud/.github/.github/workflows/nmc-app-precond.yml@master
38+
with:
39+
versionbranch: ${{ inputs.branch }}
40+
increment: ${{ inputs.increment }}
41+
secrets: inherit
42+
build-app:
43+
uses: nextmcloud/.github/.github/workflows/nmc-app-build.yml@master
44+
needs: check-app
45+
with:
46+
appname: ${{ needs.check-app.outputs.appname }}
47+
branch: ${{ inputs.branch }}
48+
tag: ${{ needs.check-app.outputs.tag }}
49+
prerelease: ${{ inputs.branch == 'master' && true || false }}
50+
secrets: inherit
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: PHPUnit mysql
7+
8+
on:
9+
pull_request:
10+
paths:
11+
- 'appinfo/**'
12+
- 'lib/**'
13+
- 'templates/**'
14+
- 'tests/**'
15+
- 'vendor/**'
16+
- 'vendor-bin/**'
17+
- '.php-cs-fixer.dist.php'
18+
- 'composer.json'
19+
- 'composer.lock'
20+
- '.github/workflows/phpunit*.yml'
21+
22+
push:
23+
branches:
24+
- main
25+
- master
26+
- stable*
27+
28+
tags:
29+
- nmc*
30+
31+
32+
permissions:
33+
contents: read
34+
35+
concurrency:
36+
group: phpunit-mysql-${{ github.head_ref || github.run_id }}
37+
cancel-in-progress: true
38+
39+
jobs:
40+
phpunit-mysql:
41+
runs-on: ubuntu-latest
42+
43+
strategy:
44+
matrix:
45+
php-versions: ['8.0', '8.1', '8.2']
46+
server-versions: ['master']
47+
48+
services:
49+
mysql:
50+
image: ghcr.io/nextcloud/continuous-integration-mariadb-10.6:latest
51+
ports:
52+
- 4444:3306/tcp
53+
env:
54+
MYSQL_ROOT_PASSWORD: rootpassword
55+
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
56+
57+
steps:
58+
- name: Set app env
59+
run: |
60+
# Split and keep last
61+
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
62+
63+
- name: Checkout server
64+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
65+
with:
66+
submodules: true
67+
repository: nextcloud/server
68+
ref: ${{ matrix.server-versions }}
69+
70+
- name: Checkout app
71+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
72+
with:
73+
path: apps/${{ env.APP_NAME }}
74+
75+
- name: Set up php ${{ matrix.php-versions }}
76+
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
77+
with:
78+
php-version: ${{ matrix.php-versions }}
79+
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
80+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, mysql, pdo_mysql
81+
coverage: none
82+
ini-file: development
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Enable ONLY_FULL_GROUP_BY MySQL option
87+
run: |
88+
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
89+
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
90+
91+
- name: Check composer file existence
92+
id: check_composer
93+
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
94+
with:
95+
files: apps/${{ env.APP_NAME }}/composer.json
96+
97+
- name: Set up dependencies
98+
# Only run if phpunit config file exists
99+
if: steps.check_composer.outputs.files_exists == 'true'
100+
working-directory: apps/${{ env.APP_NAME }}
101+
run: composer i
102+
103+
- name: Set up Nextcloud
104+
env:
105+
DB_PORT: 4444
106+
run: |
107+
mkdir data
108+
./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
109+
./occ app:enable --force ${{ env.APP_NAME }}
110+
111+
- name: Check PHPUnit script is defined
112+
id: check_phpunit
113+
continue-on-error: true
114+
working-directory: apps/${{ env.APP_NAME }}
115+
run: |
116+
composer run --list | grep "^ test:unit " | wc -l | grep 1
117+
118+
- name: PHPUnit
119+
# Only run if phpunit config file exists
120+
if: steps.check_phpunit.outcome == 'success'
121+
working-directory: apps/${{ env.APP_NAME }}
122+
run: composer run test:unit
123+
124+
- name: Check PHPUnit integration script is defined
125+
id: check_integration
126+
continue-on-error: true
127+
working-directory: apps/${{ env.APP_NAME }}
128+
run: |
129+
composer run --list | grep "^ test:integration " | wc -l | grep 1
130+
131+
- name: Run Nextcloud
132+
# Only run if phpunit integration config file exists
133+
if: steps.check_integration.outcome == 'success'
134+
run: php -S localhost:8080 &
135+
136+
- name: PHPUnit integration
137+
# Only run if phpunit integration config file exists
138+
if: steps.check_integration.outcome == 'success'
139+
working-directory: apps/${{ env.APP_NAME }}
140+
run: composer run test:integration
141+
142+
- name: Print logs
143+
if: always()
144+
run: |
145+
cat data/nextcloud.log
146+
147+
- name: Skipped
148+
# Fail the action when neither unit nor integration tests ran
149+
if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure'
150+
run: |
151+
echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts'
152+
exit 1
153+
154+
summary:
155+
permissions:
156+
contents: none
157+
runs-on: ubuntu-latest
158+
needs: phpunit-mysql
159+
160+
if: always()
161+
162+
name: phpunit-mysql-summary
163+
164+
steps:
165+
- name: Summary status
166+
run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)