From f5895400e17ca663df235754e0524a68510df07f Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 7 May 2024 16:35:36 +0545 Subject: [PATCH] ci: add ocis service --- .github/workflows/ci.yml | 84 +++++++++++++++--------------------- tests/e2e/ci/web.config.json | 10 ++--- 2 files changed, 39 insertions(+), 55 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d85687..3465c0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,8 @@ jobs: run_install: | - args: [--frozen-lockfile, --strict-peer-dependencies] - # - name: lint - # run: pnpm lint + - name: lint + run: pnpm lint - name: build run: pnpm build @@ -28,11 +28,11 @@ jobs: - name: generate-ssl-certs run: | openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ - -keyout ${{ github.workspace }}/tests/e2e/ci/nginx/nginx-ssl.key \ - -out ${{ github.workspace }}/tests/e2e/ci/nginx/nginx-ssl.crt \ - -subj "/CN=localhost" + -keyout ${{ github.workspace }}/tests/e2e/ci/nginx/nginx-ssl.key \ + -out ${{ github.workspace }}/tests/e2e/ci/nginx/nginx-ssl.crt \ + -subj "/CN=localhost" - - name: serve-extension + - name: extension-server run: | docker run -d \ -p 8443:443 \ @@ -40,52 +40,36 @@ jobs: -v ${{ github.workspace }}/dist:/usr/share/nginx/html \ nginx:1.25.3 + - name: ocis-server + run: | + docker run -d \ + -p 9200:9200 \ + -e OCIS_URL=https://ocis:9200 \ + -e OCIS_INSECURE=true \ + -e OCIS_LOG_LEVEL=error \ + -e WEB_UI_CONFIG_FILE=/web/config.json \ + -e IDM_ADMIN_PASSWORD=admin \ + -e PROXY_ENABLE_BASIC_AUTH=true \ + -v ${{ github.workspace }}/tests/e2e/ci/web.config.json:/web/config.json:ro \ + --entrypoint sh \ + owncloud/ocis:5.0.0 \ + -c 'ocis init || true && ocis server' + - name: host-ip id: host_ip run: echo "host_ip=$(hostname -I | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" - name: wait-services - run: docker run --rm --add-host dockerhost:${{ steps.host_ip.outputs.host_ip }} owncloudci/wait-for -it dockerhost:8443 -t 10 - - # e2e: - # runs-on: ubuntu-latest - # container: node:18 - # services: - # extension: - # image: nginx:1.25.3 - # volumes: - # - ${{ github.workspace }}/tests/e2e/ci/nginx.conf:/etc/nginx/conf.d/default.conf:ro - # - ${{ github.workspace }}/dist:/usr/share/nginx/html:ro - - # ocis: - # image: owncloud/ocis:5.0.0 - # env: - # OCIS_URL: https://ocis:9200 - # OCIS_INSECURE: true - # OCIS_LOG_LEVEL: error - # WEB_UI_CONFIG_FILE: /web/config.json - # IDM_ADMIN_PASSWORD: admin - # PROXY_ENABLE_BASIC_AUTH: true - # volumes: - # - ${{ github.workspace }}/tests/e2e/ci/web.config.json:/web/config.json:ro - - # steps: - # - name: checkout - # uses: actions/checkout@v4 - - # - name: pnpm-install - # uses: pnpm/action-setup@v3 - # with: - # run_install: | - # - args: [--frozen-lockfile, --strict-peer-dependencies] - - # - name: build - # run: pwd && ls && pnpm build - - # - name: install-chromium - # run: npx playwright install chromium - - # - name: e2e - # run: sleep 5 && pnpm test:e2e tests/e2e/features/**/*.feature - # env: - # OCIS_URL: https://ocis:9200 + run: | + docker run --rm \ + --add-host dockerhost:${{ steps.host_ip.outputs.host_ip }} \ + owncloudci/wait-for \ + -it dockerhost:8443,dockerhost:9200 -t 10 + + - name: install-chromium + run: npx playwright install chromium + + - name: e2e + run: sleep 5 && pnpm test:e2e tests/e2e/features/**/*.feature + env: + OCIS_URL: https://localhost:9200 diff --git a/tests/e2e/ci/web.config.json b/tests/e2e/ci/web.config.json index b9703f9..e4a1dca 100644 --- a/tests/e2e/ci/web.config.json +++ b/tests/e2e/ci/web.config.json @@ -1,9 +1,9 @@ { - "server": "https://ocis:9200", - "theme": "https://ocis:9200/themes/owncloud/theme.json", + "server": "https://localhost:9200", + "theme": "https://localhost:9200/themes/owncloud/theme.json", "openIdConnect": { - "metadata_url": "https://ocis:9200/.well-known/openid-configuration", - "authority": "https://ocis:9200", + "metadata_url": "https://localhost:9200/.well-known/openid-configuration", + "authority": "https://localhost:9200", "client_id": "web", "response_type": "code", "scope": "openid profile email" @@ -48,7 +48,7 @@ }, { "id": "presentation-viewer", - "path": "https://extension:3000/com.github.jankaritech.web.mdpresentation/extension.js" + "path": "https://localhost:8443/com.github.jankaritech.web.mdpresentation/extension.js" } ] }