top of page

Deploy with Confidence: CI/CD Integration with Cypress, Docker and Oracle APEX

  • Issac Weaver
  • Jul 7
  • 4 min read

Why Should I Implement a Pipeline?


Agile development can be a fast-paced environment; it is crucial that deployments are reliable and executed with confidence. Most steps of the deployment and testing process require manual work, which can often be overlooked or forgotten about, especially when it comes to large, complex Oracle APEX applications. 


Regression testing is often carried out after a deployment has already taken place. This presents a key issue; customers are blindly presented with a new version without confidence that nothing has changed between environments. While this may work for smaller projects, it quickly becomes difficult when dealing with complex, customer facing applications.


To combat this risk, automation should be introduced, allowing teams to validate any new application changes before the deployment process takes place.

This can be done by utilising GitLab CI/CD and Cypress automated tests. Regression tests can be run against an APEX app at any stage of development, presenting any regressed functionality to the developer in the form of screenshots and screen recordings.


Example CI/CD Workflow


Outlined below is what a typical workflow may look like once CI/CD has been successfully implemented:

  1. A developer makes changes to the application

  2. Changes are committed to a release branch

  3. A merge request is raised into main branch

  4. The pipeline is triggered in GitLab

  5. Cypress tests run against the application

  6. Test results are stored as artifacts

  7. If tests pass, the merge request can be approved and deployed

This process ensures that functionality is validated before any changes are approved for merging.


How GitLab Runs Pipelines


Pipelines are executed via runners. These are external machines that can perform the tasks set out in your .gitlab-ci.yml file.


GitLab provides a free monthly quota of shared runners, these are:

  • Pre-configured 

  • Managed by GitLab

  • Free to use as long as the monthly quota is not exceeded


Shared runners are ideal for small to medium projects, if your team is executing larger pipelines you may wish to provision your own self hosted runners for additional control and performance.


Building the Pipeline - Overview


The objective of this pipeline is simple:

Automatically run regression tests against an APEX application before any changes are proposed to the main branch.

Unlike other complex CI/CD setups, this minimal approach does not require the provisioning of a full Oracle environment on every run. This drastically reduces the time taken for the pipeline to run, which in turn lowers the project's contributions toward the monthly CI/CD allowance.


Instead, the pipeline connects directly to the existing APEX development environment where the application is already deployed, and attaches an up to date cypress docker image. This keeps the implementation significantly simpler while still providing all of the benefits of automated testing. Each of the GitLab jobs executes inside its own lightweight container, providing a clean and consistent environment for the tests to run on.


Requirements


This blog uses GitLab as a platform for the pipeline, however the same principles apply to other tools such as GitHub Actions and Jenkins.

Before building the pipeline, ensure the following tools are available:

  • Docker (required for execution environment, no installation required when using GitLab shared runners)

  • Node.js

  • Cypress

  • Oracle APEX application

  • GitLab + GitLab CI/CD


Setting Up Cypress


As a prerequisite, you must have already installed Cypress and written some of your own test suites. Some key areas to cover in these tests are:

  • Login and authentication

  • CRUD operations

  • Navigation and page rendering

  • Key business workflows


If you haven’t already done so, I would advise you to read RADAPEX’s previous blog posts on writing Cypress tests for APEX applications to learn more!


Setting Up the Pipeline


The pipeline itself is controlled through a single file; .gitlab-ci.yml

This file outlines the stages that will be run by the GitLab pipeline


Example .gitlab-ci.yml

Step 1. Outline the Stages of Your Pipeline

stages:  - build  - test

Step 2. Describe the Build Stage

The build stage installs the dependencies required for your Cypress tests to run.

build:  stage: build  image: node:20
  script:    - npm ci
  artifacts:    paths:      - node_modules/

npm ci, which stands for clean install, is recommended over npm install here as it utilises your package-lock.json file.  It ensures any dependencies that are used within your tests will be bundled into the install.

All dependencies installed from the package-lock.json can be stored as GitLab artifacts after the pipeline is terminated, meaning they will not need to be reinstalled on the next run (again, saving time which would contribute to GitLab’s monthly allowance). 


Step 2. Describe the Test Stage


cypress_tests:
  stage: test
  image: cypress/base:20.10.0

  script:
    - npx cypress run

  rules:
    # Use rules to configure when your pipeline runs 
    # Some examples of this are:

    # Run when committing from a specific branch
    - if: $CI_COMMIT_BRANCH == 'feature/my-cypress-branch'

    # Run when merging to master
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

  artifacts:
    when: always
    paths:
      - cypress/screenshots/**/*.png
      - cypress/videos/**/*.mp4

In this stage, GitLab runs the jobs inside the official Cypress Docker image with all required dependencies installed. 


Upon initiation, Cypress will:

  • Open the APEX app

  • Execute your pre-configured regression tests

  • Return the results back to GitLab


Failed tests will be flagged and prevent the merge request from proceeding. Screenshots and video footage captured during the tests can be downloaded as GitLab artifacts for further debugging and analysis.


Benefits of This Approach

Implementing this approach to your regression testing can provide several advantages, each of which ensure your deployment’s success. Taking advantage of automated tools strongly reinforces the validation of your application’s functionality, consistently applying the same imperative tests after every application change. To recap some of the points of this blog, an automated pipeline allows the following:

  • Automated regression testing

  • Near instant feedback on application changes

  • Reduced manual effort

  • Greater deployment confidence


Final Thoughts


Implementing CI/CD functionality for your Oracle APEX applications does not need to be overly complicated. A simple GitLab pipeline that automatically runs Cypress tests can improve confidence in your deployments significantly, and reduce the risk of releasing a broken version. As applications grow, this testing foundation can be expanded into more advanced pipelines, employing more techniques to ensure your deployment is truly robust.


 
 
bottom of page