Skip to content

Commit 0c71a7b

Browse files
Devcontainer and Workflow Performance by removing old debug stuff.
- Faster local development in devcontainer - Add Make stages for local fast developing as well as unit and bats tests - Remove unmaintained files from old debugging sessions
1 parent 95f517d commit 0c71a7b

33 files changed

+201
-3286
lines changed

.devcontainer/devcontainer.json

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
{
2-
"name": "PHP",
3-
"image": "mcr.microsoft.com/devcontainers/php:1-8.3-bullseye",
4-
"forwardPorts": [
5-
80
6-
],
7-
"containerEnv": {
8-
"XDEBUG_MODE": "debug,develop"
9-
},
10-
"customizations": {
11-
"vscode": {
12-
"extensions": [
13-
"CharlieGerard.pride-vscode-themes",
14-
"junstyle.php-cs-fixer",
15-
"stylelint.vscode-stylelint",
16-
"jetmartin.bats",
17-
"recca0120.vscode-phpunit"
18-
]
19-
}
20-
},
21-
"postStartCommand": ".devcontainer/postCreateCommands.sh",
22-
"features": {
23-
"ghcr.io/devcontainers/features/node:1": {},
24-
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": {},
25-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
26-
"ghcr.io/devcontainers/features/github-cli:1": {},
27-
"ghcr.io/wxw-matt/devcontainer-features/apt:latest": {
28-
"packages": "bash-completion vim iputils-ping telnet"
29-
}
2+
"name": "PHP",
3+
"image": "mcr.microsoft.com/devcontainers/php:1-8.4-bullseye",
4+
"forwardPorts": [
5+
8080,
6+
8081
7+
],
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"junstyle.php-cs-fixer",
12+
"stylelint.vscode-stylelint",
13+
"jetmartin.bats",
14+
"recca0120.vscode-phpunit"
15+
]
3016
}
17+
},
18+
"postStartCommand": ".devcontainer/postCreateCommands.sh",
19+
"features": {
20+
"ghcr.io/devcontainers/features/node:1": {},
21+
"ghcr.io/szkiba/devcontainer-features/bats:1": {},
22+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
23+
"ghcr.io/devcontainers/features/github-cli:1": {},
24+
"ghcr.io/wxw-matt/devcontainer-features/apt:latest": {
25+
"packages": "bash-completion vim iputils-ping telnet"
26+
}
27+
}
3128
}

.devcontainer/postCreateCommands.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,33 @@
44
#
55
# SPDX-License-Identifier: AGPL-3.0-or-later
66

7+
for d in "/usr/local/etc/php/conf.d" "${PHP_INI_DIR}/conf.d"; do
8+
if [ -n "$d" ] && [ -d "$d" ]; then
9+
echo "Setting PHP CLI memory_limit=-1 in $d/99-memory-limit.ini"
10+
echo "memory_limit = -1" | sudo tee "$d/99-memory-limit.ini" >/dev/null || true
11+
fi
12+
done
13+
14+
export COMPOSER_MEMORY_LIMIT=-1
15+
716
bash -i -c 'nvm install 20'
817
bash -i -c 'nvm use 20'
918

1019
echo "setup php-scoper"
1120
composer global require humbug/php-scoper
12-
$(composer config home)/vendor/bin/php-scoper completion bash >> $HOME.bash_completion
13-
echo "export PATH=$(composer config home)/vendor/bin/:\$PATH" >> $HOME/.bashrc
14-
export PATH=$(composer config home)/vendor/bin/:$PATH
15-
16-
sudo cp memory.ini /usr/local/etc/php/conf.d/memory.ini
21+
echo "export PATH=$(composer config home)/vendor/bin/:\$PATH" >> "$HOME"/.bashrc
22+
COMPOSER_HOME=$(composer config home)
23+
export PATH=$COMPOSER_HOME/vendor/bin/:$PATH
1724

18-
if [[ "$IS_CI" == "true" ]]; then
25+
if [[ "$IS_CI" == 1 ]]; then
26+
echo "Skipping bash completion setup in CI environment"
1927
exit 0
2028
fi
2129

