poc: ocis github actions steps

This commit is contained in:
Michal Klos committed 2026-04-22 21:13:32 +02:00
1 parent 6a64bcb9e9
commit 19cbc76486
8 files changed
+523 -1

No files matched your search

+166
View File
@@ -0,0 +1,166 @@
name: ocis-setup
description: Start an oCIS instance with optional services (antivirus, email, tika, ociswrapper)
inputs:
ocis-version:
description: oCIS release version (e.g. 8.0.1) or "latest" — ignored when ocis-binary is set
required: false
default: latest
ocis-binary:
description: Path to a pre-built oCIS binary; skips download when provided
required: false
default: ""
admin-password:
description: Admin user password
required: false
default: admin
log-level:
description: oCIS log level
required: false
default: error
demo-users:
description: Create demo users (IDM_CREATE_DEMO_USERS=true)
required: false
default: "false"
wrapper:
description: Start ociswrapper on :5200 for dynamic reconfiguration
required: false
default: "true"
tika:
description: Start Apache Tika on :9998 for full-text search
required: false
default: "false"
email:
description: Start Mailpit SMTP (:1025) and API (:8025)
required: false
default: "false"
antivirus:
description: Start ClamAV on :3310 and enable postprocessing
required: false
default: "false"
extra-server-env:
description: JSON object of additional env vars to pass to the oCIS server
required: false
default: "{}"
outputs:
ocis-url:
description: oCIS instance URL
value: https://localhost:9200
runs:
using: composite
steps:
# -------------------------------------------------------------------------
# 1. Install oCIS binary (skip when a pre-built binary is provided)
# -------------------------------------------------------------------------
- name: Install oCIS binary from release
if: inputs.ocis-binary == ''
shell: bash
env:
OCIS_VERSION: ${{ inputs.ocis-version }}
run: ${{ github.action_path }}/scripts/install-ocis.sh
- name: Use pre-built oCIS binary
if: inputs.ocis-binary != ''
shell: bash
run: |
sudo cp "${{ inputs.ocis-binary }}" /usr/local/bin/ocis
sudo chmod +x /usr/local/bin/ocis
echo "Using pre-built oCIS: $(ocis --version 2>&1 | head -1)"
# -------------------------------------------------------------------------
# 2. Build ociswrapper (always — it is always used as the process launcher)
# -------------------------------------------------------------------------
- name: Build ociswrapper from source (when using release binary)
if: inputs.ocis-binary == ''
shell: bash
env:
OCIS_VERSION: ${{ inputs.ocis-version }}
run: ${{ github.action_path }}/scripts/install-wrapper.sh
- name: Build ociswrapper from local source (when using pre-built binary)
if: inputs.ocis-binary != ''
shell: bash
working-directory: ${{ github.workspace }}/tests/ociswrapper
run: |
GOWORK=off go build -o /tmp/ociswrapper .
sudo mv /tmp/ociswrapper /usr/local/bin/ociswrapper
echo "ociswrapper built from local source."
# -------------------------------------------------------------------------
# 3. Optional services
# -------------------------------------------------------------------------
- name: Start Mailpit (email)
if: inputs.email == 'true'
shell: bash
run: |
docker run -d --name mailpit --network host axllent/mailpit:v1.22.3
timeout 60 bash -c 'until curl -sf http://localhost:8025/api/v1/messages; do sleep 1; done'
echo "mailpit ready."
- name: Start ClamAV (antivirus)
if: inputs.antivirus == 'true'
shell: bash
run: |
docker run -d --name clamav --network host owncloudci/clamavd
echo "Waiting for ClamAV on :3310 (may take up to 5 min for virus DB download)..."
timeout 300 bash -c '
while true; do
if (echo "" | nc -z localhost 3310) 2>/dev/null || \
python3 -c "import socket,sys; s=socket.create_connection((\"localhost\",3310),2); s.close()" 2>/dev/null; then
break
fi
sleep 2
done
'
echo "clamav ready."
- name: Start Tika (full-text search)
if: inputs.tika == 'true'
shell: bash
run: |
docker run -d --name tika --network host apache/tika:3.2.2.0-full
timeout 120 bash -c 'until curl -sf http://localhost:9998; do sleep 2; done'
echo "tika ready."
# -------------------------------------------------------------------------
# 4. Init oCIS + copy config files
# -------------------------------------------------------------------------
- name: Init oCIS
shell: bash
env:
OCIS_ACTION_PATH: ${{ github.action_path }}
run: ${{ github.action_path }}/scripts/init-ocis.sh
# -------------------------------------------------------------------------
# 5. Start oCIS via ociswrapper
# -------------------------------------------------------------------------
- name: Start oCIS
shell: bash
env:
ADMIN_PASSWORD: ${{ inputs.admin-password }}
LOG_LEVEL: ${{ inputs.log-level }}
DEMO_USERS: ${{ inputs.demo-users }}
ANTIVIRUS_ENABLED: ${{ inputs.antivirus }}
EMAIL_ENABLED: ${{ inputs.email }}
TIKA_ENABLED: ${{ inputs.tika }}
EXTRA_SERVER_ENV: ${{ inputs.extra-server-env }}
OCIS_REPO_ROOT: ${{ github.workspace }}
run: ${{ github.action_path }}/scripts/start-ocis.sh
# -------------------------------------------------------------------------
# 6. Wait for oCIS to be healthy
# -------------------------------------------------------------------------
- name: Wait for oCIS
shell: bash
run: |
echo "Waiting for oCIS at https://localhost:9200..."
timeout 300 bash -c '
until curl -sk -uadmin:admin https://localhost:9200/graph/v1.0/users/admin \
-w "%{http_code}" -o /dev/null 2>/dev/null | grep -q "200"; do
sleep 2
done
' || (echo "=== oCIS failed to start ===" && \
cat /tmp/ocis-server.log 2>/dev/null | tail -50 && exit 1)
echo "ocis ready."
@@ -0,0 +1,9 @@
app_registry:
mimetypes:
- mime_type: application/vnd.oasis.opendocument.text
extension: odt
name: OpenDocument
description: OpenDocument text document
icon: ""
default_app: FakeOffice
allow_creation: true
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
# Initialize oCIS config directory and copy required config files.
# OCIS_ACTION_PATH: path to the action directory (contains config/)
# The action is used from within a repo checkout so GITHUB_WORKSPACE is set.
CONFIG_DIR="${HOME}/.ocis/config"
mkdir -p "$CONFIG_DIR"
ocis init --insecure true
# app-registry.yaml: bundled with this action so it works without a repo checkout
cp "${OCIS_ACTION_PATH}/config/app-registry.yaml" "${CONFIG_DIR}/app-registry.yaml"
echo "oCIS config initialized at ${CONFIG_DIR}"
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
# OCIS_VERSION: "latest" or a specific version like "8.0.1"
VERSION="${OCIS_VERSION:-latest}"
if [[ "$VERSION" == "latest" ]]; then
VERSION=$(curl -s https://api.github.com/repos/owncloud/ocis/releases/latest \
| python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'].lstrip('v'))")
fi
echo "Installing oCIS $VERSION..."
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH_SUFFIX="amd64" ;;
aarch64) ARCH_SUFFIX="arm64" ;;
*) echo "Unsupported arch: $ARCH"; exit 1 ;;
esac
BASE_URL="https://github.com/owncloud/ocis/releases/download/v${VERSION}"
BINARY="ocis-${VERSION}-linux-${ARCH_SUFFIX}"
curl -sLo /tmp/ocis "${BASE_URL}/${BINARY}"
curl -sLo /tmp/ocis.sha256 "${BASE_URL}/${BINARY}.sha256"
# sha256 file contains "HASH filename" — rewrite to match our local path
HASH=$(awk '{print $1}' /tmp/ocis.sha256)
echo "${HASH} /tmp/ocis" | sha256sum -c -
chmod +x /tmp/ocis
sudo mv /tmp/ocis /usr/local/bin/ocis
echo "oCIS $(ocis --version 2>&1 | head -1) installed."
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
# ociswrapper is not published as a release artifact.
# Sparse-clone only tests/ociswrapper/ from the matching tag and build it.
VERSION="${OCIS_VERSION:-latest}"
if [[ "$VERSION" == "latest" ]]; then
VERSION=$(curl -s https://api.github.com/repos/owncloud/ocis/releases/latest \
| python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'].lstrip('v'))")
fi
CLONE_DIR="/tmp/ocis-src-wrapper"
rm -rf "$CLONE_DIR"
echo "Sparse-cloning ociswrapper from tag v${VERSION}..."
git clone --depth=1 --filter=blob:none --sparse \
--branch "v${VERSION}" \
https://github.com/owncloud/ocis.git "$CLONE_DIR"
cd "$CLONE_DIR"
git sparse-checkout set tests/ociswrapper
cd tests/ociswrapper
echo "Building ociswrapper..."
GOWORK=off go build -o /tmp/ociswrapper .
sudo mv /tmp/ociswrapper /usr/local/bin/ociswrapper
echo "ociswrapper installed at $(which ociswrapper)"
rm -rf "$CLONE_DIR"
+137
View File
@@ -0,0 +1,137 @@
#!/usr/bin/env bash
set -euo pipefail
# Start oCIS via ociswrapper.
# ociswrapper wraps the ocis binary and exposes HTTP API on :5200
# for dynamic reconfiguration (env var changes at runtime).
#
# Environment variables set by action.yml:
# ADMIN_PASSWORD, LOG_LEVEL, DEMO_USERS
# ANTIVIRUS_ENABLED, EMAIL_ENABLED, TIKA_ENABLED
# EXTRA_SERVER_ENV (JSON object)
# OCIS_REPO_ROOT (GITHUB_WORKSPACE — needed for config file paths)
OCIS_URL="https://localhost:9200"
CONFIG_DIR="${HOME}/.ocis/config"
# Generate a throw-away fontsMap.json pointing at the font shipped in the repo.
# Tests that render thumbnails from text files need this.
REPO_ROOT="${OCIS_REPO_ROOT:-${GITHUB_WORKSPACE}}"
FONT_PATH="${REPO_ROOT}/tests/config/drone/NotoSans.ttf"
FONTMAP=$(mktemp /tmp/fontsMap-XXXXXX.json)
echo "{\"defaultFont\": \"${FONT_PATH}\"}" > "$FONTMAP"
declare -A SERVER_ENV=(
[OCIS_URL]="$OCIS_URL"
[OCIS_CONFIG_DIR]="$CONFIG_DIR"
[STORAGE_USERS_DRIVER]="ocis"
[PROXY_ENABLE_BASIC_AUTH]="true"
[OCIS_LOG_LEVEL]="${LOG_LEVEL:-error}"
[IDM_CREATE_DEMO_USERS]="${DEMO_USERS:-false}"
[IDM_ADMIN_PASSWORD]="${ADMIN_PASSWORD:-admin}"
[FRONTEND_SEARCH_MIN_LENGTH]="2"
[OCIS_ASYNC_UPLOADS]="true"
[OCIS_EVENTS_ENABLE_TLS]="false"
[NATS_NATS_HOST]="0.0.0.0"
[NATS_NATS_PORT]="9233"
[MICRO_REGISTRY_ADDRESS]="127.0.0.1:9233"
[OCIS_JWT_SECRET]="some-ocis-jwt-secret"
[EVENTHISTORY_STORE]="memory"
[OCIS_TRANSLATION_PATH]="${REPO_ROOT}/tests/config/translations"
[WEB_UI_CONFIG_FILE]="${REPO_ROOT}/tests/config/drone/ocis-config.json"
[THUMBNAILS_TXT_FONTMAP_FILE]="$FONTMAP"
[SEARCH_EXTRACTOR_TYPE]="basic"
[FRONTEND_FULL_TEXT_SEARCH_ENABLED]="false"
# debug addresses
[ACTIVITYLOG_DEBUG_ADDR]="0.0.0.0:9197"
[APP_PROVIDER_DEBUG_ADDR]="0.0.0.0:9165"
[APP_REGISTRY_DEBUG_ADDR]="0.0.0.0:9243"
[AUTH_BASIC_DEBUG_ADDR]="0.0.0.0:9147"
[AUTH_MACHINE_DEBUG_ADDR]="0.0.0.0:9167"
[AUTH_SERVICE_DEBUG_ADDR]="0.0.0.0:9198"
[CLIENTLOG_DEBUG_ADDR]="0.0.0.0:9260"
[EVENTHISTORY_DEBUG_ADDR]="0.0.0.0:9270"
[FRONTEND_DEBUG_ADDR]="0.0.0.0:9141"
[GATEWAY_DEBUG_ADDR]="0.0.0.0:9143"
[GRAPH_DEBUG_ADDR]="0.0.0.0:9124"
[GROUPS_DEBUG_ADDR]="0.0.0.0:9161"
[IDM_DEBUG_ADDR]="0.0.0.0:9239"
[IDP_DEBUG_ADDR]="0.0.0.0:9134"
[INVITATIONS_DEBUG_ADDR]="0.0.0.0:9269"
[NATS_DEBUG_ADDR]="0.0.0.0:9234"
[OCDAV_DEBUG_ADDR]="0.0.0.0:9163"
[OCM_DEBUG_ADDR]="0.0.0.0:9281"
[OCS_DEBUG_ADDR]="0.0.0.0:9114"
[POSTPROCESSING_DEBUG_ADDR]="0.0.0.0:9255"
[PROXY_DEBUG_ADDR]="0.0.0.0:9205"
[SEARCH_DEBUG_ADDR]="0.0.0.0:9224"
[SETTINGS_DEBUG_ADDR]="0.0.0.0:9194"
[SHARING_DEBUG_ADDR]="0.0.0.0:9151"
[SSE_DEBUG_ADDR]="0.0.0.0:9139"
[STORAGE_PUBLICLINK_DEBUG_ADDR]="0.0.0.0:9179"
[STORAGE_SHARES_DEBUG_ADDR]="0.0.0.0:9156"
[STORAGE_SYSTEM_DEBUG_ADDR]="0.0.0.0:9217"
[STORAGE_USERS_DEBUG_ADDR]="0.0.0.0:9159"
[THUMBNAILS_DEBUG_ADDR]="0.0.0.0:9189"
[USERLOG_DEBUG_ADDR]="0.0.0.0:9214"
[USERS_DEBUG_ADDR]="0.0.0.0:9145"
[WEB_DEBUG_ADDR]="0.0.0.0:9104"
[WEBDAV_DEBUG_ADDR]="0.0.0.0:9119"
[WEBFINGER_DEBUG_ADDR]="0.0.0.0:9279"
)
# Antivirus
if [[ "${ANTIVIRUS_ENABLED:-false}" == "true" ]]; then
SERVER_ENV[ANTIVIRUS_SCANNER_TYPE]="clamav"
SERVER_ENV[ANTIVIRUS_CLAMAV_SOCKET]="tcp://localhost:3310"
SERVER_ENV[POSTPROCESSING_STEPS]="virusscan"
SERVER_ENV[OCIS_ADD_RUN_SERVICES]="antivirus"
SERVER_ENV[ANTIVIRUS_DEBUG_ADDR]="0.0.0.0:9277"
fi
# Email (notifications service)
if [[ "${EMAIL_ENABLED:-false}" == "true" ]]; then
SERVER_ENV[OCIS_ADD_RUN_SERVICES]="${SERVER_ENV[OCIS_ADD_RUN_SERVICES]:+${SERVER_ENV[OCIS_ADD_RUN_SERVICES]},}notifications"
SERVER_ENV[NOTIFICATIONS_SMTP_HOST]="localhost"
SERVER_ENV[NOTIFICATIONS_SMTP_PORT]="1025"
SERVER_ENV[NOTIFICATIONS_SMTP_INSECURE]="true"
SERVER_ENV[NOTIFICATIONS_SMTP_SENDER]="ownCloud <noreply@example.com>"
SERVER_ENV[NOTIFICATIONS_DEBUG_ADDR]="0.0.0.0:9174"
fi
# Tika (full-text search)
if [[ "${TIKA_ENABLED:-false}" == "true" ]]; then
SERVER_ENV[FRONTEND_FULL_TEXT_SEARCH_ENABLED]="true"
SERVER_ENV[SEARCH_EXTRACTOR_TYPE]="tika"
SERVER_ENV[SEARCH_EXTRACTOR_TIKA_TIKA_URL]="http://localhost:9998"
SERVER_ENV[SEARCH_EXTRACTOR_CS3SOURCE_INSECURE]="true"
fi
# Extra env vars from JSON input — use null-delimited records to handle values with '=' or newlines
if [[ -n "${EXTRA_SERVER_ENV:-}" && "${EXTRA_SERVER_ENV}" != "{}" ]]; then
while IFS=$'\x01' read -r -d $'\x00' key val; do
SERVER_ENV["$key"]="$val"
done < <(echo "$EXTRA_SERVER_ENV" | python3 -c "
import sys, json
d = json.load(sys.stdin)
for k, v in d.items():
sys.stdout.buffer.write(k.encode() + b'\x01' + v.encode() + b'\x00')
")
fi
# Build env for the subprocess
ENV_ARGS=()
for key in "${!SERVER_ENV[@]}"; do
ENV_ARGS+=("${key}=${SERVER_ENV[$key]}")
done
echo "Starting ociswrapper + oCIS server..."
env "${ENV_ARGS[@]}" ociswrapper serve \
--bin /usr/local/bin/ocis \
--url "$OCIS_URL" \
--admin-username admin \
--admin-password "${ADMIN_PASSWORD:-admin}" \
> /tmp/ocis-server.log 2>&1 &
echo $! > /tmp/ocis-wrapper.pid
echo "ociswrapper started (PID $(cat /tmp/ocis-wrapper.pid)), log: /tmp/ocis-server.log"
+94
View File
@@ -0,0 +1,94 @@
name: ocis-test
description: Run oCIS Behat acceptance tests against a running oCIS instance
inputs:
suite:
description: Behat suite(s) to run, comma-separated (e.g. apiGraph or apiAntivirus,apiSettings)
required: true
ocis-url:
description: oCIS instance URL
required: false
default: https://localhost:9200
expected-failures-file:
description: Path to expected failures markdown (relative to repo root)
required: false
default: ""
acceptance-test-type:
description: Test type passed as ACCEPTANCE_TEST_TYPE (api or core-api)
required: false
default: api
with-remote-php:
description: Include remote.php expected failures (WITH_REMOTE_PHP)
required: false
default: "false"
runs:
using: composite
steps:
- name: Install libcurl 8.12.0 build dependencies
shell: bash
run: |
sudo apt-get update -qq
sudo NEEDRESTART_MODE=a apt-get install -y \
libssl-dev libnghttp2-dev libpsl-dev libldap-dev libssh-dev zlib1g-dev libvips-dev
- name: Cache libcurl 8.12.0
id: cache-libcurl
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: /opt/libcurl
key: libcurl-8.12.0-${{ runner.os }}
- name: Compile libcurl 8.12.0 from source
if: steps.cache-libcurl.outputs.cache-hit != 'true'
shell: bash
run: |
cd /tmp
curl -sLO https://curl.se/download/curl-8.12.0.tar.gz
tar xzf curl-8.12.0.tar.gz
cd curl-8.12.0
./configure --with-ssl --with-zlib --with-nghttp2 --prefix=/opt/libcurl \
--enable-versioned-symbols --silent
make -j$(nproc) --silent
sudo make install --silent
- name: Restore libcurl ldconfig
shell: bash
run: |
echo "/opt/libcurl/lib" | sudo tee /etc/ld.so.conf.d/libcurl-8.conf
sudo ldconfig
/opt/libcurl/bin/curl --version | head -1
php -r '
$v = curl_version()["version"];
echo "PHP curl: $v\n";
if (version_compare($v, "8.12.0", "<")) {
fwrite(STDERR, "FATAL: PHP sees libcurl $v, need >= 8.12.0\n");
exit(1);
}
'
- name: Install Composer dependencies
shell: bash
working-directory: ${{ github.workspace }}
run: |
COMPOSER_NO_INTERACTION=1 COMPOSER_NO_AUDIT=1 composer install --no-progress
COMPOSER_NO_INTERACTION=1 COMPOSER_NO_AUDIT=1 \
composer bin behat install --no-progress
- name: Run ${{ inputs.suite }}
shell: bash
working-directory: ${{ github.workspace }}
env:
BEHAT_SUITES: ${{ inputs.suite }}
TEST_SERVER_URL: ${{ inputs.ocis-url }}
OCIS_WRAPPER_URL: http://localhost:5200
ACCEPTANCE_TEST_TYPE: ${{ inputs.acceptance-test-type }}
WITH_REMOTE_PHP: ${{ inputs.with-remote-php }}
EXPECTED_FAILURES_FILE: ${{ inputs.expected-failures-file }}
STORAGE_DRIVER: ocis
UPLOAD_DELETE_WAIT_TIME: "0"
EMAIL_HOST: localhost
EMAIL_PORT: "8025"
# Filter tags mirror run-github.py logic
BEHAT_FILTER_TAGS: ${{ inputs.acceptance-test-type == 'core-api' && '~@skipOnGraph&&~@skipOnOcis-OCIS-Storage' || '~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage' }}
run: make test-acceptance-api
+38 -1
View File
@@ -494,8 +494,45 @@ jobs:
- name: Run WOPI validator (cs3)
run: python3 tests/acceptance/run-wopi.py --type cs3
# Validate that the ocis-setup + ocis-test composite actions work in this repo.
composite-actions-apiGraph:
name: composite-actions-apiGraph
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "24"
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip, ldap, gd
tools: composer
- name: Build oCIS from source
run: |
make ci-node-generate
make -C ocis build
- name: Setup oCIS
uses: ./.github/actions/ocis-setup
with:
ocis-binary: ocis/bin/ocis
- name: Test apiGraph
uses: ./.github/actions/ocis-test
with:
suite: apiGraph
all-acceptance-tests:
needs: [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
needs: [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests, composite-actions-apiGraph]
runs-on: ubuntu-latest
if: always()
steps: