diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 6a17c96cd..000000000 --- a/.drone.yml +++ /dev/null @@ -1,168 +0,0 @@ -kind: pipeline -name: cypress-e2e-testing - -services: - # nextcloud server - - name: server - image: nextcloudci/server:server-16 - commands: - # Add app sources to the app directory - - export BRANCH=$DRONE_TARGET_BRANCH - - echo "Testing against $BRANCH" - - ln -s /drone/src /var/www/html/apps/viewer - - ls -lLa /var/www/html/apps/viewer - - mkdir /var/www/html/data - - chown -R www-data:www-data /var/www/html/apps/viewer - - chown -R www-data:www-data /var/www/html/data - - # Install nextcloud, watch logs and run apache - - bash /usr/local/bin/initAndRun.sh - -steps: - # clone and build the app - - name: build - image: nextcloudci/node:node-5 - volumes: - - name: cache - path: /root/.cache - commands: - - git --no-pager log -1 - - npm ci - - npm run build - - npm i -g @bahmutov/print-env - - print-env DRONE - - # wait on server to be ready - - name: wait-on-server - image: nextcloudci/node:node-5 - environment: - CYPRESS_baseUrl: http://server/index.php - commands: - - WAIT_ON=$CYPRESS_baseUrl - # Add app sources to the app directory - - echo "Waiting for $WAIT_ON" - - npm install -g wait-on - - wait-on -i 500 -t 120000 $WAIT_ON - - - name: testing 1 - image: cypress/browsers:chrome69 - depends_on: - - build - - wait-on-server - # avoid memory process crash - # https://docs.cypress.io/guides/references/error-messages.html#The-Chromium-Renderer-process-just-crashed - resources: - limits: - cpu: 3 - memory: 800Mi - requests: - cpu: 0.5 - memory: 500Mi - volumes: - - name: cache - path: /root/.cache - - name: droneshm - path: /dev/shm - environment: - CYPRESS_RECORD_TOKEN: - from_secret: cypress_record_token - CYPRESS_baseUrl: http://server/index.php/ - LOGIN: login - commands: - - cd /drone/src - - $(npm bin)/cypress run --record --key $CYPRESS_RECORD_TOKEN --parallel --ci-build-id ci-$DRONE_BUILD_NUMBER-master - - - name: testing 2 - image: cypress/browsers:chrome69 - depends_on: - - build - - wait-on-server - # avoid memory process crash - # https://docs.cypress.io/guides/references/error-messages.html#The-Chromium-Renderer-process-just-crashed - resources: - limits: - cpu: 3 - memory: 800Mi - requests: - cpu: 0.5 - memory: 500Mi - volumes: - - name: cache - path: /root/.cache - - name: droneshm - path: /dev/shm - environment: - CYPRESS_RECORD_TOKEN: - from_secret: cypress_record_token - CYPRESS_baseUrl: http://server/index.php/ - LOGIN: login - commands: - - cd /drone/src - - $(npm bin)/cypress run --record --key $CYPRESS_RECORD_TOKEN --parallel --ci-build-id ci-$DRONE_BUILD_NUMBER-master - - - name: testing 3 - image: cypress/browsers:chrome69 - depends_on: - - build - - wait-on-server - # avoid memory process crash - # https://docs.cypress.io/guides/references/error-messages.html#The-Chromium-Renderer-process-just-crashed - resources: - limits: - cpu: 3 - memory: 800Mi - requests: - cpu: 0.5 - memory: 500Mi - volumes: - - name: cache - path: /root/.cache - - name: droneshm - path: /dev/shm - environment: - CYPRESS_RECORD_TOKEN: - from_secret: cypress_record_token - CYPRESS_baseUrl: http://server/index.php/ - LOGIN: login - commands: - - cd /drone/src - - $(npm bin)/cypress run --record --key $CYPRESS_RECORD_TOKEN --parallel --ci-build-id ci-$DRONE_BUILD_NUMBER-master - - - name: testing 4 - image: cypress/browsers:chrome69 - depends_on: - - build - - wait-on-server - # avoid memory process crash - # https://docs.cypress.io/guides/references/error-messages.html#The-Chromium-Renderer-process-just-crashed - resources: - limits: - cpu: 3 - memory: 800Mi - requests: - cpu: 0.5 - memory: 500Mi - volumes: - - name: cache - path: /root/.cache - - name: droneshm - path: /dev/shm - environment: - CYPRESS_RECORD_TOKEN: - from_secret: cypress_record_token - CYPRESS_baseUrl: http://server/index.php/ - LOGIN: login - commands: - - cd /drone/src - - $(npm bin)/cypress run --record --key $CYPRESS_RECORD_TOKEN --parallel --ci-build-id ci-$DRONE_BUILD_NUMBER-master - -volumes: - - name: cache - temp: {} - - name: droneshm - temp: {} - -trigger: - branch: - - master - - stable* diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml new file mode 100644 index 000000000..3c6547783 --- /dev/null +++ b/.github/workflows/cypress.yml @@ -0,0 +1,83 @@ +name: Cypress + +on: + pull_request: + push: + branches: + - master + - stable* + +env: + APP_NAME: viewer + +jobs: + cypress: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # run 4 copies of the current job in parallel + containers: [1, 2, 3, 4] + node-versions: ['12.x'] + php-versions: ['7.4'] + + name: Runner ${{ matrix.containers }} + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + repository: nextcloud/server + ref: ${{ github.base_ref }} + + - name: Checkout submodules + shell: bash + run: | + auth_header="$(git config --local --get http.https://github.com/.extraheader)" + git submodule sync --recursive + git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 + + - name: Checkout app + uses: actions/checkout@v2 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up node ${{ matrix.node-versions }} + uses: actions/setup-node@v1 + with: + node-versions: ${{ matrix.node-versions }} + + - name: Install dependencies & build app + working-directory: apps/${{ env.APP_NAME }} + run: | + npm ci + npm run build --if-present + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite + coverage: none + + - name: Set up Nextcloud + run: | + mkdir data + ./occ maintenance:install --verbose --database sqlite --admin-user admin --admin-pass admin + ./occ app:enable ${{ env.APP_NAME }} + php -S localhost:8080 & + + - name: Cypress run + uses: cypress-io/github-action@v1 + with: + record: true + parallel: true + # cypress env + working-directory: apps/${{ env.APP_NAME }} + ci-build-id: ${{ github.sha }}-${{ github.run_number }} + # wait for server before running + wait-on: "http://localhost:8080" + env: + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + CYPRESS_baseUrl: http://localhost:8080/index.php