2230
sudo bash -c "docker completion bash > /usr/share/bash-completion/completions/docker"
2331
sudo bash -c "composer completion bash > /usr/share/bash-completion/completions/composer"
2432
sudo bash -c "npm completion > /usr/share/bash-completion/completions/npm"
25-
sudo cp xdebug.local.ini /usr/local/etc/php/conf.d/xdebug.ini
2633

2734
echo ". /usr/share/bash-completion/bash_completion" >> /home/vscode/.bashrc
2835

29-
NEXTCLOUD_VERSION=$(grep -oP -m 1 "[0-9]+\.[0-9]+\.[0-9]+" install.sh)
30-
31-
mkdir -p ~/.ssh/
32-
33-
./get-nc-server.sh "$NEXTCLOUD_VERSION"
34-
./install.sh
36+
./scripts/run-app.sh

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
3232

3333
- name: Set up php${{ steps.versions.outputs.php-min }}
34-
uses: shivammathur/setup-php@ccf2c627fe61b1b4d924adfcbd19d661a18133a0 # v2.35.2
34+
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2.35.3
3535
with:
3636
php-version: ${{ steps.versions.outputs.php-min }}
3737
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

.github/workflows/lint-php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
persist-credentials: false
4646

4747
- name: Set up php ${{ matrix.php-versions }}
48-
uses: shivammathur/setup-php@ccf2c627fe61b1b4d924adfcbd19d661a18133a0 # v2.35.2
48+
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2.35.3
4949
with:
5050
php-version: ${{ matrix.php-versions }}
5151
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

.github/workflows/psalm-matrix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
persist-credentials: false
4949

