Chapter 22Lesson 03~235 minutes

CI/CD Integration with GitHub Actions, GitLab CI, and Jenkins: Configuration, Design Patterns, and Trade-Offs

CI design is a set of explicit trade-offs, not a collection of provider tricks. Browser location, matrix breadth, failure collection, cache boundaries, runner ownership, and gate policy each affect portability, diagnostics, cost/capacity, security, and feedback time differently.

Runner vs GridSmoke vs broad matrixCachingGate policySelf-hosted

Learning objectives

  • Choose between a browser installed on the runner and a remote/container Grid.
  • Separate per-change smoke coverage from scheduled broad compatibility coverage.
  • Use fail-fast and evidence collection deliberately rather than as opposing slogans.
  • Cache dependencies without reusing dirty browser profiles/session state.
  • Select blocking versus exploratory gates using failure semantics and ownership.

1. Browser on the runner versus Grid/service infrastructure

The following table organizes the key choices and evidence for Browser on the runner versus Grid/service infrastructure. Use it together with the surrounding prose so the rows serve as a comparison aid rather than standalone rules.

Choice Strength Cost/risk Best fit
Runner browser Few moving parts; loopback AUT is simple; excellent beginner path Runner image browser versions float; one VM limits capacity Small smoke suite, public-repo GitHub-hosted CI
Local/CI Grid service Explicit browser infrastructure; scalable slots; browser/runtime separated from test job Networking and readiness are more complex; Grid consumes resources Multiple browsers/sessions; reusable private CI infrastructure
Hosted browser cloud Large browser/OS catalog and managed capacity Cost, credentials, network/privacy boundary, vendor API Optional enterprise compatibility extension

2. Per-change smoke matrix versus scheduled broad matrix

A pull request benefits from fast evidence on the highest-risk browser lanes. A nightly or scheduled workflow can exercise more browsers, viewports, locales, or shards. Do not multiply dimensions mechanically: browser × OS × locale × viewport × shard can explode job count without increasing decision quality proportionally.

Pipeline Example scope Purpose Gate
PR/push smoke Chrome + Firefox; one critical flow Fast regression signal Blocking
Scheduled compatibility Additional browser/OS/locale lanes Broader support evidence Blocking or separately owned
Exploratory/BiDi diagnostic Feature-capability lane Observe evolving browser behavior Nonblocking with explicit owner/expiry

3. Fail-fast versus complete evidence collection

Fail-fast can save expensive capacity when one prerequisite failure makes every sibling meaningless—for example, dependency installation is broken globally. For a two-browser matrix, cancelling Firefox because Chrome found a browser-specific regression destroys useful comparison evidence. Prefer matrix fail-fast: false when each lane can teach you something independently, while still letting each lane’s test command fail normally.

4. Hosted versus self-hosted runners

Hosted runners offer disposable VM isolation and low maintenance. Self-hosted runners give control over browser versions, private network access, certificates, and hardware, but they create patching, secret, persistence, and concurrency obligations. A self-hosted browser runner should be treated like production infrastructure: least-privilege identity, clean workspaces, controlled browser/profile state, monitored capacity, and current runner software.

Do not make a personal workstation the CI browser farm

Personal profiles, saved credentials, local downloads, and interactive user processes violate the isolation/privacy contract. Use dedicated runner hosts or disposable agents.

5. Cache dependencies, not mutable browser state

Pip caches can shorten dependency download time while the pinned requirements still define the environment. A cache is not a lockfile and should not hide version drift. Do not cache user-data directories, cookies, downloaded application files, or WebDriver session state across jobs. Those are test state and should start clean.

- uses: actions/setup-python@v7
  with:
    python-version: '3.13'
    cache: pip
- run: python -m pip install -r requirements.txt
# Do not cache Chrome/Firefox user profiles created by tests.

6. Mandatory gate versus nonblocking exploratory suite

A blocking gate needs stable ownership, deterministic data, bounded runtime, meaningful failure semantics, and an agreed browser support contract. An exploratory lane can surface a new browser/BiDi combination before it is reliable enough to block delivery, but “nonblocking” must not become “ignored forever.” Give it an owner, review threshold, and promotion/retirement rule.

7. Worked decision: 8-minute PR budget, two critical browsers, nightly localization

Use Chrome and Firefox smoke lanes per pull request with fail-fast: false and artifact retention on both. Keep four additional locale/viewport combinations in a scheduled workflow. If the smoke lanes regularly exceed eight minutes because both create heavyweight Grid clusters, move the browser capacity to a pre-provisioned private Grid or reduce startup overhead—not by dropping assertions or reusing dirty sessions.

8. Keep platform syntax subordinate to portable test design

GitHub cache keys, GitLab runner tags, and Jenkins agent labels are CI concerns. Browser options belong to Selenium configuration. Base URL and synthetic identity belong to environment/test configuration. Grid endpoint belongs to infrastructure configuration. A maintainable repository can change CI providers without rewriting page objects or business assertions.

Knowledge check

When is a runner-installed browser preferable to a Grid service?

Why should browser profiles not be cached across CI jobs?

What does a nonblocking exploratory lane still require?

Why can a full Cartesian CI matrix be poor engineering?

Which layer should decide the AUT base URL?

Next lesson

CI/CD Integration with GitHub Actions, GitLab CI, and Jenkins: Diagnostics, Failure Modes, and Production Practices

Continue with CI/CD Integration with GitHub Actions, GitLab CI, and Jenkins: Diagnostics, Failure Modes, and Production Practices. It builds directly on the state, evidence, and operating assumptions established here, so carry those constraints forward rather than treating the next page as an isolated topic.

Official references and current-version notes

Version baseline — August 2026

The mandatory examples pin Selenium Python to 4.47.0. The complete GitHub Actions example uses current major action lines actions/checkout@v7, actions/setup-python@v7, and actions/upload-artifact@v7. Hosted runner browser packages are deliberately not pinned here because runner images update; every run records the actual browser and returned WebDriver capabilities.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.