|
| 1 | +name: Cypress |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - stable* |
| 9 | + |
| 10 | +env: |
| 11 | + APP_NAME: viewer |
| 12 | + |
| 13 | +jobs: |
| 14 | + cypress: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + # run 4 copies of the current job in parallel |
| 21 | + containers: [1, 2, 3, 4] |
| 22 | + node-versions: ['12.x'] |
| 23 | + php-versions: ['7.4'] |
| 24 | + |
| 25 | + name: Runner ${{ matrix.containers }} |
| 26 | + steps: |
| 27 | + - name: Checkout server |
| 28 | + uses: actions/checkout@v2 |
| 29 | + with: |
| 30 | + repository: nextcloud/server |
| 31 | + ref: ${{ github.base_ref }} |
| 32 | + |
| 33 | + - name: Checkout submodules |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + auth_header="$(git config --local --get http.https://github.com/.extraheader)" |
| 37 | + git submodule sync --recursive |
| 38 | + git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 |
| 39 | +
|
| 40 | + - name: Checkout app |
| 41 | + uses: actions/checkout@v2 |
| 42 | + with: |
| 43 | + path: apps/${{ env.APP_NAME }} |
| 44 | + |
| 45 | + - name: Set up node ${{ matrix.node-versions }} |
| 46 | + uses: actions/setup-node@v1 |
| 47 | + with: |
| 48 | + node-versions: ${{ matrix.node-versions }} |
| 49 | + |
| 50 | + - name: Install dependencies & build app |
| 51 | + working-directory: apps/${{ env.APP_NAME }} |
| 52 | + run: | |
| 53 | + npm ci |
| 54 | + npm run build --if-present |
| 55 | +
|
| 56 | + - name: Set up php ${{ matrix.php-versions }} |
| 57 | + uses: shivammathur/setup-php@v1 |
| 58 | + with: |
| 59 | + php-version: ${{ matrix.php-versions }} |
| 60 | + tools: phpunit |
| 61 | + extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite |
| 62 | + coverage: none |
| 63 | + |
| 64 | + - name: Set up Nextcloud |
| 65 | + run: | |
| 66 | + mkdir data |
| 67 | + ./occ maintenance:install --verbose --database sqlite --admin-user admin --admin-pass admin |
| 68 | + ./occ app:enable ${{ env.APP_NAME }} |
| 69 | + php -S localhost:8080 & |
| 70 | +
|
| 71 | + - name: Cypress run |
| 72 | + uses: cypress-io/github-action@v1 |
| 73 | + with: |
| 74 | + record: true |
| 75 | + parallel: true |
| 76 | + # cypress env |
| 77 | + working-directory: apps/${{ env.APP_NAME }} |
| 78 | + ci-build-id: ${{ github.sha }}-${{ github.run_number }} |
| 79 | + # wait for server before running |
| 80 | + wait-on: "http://localhost:8080" |
| 81 | + env: |
| 82 | + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} |
| 83 | + CYPRESS_baseUrl: http://localhost:8080/index.php |
0 commit comments