File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8484
8585 name : runner ${{ matrix.containers }}
8686
87+ services :
88+ nextcloud :
89+ image : ghcr.io/nextcloud/continuous-integration-shallow-server
90+ options : --name nextcloud
91+ ports :
92+ - 80:80
93+
8794 steps :
8895 - name : Restore context
8996 uses : buildjet/cache/restore@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
@@ -104,11 +111,10 @@ jobs:
104111 uses : cypress-io/github-action@ebe8b24c4428922d0f793a5c4c96853a633180e3 # v6.6.0
105112 with :
106113 component : ${{ matrix.containers == 'component' }}
107- group : ${{ matrix.use-cypress-cloud && matrix.containers == 'component' && 'Run component' || matrix.use-cypress-cloud && 'Run E2E' || '' }}
108- # cypress env
109- ci-build-id : ${{ matrix.use-cypress-cloud && format('{0}-{1}', github.sha, github.run_number) || '' }}
110- tag : ${{ matrix.use-cypress-cloud && github.event_name || '' }}
111114 env :
115+ # Use github service for server
116+ NEXTCLOUD_HOST : localhost
117+ NEXTCLOUD_CONTAINER : nextcloud
112118 # Needs to be prefixed with CYPRESS_
113119 CYPRESS_BRANCH : ${{ env.BRANCH }}
114120 # https://github.com/cypress-io/github-action/issues/124
Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ export default defineConfig({
8585 config . baseUrl = `http://${ ip } /index.php`
8686 await waitOnNextcloud ( ip )
8787 await configureNextcloud ( )
88- await applyChangesToNextcloud ( )
88+ await applyChangesToNextcloud ( ) ;
89+
90+ ( config as any ) . NEXTCLOUD_CONTAINER = process . env . NEXTCLOUD_CONTAINER ?? 'nextcloud-cypress-tests-server'
8991
9092 // IMPORTANT: return the config otherwise cypress-split will not work
9193 return config
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ import { execSync } from 'child_process'
3030
3131export const docker = new Docker ( )
3232
33- const CONTAINER_NAME = 'nextcloud-cypress-tests-server'
33+ const CONTAINER_NAME = process . env . NEXTCLOUD_CONTAINER ?? 'nextcloud-cypress-tests-server'
3434const SERVER_IMAGE = 'ghcr.io/nextcloud/continuous-integration-shallow-server'
3535
3636/**
@@ -39,6 +39,10 @@ const SERVER_IMAGE = 'ghcr.io/nextcloud/continuous-integration-shallow-server'
3939 * @param {string } branch the branch of your current work
4040 */
4141export const startNextcloud = async function ( branch : string = getCurrentGitBranch ( ) ) : Promise < any > {
42+ if ( process . env . NEXTCLOUD_HOST ) {
43+ console . log ( '\nRunning on CI skipping pulling images' )
44+ return process . env . NEXTCLOUD_HOST
45+ }
4246
4347 try {
4448 try {
@@ -204,6 +208,11 @@ export const stopNextcloud = async function() {
204208export const getContainerIP = async function (
205209 container = docker . getContainer ( CONTAINER_NAME ) ,
206210) : Promise < string > {
211+
212+ if ( process . env . NEXTCLOUD_HOST ) {
213+ return process . env . NEXTCLOUD_HOST
214+ }
215+
207216 let ip = ''
208217 let tries = 0
209218 while ( ip === '' && tries < 10 ) {
Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ Cypress.Commands.add('resetUserTheming', (user?: User) => {
287287} )
288288
289289Cypress . Commands . add ( 'runOccCommand' , ( command : string , options ?: Partial < Cypress . ExecOptions > ) => {
290+ const container = ( Cypress . config ( ) as unknown as Record < string , string > ) . NEXTCLOUD_CONTAINER
290291 const env = Object . entries ( options ?. env ?? { } ) . map ( ( [ name , value ] ) => `-e '${ name } =${ value } '` ) . join ( ' ' )
291- return cy . exec ( `docker exec --user www-data ${ env } nextcloud-cypress-tests-server php ./occ ${ command } ` , options )
292+ return cy . exec ( `docker exec --user www-data ${ env } ${ container } php ./occ ${ command } ` , options )
292293} )
You can’t perform that action at this time.
0 commit comments