From 3c9d2e09a7dfa178196bb02ff203424deaa527b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 3 May 2024 08:42:31 +0200 Subject: [PATCH] chore: Use postgres for cypress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .github/workflows/cypress.yml | 41 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 1be659882..7d6192df8 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -14,7 +14,7 @@ env: jobs: cypress: - runs-on: ubuntu-latest + runs-on: ['ubuntu-latest', 'self-hosted'] strategy: fail-fast: false @@ -22,9 +22,19 @@ jobs: node-version: [20.x] # containers: [1, 2, 3] php-versions: [ '8.1' ] - databases: [ 'sqlite' ] server-versions: [ 'master' ] + services: + postgres: + image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest + ports: + - 4444:5432/tcp + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: rootpassword + POSTGRES_DB: nextcloud + options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 + steps: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4.0.2 @@ -76,9 +86,9 @@ jobs: PHP_CLI_SERVER_WORKERS: 10 run: | mkdir data - php occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin - php occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu" - php occ config:system:set debug --value=true --type=boolean + echo '"\OC\Memcache\APCu","hashing_default_password"=>true];' > config/config.php + php occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin + php occ background:cron php -f index.php php -S 0.0.0.0:8081 & export OC_PASS=1234561 @@ -90,20 +100,19 @@ jobs: composer install --no-dev npm ci npm run build - cd ../../ curl -v http://localhost:8081/index.php/login - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - record: false - parallel: false - wait-on: '${{ env.CYPRESS_baseUrl }}' - working-directory: 'apps/${{ env.APP_NAME }}' - config: defaultCommandTimeout=10000,video=false + - name: Run E2E cypress tests + run: | + cd 'apps/${{ env.APP_NAME }}' + npx wait-on $CYPRESS_baseUrl + npx cypress run --record false --config defaultCommandTimeout=10000,video=false env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - npm_package_name: ${{ env.APP_NAME }} + # https://github.com/cypress-io/github-action/issues/124 + COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} + COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }} + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + npm_package_name: ${{ env.APP_NAME }} - name: Upload test failure screenshots uses: actions/upload-artifact@v4