Gitlab Pages: serve the test directory / upcoming branch

Hey dear community,

I use gitlab-pages (on gitlab.com) to serve a website for my students as a teacher.

As long as I work on parts of the pages I would like to commit the changes to an upcoming branch and merge to master, as soon as a section or new page is finished.

The CI for the master branch works really well and the output goes to public where the pages are served as expected.

However, everything in the upcoming branch is outputted to the test directory and I don’t know how I can access the pages there.

I looked here in the forum and in the docs but couldn’t find a hint.

Any help is welcome!
Samuel

PS: here is my gitlab-ci.yml

mkdocs-test:
  image: python:latest
  stage: test
  before_script:
   - pip install -r requirements.txt
  script:
  - mkdocs build --strict --verbose --site-dir test
  artifacts:
    paths:
    - test
  except:
  - master

mkdocs-deploy:
  image: python:latest
  stage: deploy
  before_script:
   - pip install -r requirements.txt
  script:
  - mkdocs build --strict --verbose
  artifacts:
    paths:
    - public
  only:
  - master

From what I understood in the documentation, public is a “magic folder” from pages point of view. if you want to have a substructure you have to build it inside the public folder, not in a separate one.

Okay, what I understand I could have somehing like:

mkdocs-test:
  image: python:latest
  stage: test
  before_script:
   - pip install -r requirements.txt
  script:
  - mkdocs build --strict --verbose --site-dir test
  artifacts:
    paths:
    - public/test
  except:
  - master

Or would that erase the contents of public except the test-directory?

This would be down to how the pages deamon grabs the stuff, but I guess a short try will answer that question.
Also you will probably need to use the following pathes insetad of your suggestion:

 script:
  - mkdocs build --strict --verbose --site-dir public/test
...
    paths:
    - public

Thanks for your help.

I tried:

script:
  - mkdocs build --strict --verbose --site-dir public/test
...
    paths:
    - public

As well as:

script:
  - mkdocs build --strict --verbose --site-dir test
...
    paths:
    - public/test

Fortunately the main site remains, but under /test I always get a 404 error…
Do you have an idea?