|
| 1 | +on: |
| 2 | + workflow_call: |
| 3 | + inputs: |
| 4 | + app-name: |
| 5 | + description: 'Name of the app' |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + php-version: |
| 9 | + description: PHP version the server should be setup with |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + core-ref: |
| 13 | + description: git reference to checkout for core |
| 14 | + required: false |
| 15 | + type: string |
| 16 | + default: '' |
| 17 | + app-repository: |
| 18 | + description: 'Repository of the app (optional, defaults to the current repository)' |
| 19 | + required: false |
| 20 | + type: string |
| 21 | + default: '' |
| 22 | + additional-packages: |
| 23 | + description: Additional Linux packages to be installed - space separated |
| 24 | + required: false |
| 25 | + type: string |
| 26 | + default: '' |
| 27 | + enable-xvfb-display-server: |
| 28 | + description: 'Provide the Xvfb display server for tests to use' |
| 29 | + required: false |
| 30 | + type: boolean |
| 31 | + default: false |
| 32 | + |
| 33 | +permissions: |
| 34 | + contents: read |
| 35 | + |
| 36 | +jobs: |
| 37 | + js-unit: |
| 38 | + name: Javascript Unit |
| 39 | + runs-on: ubuntu-latest |
| 40 | + permissions: |
| 41 | + contents: read |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Validate app-repository |
| 45 | + if: ${{ inputs.app-repository != '' }} |
| 46 | + env: |
| 47 | + APP_REPO: ${{ inputs.app-repository }} |
| 48 | + run: | |
| 49 | + if ! echo "$APP_REPO" | grep -qE '^owncloud/[a-zA-Z0-9._-]+$'; then |
| 50 | + echo "Error: app-repository must be within the owncloud/ namespace, got: $APP_REPO" |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: Clone owncloud/core |
| 55 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 56 | + with: |
| 57 | + repository: owncloud/core |
| 58 | + ref: ${{ inputs.core-ref }} |
| 59 | + |
| 60 | + - name: Checkout apps/${{ inputs.app-name }} |
| 61 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 62 | + with: |
| 63 | + path: apps/${{ inputs.app-name }} |
| 64 | + repository: ${{ inputs.app-repository }} |
| 65 | + |
| 66 | + - name: Install Linux packages |
| 67 | + if: ${{ inputs.additional-packages }} |
| 68 | + env: |
| 69 | + ADDITIONAL_PACKAGES: ${{ inputs.additional-packages }} |
| 70 | + run: | |
| 71 | + sudo apt-get install $ADDITIONAL_PACKAGES |
| 72 | +
|
| 73 | + - name: Xvfb display server |
| 74 | + if: ${{ inputs.enable-xvfb-display-server }} |
| 75 | + env: |
| 76 | + ADDITIONAL_PACKAGES: ${{ inputs.additional-packages }} |
| 77 | + run: | |
| 78 | + /usr/bin/Xvfb :99 & |
| 79 | + echo "DISPLAY=:99.0" >> $GITHUB_ENV |
| 80 | +
|
| 81 | + - name: Setup PHP |
| 82 | + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0 |
| 83 | + with: |
| 84 | + php-version: ${{ inputs.php-version }} |
| 85 | + extensions: apcu, ctype, curl, exif, fileinfo, gd, iconv, imagick, intl, json, mbstring, memcached, pdo, posix, simplexml, xml, zip, smbclient, ldap, krb5 |
| 86 | + ini-values: "memory_limit=1024M" |
| 87 | + env: |
| 88 | + fail-fast: true |
| 89 | + KRB5_LINUX_LIBS: libkrb5-dev |
| 90 | + |
| 91 | + - name: Install Dependencies |
| 92 | + env: |
| 93 | + APP_NAME: ${{ inputs.app-name }} |
| 94 | + run: | |
| 95 | + make |
| 96 | + cd "apps/${APP_NAME}" |
| 97 | + make vendor || true |
| 98 | +
|
| 99 | + - name: Install Server |
| 100 | + env: |
| 101 | + DATA_DIRECTORY: ${{ github.workspace }}/data |
| 102 | + DB_TYPE: "sqlite" |
| 103 | + DB_NAME: owncloud |
| 104 | + ADMIN_LOGIN: admin |
| 105 | + ADMIN_PASSWORD: admin |
| 106 | + |
| 107 | + run: | |
| 108 | + install_cmd="maintenance:install -vvv \ |
| 109 | + --database=${DB_TYPE} \ |
| 110 | + --database-name=${DB_NAME} \ |
| 111 | + --admin-user=${ADMIN_LOGIN} \ |
| 112 | + --admin-pass=${ADMIN_PASSWORD} \ |
| 113 | + --data-dir=${DATA_DIRECTORY} " |
| 114 | + |
| 115 | + php occ ${install_cmd} |
| 116 | + echo "enabling apps" |
| 117 | + php occ app:enable files_sharing |
| 118 | + php occ app:enable files_trashbin |
| 119 | + php occ app:enable files_versions |
| 120 | + php occ app:enable provisioning_api |
| 121 | + php occ app:enable federation |
| 122 | + php occ app:enable federatedfilesharing |
| 123 | +
|
| 124 | + - name: Setup App |
| 125 | + env: |
| 126 | + APP_NAME: ${{ inputs.app-name }} |
| 127 | + run: | |
| 128 | + php occ a:e "${APP_NAME}" |
| 129 | +
|
| 130 | + - name: Run jsunit |
| 131 | + env: |
| 132 | + APP_NAME: ${{ inputs.app-name }} |
| 133 | + run: | |
| 134 | + cd "apps/${APP_NAME}" |
| 135 | + make test-js |
| 136 | +
|
0 commit comments