From 2feb4eff9e53c283b5609693794c1e9f70e40509 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Fri, 18 Oct 2024 13:24:54 +0300 Subject: [PATCH 1/2] fixed links, actions. adjusted makefile, code. Signed-off-by: Alexander Piskun --- .github/workflows/publish-docker-cpu.yml | 4 +- .github/workflows/publish-docker-cuda.yml | 4 +- .github/workflows/publish-docker-rocm.yml | 4 +- .nextcloudignore | 8 ++- .pre-commit-config.yaml | 5 +- Dockerfile | 20 ++++---- Makefile | 59 +++++++++++++++-------- README.md | 2 +- appinfo/info-latest.xml | 16 +++--- appinfo/info.xml | 16 +++--- {lib => ex_app/lib}/main.py | 0 requirements.txt | 2 +- 12 files changed, 83 insertions(+), 57 deletions(-) rename {lib => ex_app/lib}/main.py (100%) diff --git a/.github/workflows/publish-docker-cpu.yml b/.github/workflows/publish-docker-cpu.yml index df9bf01..a4ed828 100644 --- a/.github/workflows/publish-docker-cpu.yml +++ b/.github/workflows/publish-docker-cpu.yml @@ -6,8 +6,8 @@ on: jobs: push_to_registry: name: Build image - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'cloud-py-api' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME + runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'nextcloud' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME permissions: packages: write contents: read diff --git a/.github/workflows/publish-docker-cuda.yml b/.github/workflows/publish-docker-cuda.yml index a950d7e..ec2c74e 100644 --- a/.github/workflows/publish-docker-cuda.yml +++ b/.github/workflows/publish-docker-cuda.yml @@ -6,8 +6,8 @@ on: jobs: push_to_registry: name: Build image - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'cloud-py-api' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME + runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'nextcloud' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME permissions: packages: write contents: read diff --git a/.github/workflows/publish-docker-rocm.yml b/.github/workflows/publish-docker-rocm.yml index 6c57990..a0df76f 100644 --- a/.github/workflows/publish-docker-rocm.yml +++ b/.github/workflows/publish-docker-rocm.yml @@ -6,8 +6,8 @@ on: jobs: push_to_registry: name: Build image - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'cloud-py-api' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME + runs-on: ubuntu-22.04 + if: ${{ github.repository_owner == 'nextcloud' }} # REPLACE THIS WITH YOUR ORGANIZATION NAME permissions: packages: write contents: read diff --git a/.nextcloudignore b/.nextcloudignore index 7f109c6..8650bbc 100644 --- a/.nextcloudignore +++ b/.nextcloudignore @@ -16,8 +16,6 @@ /babel.config.js /build /APPS.md -/AUTHORS.md -/CHANGELOG.md /HOW_TO_INSTALL.md /README.md /composer.* @@ -41,4 +39,10 @@ /requirements.txt /Dockerfile /results +/ex_app/js +/ex_app/lib +/ex_app/src +/ex_app_scripts +/translationtool.phar +/healthcheck.sh tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85230b4..5ae33fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,7 @@ ci: skip: [pylint] +exclude: '^ex_app/(img|js)/|.*\.phar' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 @@ -14,13 +15,13 @@ repos: rev: 5.13.2 hooks: - id: isort - files: lib/ + files: ex_app/lib/ - repo: https://github.com/psf/black rev: 24.4.2 hooks: - id: black - files: lib/ + files: ex_app/lib/ - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.5.5 diff --git a/Dockerfile b/Dockerfile index aa78bfd..7e0cb6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,11 @@ FROM python:3.11-slim-bookworm ARG BUILD_TYPE COPY requirements.txt / -ADD cs[s] /app/css -ADD im[g] /app/img -ADD j[s] /app/js -ADD l10[n] /app/l10n -ADD li[b] /app/lib +ADD /ex_app/cs[s] /ex_app/css +ADD /ex_app/im[g] /ex_app/img +ADD /ex_app/j[s] /ex_app/js +ADD /ex_app/l10[n] /ex_app/l10n +ADD /ex_app/li[b] /ex_app/lib COPY --chmod=775 healthcheck.sh / @@ -15,18 +15,18 @@ COPY --chmod=775 healthcheck.sh / RUN ARCH=$(uname -m) && \ if [ "$ARCH" = "aarch64" ]; then \ echo "Installing PyTorch for ARM64"; \ - python3 -m pip install torch torchvision torchaudio; \ + python3 -m pip install torch==2.4.1 torchvision torchaudio; \ elif [ "$BUILD_TYPE" = "rocm" ]; then \ - python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1; \ + python3 -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1; \ elif [ "$BUILD_TYPE" = "cpu" ]; then \ - python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; \ + python3 -m pip install torch==2.4.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; \ else \ - python3 -m pip install torch torchvision torchaudio; \ + python3 -m pip install torch==2.4.1 torchvision torchaudio; \ fi RUN \ python3 -m pip install -r requirements.txt && rm -rf ~/.cache && rm requirements.txt -WORKDIR /app/lib +WORKDIR /ex_app/lib ENTRYPOINT ["python3", "main.py"] HEALTHCHECK --interval=2s --timeout=2s --retries=300 CMD /healthcheck.sh diff --git a/Makefile b/Makefile index 680dfd0..c60d737 100644 --- a/Makefile +++ b/Makefile @@ -1,37 +1,58 @@ .DEFAULT_GOAL := help +APP_ID := test-deploy +APP_NAME := TestDeploy +APP_VERSION := $$(xmlstarlet sel -t -v "//version" appinfo/info.xml) + + .PHONY: help help: - @echo "Welcome to Test-Deploy app. Please use \`make \` where is one of" + @echo " Welcome to $(APP_NAME) $(APP_VERSION)!" + @echo " " + @echo " Please use \`make \` where is one of" + @echo " " + @echo " build-push builds app docker image with 'release' tag and uploads it to ghcr.io" + @echo " build-push-latest builds app docker image with 'latest' tag and uploads it to ghcr.io" @echo " " - @echo " Next commands are only for dev environment with nextcloud-docker-dev!" - @echo " " - @echo " build-push build and push release version of image" - @echo " build-push-latest build and push dev version of image" - @echo " " - @echo " run deploy release of 'Test-Deploy' for Nextcloud 28" - @echo " run-debug deploy dev version of 'Test-Deploy' for Nextcloud 28" + @echo " > Next commands are only for the dev environment with nextcloud-docker-dev!" + @echo " > They should run from the host you are developing on and not in the container with Nextcloud!" + @echo " " + @echo " run30 installs $(APP_NAME) for Nextcloud 30" + @echo " run installs $(APP_NAME) for Nextcloud Latest" + @echo " " + @echo " run30-latest installs $(APP_NAME) with 'latest' tag for Nextcloud 30" + @echo " run-latest installs $(APP_NAME) with 'latest' tag for Nextcloud Latest" .PHONY: build-push build-push: docker login ghcr.io - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/test-deploy:release-cpu --build-arg BUILD_TYPE=cpu . - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/test-deploy:release-cuda --build-arg BUILD_TYPE=cuda . - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/test-deploy:release-rocm --build-arg BUILD_TYPE=rocm . + docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-cpu --build-arg BUILD_TYPE=cpu . + docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-cuda --build-arg BUILD_TYPE=cuda . + docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):release-rocm --build-arg BUILD_TYPE=rocm . .PHONY: build-push-latest build-push-latest: docker login ghcr.io - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/test-deploy:latest-cpu --build-arg BUILD_TYPE=cpu . - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/test-deploy:latest-cuda --build-arg BUILD_TYPE=cuda . - docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/test-deploy:latest-rocm --build-arg BUILD_TYPE=rocm . + docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-cpu --build-arg BUILD_TYPE=cpu . + docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-cuda --build-arg BUILD_TYPE=cuda . + docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/nextcloud/$(APP_ID):latest-rocm --build-arg BUILD_TYPE=rocm . + +.PHONY: run30 +run30: + docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \ + --info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info.xml .PHONY: run run: - docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register test-deploy --force-scopes --test-deploy-mode \ - --info-xml https://raw.githubusercontent.com/cloud-py-api/test-deploy/main/appinfo/info.xml + docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \ + --info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info.xml + +.PHONY: run30-latest +run30-latest: + docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \ + --info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info-latest.xml .PHONY: run-latest -run-debug: - docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register test-deploy --force-scopes --test-deploy-mode \ - --info-xml https://raw.githubusercontent.com/cloud-py-api/test-deploy/main/appinfo/info-latest.xml +run-latest: + docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register $(APP_ID) --test-deploy-mode \ + --info-xml https://raw.githubusercontent.com/nextcloud/$(APP_ID)/main/appinfo/info-latest.xml diff --git a/README.md b/README.md index 7295e98..4ac0dfe 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AppAPI: deployment test -This repository is used in [AppAPI](https://github.com/cloud-py-api/app_api) as a test application when you click on the "Test Deploy" button +This repository is used in [AppAPI](https://github.com/nextcloud/app_api) as a test application when you click on the "Test Deploy" button It differs from skeleton in that there are images of Python separately for CPU, AMD and NVIDIA. diff --git a/appinfo/info-latest.xml b/appinfo/info-latest.xml index fbc6aee..9e63341 100644 --- a/appinfo/info-latest.xml +++ b/appinfo/info-latest.xml @@ -1,28 +1,28 @@ test-deploy - Test Deploy + TestDeploy Docker AppAPI deployment process test - 1.0.0 + 1.0.1 MIT Andrey Borysenko Alexander Piskun AppAPI_test_deploy tools - https://github.com/cloud-py-api/test-deploy - https://github.com/cloud-py-api/app_api/discussions - https://github.com/cloud-py-api/app_api/issues - https://github.com/cloud-py-api/test-deploy + https://github.com/nextcloud/test-deploy + https://github.com/nextcloud/app_api/discussions + https://github.com/nextcloud/app_api/issues + https://github.com/nextcloud/test-deploy - + ghcr.io - cloud-py-api/test-deploy + nextcloud/test-deploy latest diff --git a/appinfo/info.xml b/appinfo/info.xml index ca9fb10..d4285aa 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,28 +1,28 @@ test-deploy - Test Deploy + TestDeploy Docker AppAPI deployment process test - 1.0.0 + 1.0.1 MIT Andrey Borysenko Alexander Piskun AppAPI_test_deploy tools - https://github.com/cloud-py-api/test-deploy - https://github.com/cloud-py-api/app_api/discussions - https://github.com/cloud-py-api/app_api/issues - https://github.com/cloud-py-api/test-deploy + https://github.com/nextcloud/test-deploy + https://github.com/nextcloud/app_api/discussions + https://github.com/nextcloud/app_api/issues + https://github.com/nextcloud/test-deploy - + ghcr.io - cloud-py-api/test-deploy + nextcloud/test-deploy release diff --git a/lib/main.py b/ex_app/lib/main.py similarity index 100% rename from lib/main.py rename to ex_app/lib/main.py diff --git a/requirements.txt b/requirements.txt index ec8a89b..d946358 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -nc_py_api[app]>=0.15.1 +nc_py_api[app]>=0.17.1 From 0d8d9925af72ce1999a301ff9f0034a513b13b62 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Fri, 18 Oct 2024 13:31:10 +0300 Subject: [PATCH 2/2] CI: removed "pylint" mentioning Signed-off-by: Alexander Piskun --- .pre-commit-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ae33fa..f146ca7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,3 @@ -ci: - skip: [pylint] - exclude: '^ex_app/(img|js)/|.*\.phar' repos: - repo: https://github.com/pre-commit/pre-commit-hooks