5050
- name: Set up php${{ matrix.php-min }}
51-
uses: shivammathur/setup-php@ccf2c627fe61b1b4d924adfcbd19d661a18133a0 # v2.35.2
51+
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2.35.3
5252
with:
5353
php-version: ${{ matrix.php-min }}
5454
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
@@ -62,7 +62,7 @@ jobs:
6262
- name: Install dependencies
6363
run: |
6464
composer remove nextcloud/ocp --dev --no-scripts
65-
./get-nc-server.sh
65+
./scripts/get-nc-server.sh
6666
composer i
6767
6868
- name: Check for vulnerable PHP dependencies

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# SPDX-FileCopyrightText: 2025 Lennart Dohmann <lennart.dohmann@gdata.de>
2+
#
3+
# SPDX-License-Identifier: AGPL-3.0-or-later
4+
5+
name: Release App
6+
7+
on:
8+
push:
9+
tags: ["*"]
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
if: startsWith(github.ref, 'refs/tags/')
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/download-artifact@master
19+
with:
20+
name: build-dir
21+
path: build/
22+
23+
- name: write version to output
24+
id: write-version-to-output
25+
run: |
26+
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
27+
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
28+
29+
- name: Github Release
30+
uses: softprops/action-gh-release@v2
31+
with:
32+
files: build/artifacts/*
33+
34+
- name: Attach tarball to github release
35+
uses: svenstaro/upload-release-action@v2
36+
id: attach_to_release
37+
with:
38+
repo_token: ${{ secrets.GITHUB_TOKEN }}
39+
file: ./build/artifacts/gdatavaas.tar.gz
40+
asset_name: gdatavaas.tar.gz
41+
tag: ${{ github.ref }}
42+
overwrite: true
43+
44+
- name: Upload app to Nextcloud appstore
45+
uses: nextcloud-releases/nextcloud-appstore-push-action@v1
46+
with:
47+
app_name: gdatavaas
48+
appstore_token: ${{ secrets.VAAS_APPSTORE_TOKEN }}
49+
download_url: ${{ steps.attach_to_release.outputs.browser_download_url }}
50+
app_private_key: ${{ secrets.VAAS_NEXTCLOUD_KEY }}
Lines changed: 5 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: AGPL-3.0-or-later
44

5-
name: Build and Test
5+
name: Tests
66

77
defaults:
88
run:
@@ -15,21 +15,12 @@ on:
1515
workflow_dispatch:
1616

1717
jobs:
18-
define-matrix:
19-
runs-on: ubuntu-latest
20-
outputs:
21-
nextcloud_versions: ${{ steps.get-matrix.outputs.nextcloud_versions }}
22-
steps:
23-
- uses: actions/checkout@v4
24-
- id: get-matrix
25-
run: echo "nextcloud_versions=$(./get-matrix.sh)" | tee -a "$GITHUB_OUTPUT"
26-
2718
build-devcontainer:
2819
runs-on: ubuntu-latest
2920
steps:
3021
- uses: actions/checkout@v4
3122
- name: Login to GitHub Container Registry
32-
uses: docker/login-action@v3
23+
uses: docker/login-action@v3
3324
with:
3425
registry: ghcr.io
3526
username: ${{ github.repository_owner }}
@@ -41,19 +32,15 @@ jobs:
4132
cacheFrom: ghcr.io/gdatasoftwareag/nextcloud/builder
4233
push: always
4334

44-
test:
35+
tests:
4536
runs-on: ubuntu-latest
4637
container:
4738
image: ghcr.io/gdatasoftwareag/nextcloud/builder:latest
4839
env:
49-
IS_CI: true
40+
IS_CI: 1
5041
options: --name nextcloud-antivirus-build-container
5142
needs:
52-
- define-matrix
5343
- build-devcontainer
54-
strategy:
55-
matrix:
56-
nextcloud_version: ${{fromJson(needs.define-matrix.outputs.nextcloud_versions)}}
5744
steps:
5845
- uses: actions/checkout@v4
5946

@@ -64,7 +51,6 @@ jobs:
6451
- name: add composer bin to path
6552
run: |
6653
echo $(composer config home --global)/vendor/bin >> $GITHUB_PATH
67-
echo "/home/vscode/bin/" >> $GITHUB_PATH
6854
6955
- name: replace version in ./appinfo/info.xml
7056
if: startsWith(github.ref, 'refs/tags/')
@@ -90,7 +76,7 @@ jobs:
9076
env:
9177
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
9278
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
93-
run: ./install.sh ${{ matrix.nextcloud_version }} 1
79+
run: ./scripts/run-app.sh 31.0.8 1
9480

9581
- name: add builder into nextcloud network
9682
run: |
@@ -108,61 +94,11 @@ jobs:
10894
echo "bats_run=fail" | tee -a "$GITHUB_OUTPUT";
10995
fi
11096
111-
- uses: actions/upload-artifact@master
112-
with:
113-
overwrite: true
114-
name: core-dump
115-
path: coredumps/*
116-
11797
- name: fail if bats tests did fail
11898
if: steps.bats-tests.outputs.bats_run == 'fail'
11999
run: exit 1
120100

121101
- uses: actions/upload-artifact@master
122-
with:
123-
overwrite: true
124-
name: build-dir
125-
path: build/
126-
127-
release:
128-
needs:
129-
- test
130-
- define-matrix
131-
runs-on: ubuntu-latest
132-
if: startsWith(github.ref, 'refs/tags/')
133-
steps:
134-
- uses: actions/checkout@v4
135-
136-
- uses: actions/download-artifact@master
137102
with:
138103
name: build-dir
139104
path: build/
140-
141-
- name: write version to output
142-
id: write-version-to-output
143-
run: |
144-
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
145-
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
146-
147-
- name: Github Release
148-
uses: softprops/action-gh-release@v2
149-
with:
150-
files: build/artifacts/*
151-
152-
- name: Attach tarball to github release
153-
uses: svenstaro/upload-release-action@v2
154-
id: attach_to_release
155-
with:
156-
repo_token: ${{ secrets.GITHUB_TOKEN }}
157-
file: ./build/artifacts/gdatavaas.tar.gz
158-
asset_name: gdatavaas.tar.gz
159-
tag: ${{ github.ref }}
160-
overwrite: true
161-
162-
- name: Upload app to Nextcloud appstore
163-
uses: nextcloud-releases/nextcloud-appstore-push-action@v1
164-
with:
165-
app_name: gdatavaas
166-
appstore_token: ${{ secrets.VAAS_APPSTORE_TOKEN }}
167-
download_url: ${{ steps.attach_to_release.outputs.browser_download_url }}
168-
app_private_key: ${{ secrets.VAAS_NEXTCLOUD_KEY }}

.vscode/launch.json

Lines changed: 0 additions & 66 deletions
This file was deleted.

.vscode/launch.json.license

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)