Skip to content

docker-aio-actions draft, commands updates #277

docker-aio-actions draft, commands updates

docker-aio-actions draft, commands updates #277

Workflow file for this run

name: Tests - Deploy
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: tests-deploy-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
nc-host-app-docker:
runs-on: ubuntu-22.04
name: NC In Host • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }}
strategy:
fail-fast: false
matrix:
php-version: [ '8.1' ]
server-version: [ 'stable27' ]
include:
- server-version: "master"
php-version: "8.2"
services:
postgres:
image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-version }}
- name: Checkout Notifications
uses: actions/checkout@v3
with:
repository: nextcloud/notifications
ref: ${{ matrix.server-version }}
path: apps/notifications
- name: Checkout AppEcosystemV2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
with:
files: apps/${{ env.APP_NAME }}/composer.json
- name: Set up dependencies
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=pgsql --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
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ config:system:set allow_local_remote_servers --value true
./occ app:enable notifications
./occ app:enable --force ${{ env.APP_NAME }}
- name: Test deploy
run: |
php -S 127.0.0.1:8080 &
./occ app_ecosystem_v2:daemon:register docker_local_sock Docker docker-install unix-socket /var/run/docker.sock http://127.0.0.1:8080/index.php
./occ app_ecosystem_v2:app:deploy skeleton docker_local_sock \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
./occ app_ecosystem_v2:app:register skeleton docker_local_sock \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
./occ app_ecosystem_v2:app:enable skeleton
./occ app_ecosystem_v2:app:disable skeleton
./occ app_ecosystem_v2:app:unregister skeleton --silent
./occ app_ecosystem_v2:daemon:unregister docker_local_sock
- name: Check logs
run: |
grep -q 'Hello from skeleton :)' data/nextcloud.log || error
grep -q 'Bye bye from skeleton :(' data/nextcloud.log || error
- name: Save container ingo & logs
if: always()
run: |
docker inspect skeleton | json_pp > container.json
docker logs skeleton > container.log 2>&1
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log
path: data/nextcloud.log
if-no-files-found: warn
nc-docker-app-docker:
runs-on: ubuntu-22.04
name: NC In Julius Docker • 🐘8.1
env:
docker-image: ghcr.io/juliushaertl/nextcloud-dev-php81:latest
steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Create container
run: |
docker network create master_bridge
docker run --net master_bridge --name nextcloud --rm -d -v /var/run/docker.sock:/var/run/docker.sock ${{ env.docker-image }}
sudo chmod 766 /var/run/docker.sock
sleep 120s
- name: Install AppEcosystemV2
run: |
docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/${{ env.APP_NAME }}.git
docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF
docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD
docker exec nextcloud sudo -u www-data php occ app:enable app_ecosystem_v2
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:register \
docker_local_sock Docker docker-install unix-socket /var/run/docker.sock http://nextcloud/index.php \
--net=master_bridge
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:deploy skeleton docker_local_sock \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:register skeleton docker_local_sock \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:enable skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:disable skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:unregister skeleton --silent
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:unregister docker_local_sock
- name: Copy NC log to host
run: docker cp nextcloud:/var/www/html/data/nextcloud.log nextcloud.log
- name: Check logs
run: |
grep -q 'Hello from skeleton :)' nextcloud.log || error
grep -q 'Bye bye from skeleton :(' nextcloud.log || error
- name: Save container ingo & logs
if: always()
run: |
docker inspect skeleton | json_pp > container.json
docker logs skeleton > container.log 2>&1
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_nextcloud.log
path: nextcloud.log
if-no-files-found: warn
nc-docker-app-docker-by-port:
runs-on: ubuntu-22.04
name: NC In Julius Docker(Docker by port) • 🐘8.1
env:
docker-image: ghcr.io/juliushaertl/nextcloud-dev-php81:latest
steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Create containers
run: |
docker network create master_bridge
docker run --net master_bridge --name nextcloud --rm -d ${{ env.docker-image }}
docker pull kekru/docker-remote-api-tls:master
docker run -d -p 8443:443 -v /var/run/docker.sock:/var/run/docker.sock:ro \
--env CREATE_CERTS_WITH_PW=supersecret --env CERT_HOSTNAME=host.docker.internal \
-v `pwd`/certs:/data/certs kekru/docker-remote-api-tls:master
sleep 30s
- name: Install AppEcosystemV2
run: |
docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/${{ env.APP_NAME }}.git
docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF
docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD
docker exec nextcloud sudo -u www-data php occ app:enable app_ecosystem_v2
docker cp ./certs/client/ nextcloud:/
docker exec nextcloud sudo -u www-data php occ security:certificates:import /client/ca.pem
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:register \
docker_by_port Docker docker-install https host.docker.internal:8443 http://nextcloud/index.php \
--net=master_bridge --ssl_cert /client/cert.pem --ssl_key /client/key.pem
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:deploy skeleton docker_by_port \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:register skeleton docker_by_port \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:enable skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:disable skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:unregister skeleton --silent
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:unregister docker_by_port
- name: Copy NC log to host
run: docker cp nextcloud:/var/www/html/data/nextcloud.log nextcloud.log
- name: Check logs
run: |
grep -q 'Hello from skeleton :)' nextcloud.log || error
grep -q 'Bye bye from skeleton :(' nextcloud.log || error
- name: Save container ingo & logs
if: always()
run: |
docker inspect skeleton | json_pp > container.json
docker logs skeleton > container.log 2>&1
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_by_port_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_by_port_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_by_port_nextcloud.log
path: nextcloud.log
if-no-files-found: warn
nc-docker-app-host-by-hostname:
runs-on: ubuntu-22.04
name: NC In Julius Docker(APP by hostname) • 🐘8.1
env:
docker-image: ghcr.io/juliushaertl/nextcloud-dev-php81:latest
steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Create containers
run: |
docker run --net=bridge --name=nextcloud -p 8080:80 --rm -d ${{ env.docker-image }}
docker pull kekru/docker-remote-api-tls:master
docker run -d -p 8443:443 -v /var/run/docker.sock:/var/run/docker.sock:ro \
--env CREATE_CERTS_WITH_PW=supersecret --env CERT_HOSTNAME=host.docker.internal \
-v `pwd`/certs:/data/certs kekru/docker-remote-api-tls:master
sleep 30s
- name: Install AppEcosystemV2
run: |
docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/${{ env.APP_NAME }}.git
docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git fetch origin $GITHUB_REF
docker exec -w /var/www/html/apps/${{ env.APP_NAME }} nextcloud git checkout FETCH_HEAD
docker exec nextcloud sudo -u www-data php occ app:enable app_ecosystem_v2
docker cp ./certs/client/ nextcloud:/
docker exec nextcloud sudo -u www-data php occ security:certificates:import /client/ca.pem
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:register \
docker_by_port Docker docker-install https host.docker.internal:8443 http://localhost:8080/index.php \
--net=host --hostname=host.docker.internal --ssl_cert /client/cert.pem --ssl_key /client/key.pem
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:deploy skeleton docker_by_port \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:register skeleton docker_by_port \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:enable skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:disable skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:unregister skeleton --silent
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:unregister docker_by_port
- name: Copy NC log to host
run: docker cp nextcloud:/var/www/html/data/nextcloud.log nextcloud.log
- name: Check logs
run: |
grep -q 'Hello from skeleton :)' nextcloud.log || error
grep -q 'Bye bye from skeleton :(' nextcloud.log || error
- name: Save container ingo & logs
if: always()
run: |
docker inspect skeleton | json_pp > container.json
docker logs skeleton > container.log 2>&1
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_host_by_hostname_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_host_by_hostname_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_host_by_hostname_nextcloud.log
path: nextcloud.log
if-no-files-found: warn
nc-host-app-docker-redis:
runs-on: ubuntu-22.04
name: NC In Host(Redis) • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }}
strategy:
fail-fast: false
matrix:
php-version: [ '8.1' ]
server-version: [ 'stable27' ]
include:
- server-version: "master"
php-version: "8.2"
services:
postgres:
image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
--name redis
ports:
- 6379:6379
steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-version }}
- name: Checkout AppEcosystemV2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql, redis
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
with:
files: apps/${{ env.APP_NAME }}/composer.json
- name: Set up dependencies
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
REDIS_HOST: localhost
REDIS_PORT: 6379
run: |
mkdir data
./occ maintenance:install --verbose --database=pgsql --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
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ config:system:set allow_local_remote_servers --value true
./occ config:system:set memcache.local --value "\\OC\\Memcache\\Redis"
./occ config:system:set memcache.distributed --value "\\OC\\Memcache\\Redis"
./occ config:system:set memcache.locking --value "\\OC\\Memcache\\Redis"
./occ config:system:set redis host --value ${{ env.REDIS_HOST }}
./occ config:system:set redis port --value ${{ env.REDIS_PORT }}
./occ app:enable --force ${{ env.APP_NAME }}
- name: Test deploy
run: |
php -S 127.0.0.1:8080 &
./occ app_ecosystem_v2:daemon:register docker_local_sock Docker docker-install unix-socket /var/run/docker.sock http://127.0.0.1:8080/index.php
./occ app_ecosystem_v2:app:deploy skeleton docker_local_sock \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
./occ app_ecosystem_v2:app:register skeleton docker_local_sock \
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/skeleton/appinfo/info.xml
./occ app_ecosystem_v2:app:enable skeleton
./occ app_ecosystem_v2:app:disable skeleton
./occ app_ecosystem_v2:app:unregister skeleton --silent
./occ app_ecosystem_v2:daemon:unregister docker_local_sock
- name: Check logs
run: |
grep -q 'Hello from skeleton :)' data/nextcloud.log || error
grep -q 'Bye bye from skeleton :(' data/nextcloud.log || error
- name: Save container ingo & logs
if: always()
run: |
docker inspect skeleton | json_pp > container.json
docker logs skeleton > container.log 2>&1
- name: Check redis keys
run: |
docker exec redis redis-cli keys '*app_ecosystem_v2*' || error
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_redis_${{ matrix.server-version }}_${{ matrix.php-version }}_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_redis_${{ matrix.server-version }}_${{ matrix.php-version }}_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_redis_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log
path: data/nextcloud.log
if-no-files-found: warn
tests-deploy-success:
permissions:
contents: none
runs-on: ubuntu-22.04
needs: [nc-host-app-docker, nc-docker-app-docker, nc-docker-app-docker-by-port,
nc-docker-app-host-by-hostname, nc-host-app-docker-redis]
name: Tests-Deploy-OK
steps:
- run: echo "Tests-Deploy passed successfully"