CI with GitHub Actions: Run UI + API on Every Push
A framework nobody runs is dead code. CI fixes that — it runs your tests automatically on every push, so problems show up in minutes instead of sprints.
The idea, in one line
CI is a robot that runs your test suites for you every time code changes. With GitHub Actions you describe that robot in a YAML file under .github/workflows/.
The words to know
- on — the trigger. When should this run?
push,pull_request. - jobs — units of work. They run in parallel by default; each picks a machine with runs-on.
- steps — run in order inside a job. uses pulls in a prebuilt action (like checkout); run executes a shell command.
- with — passes inputs to an action.
- needs — makes one job wait for another. Use it only when there's a real dependency.
▸ try it
name: tests
on:
push:
pull_request:
jobs:
api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -r requirements.txt
- run: pytest tests/api --alluredir=allure-results
- uses: actions/upload-artifact@v4
if: always() # upload even when tests fail
with:
name: allure-api
path: allure-results
ui:
runs-on: ubuntu-latest
strategy:
matrix:
browser: [chromium, firefox] # fan out across browsers
steps:
- uses: actions/checkout@v4
- run: pytest tests/ui --browser=${{ matrix.browser }}Read it top to bottom: two jobs, api and ui, run side by side. The api job installs Python, runs the API tests, and saves the report. The ui job runs its tests once per browser.
Advanced — two touches that mark a senior
- Split UI and API into separate jobs so they run at the same time, and a UI failure doesn't hide an API failure.
- Always publish results as artifacts with
actions/upload-artifact, and setif: always()so reports upload even when tests fail. A failed run with no logs tells you nothing. - Use a matrix to fan one job across versions or browsers — one file becomes a full cross-environment grid.
Grounded in the official GitHub Actions workflow-syntax docs and the actions/upload-artifact README
All lessons in Framework Architecture & CI/CD
- Designing a Framework from Scratch: The Layers
- The Four Patterns SDETs Actually Use
- Test Data: Fixtures vs Factories vs Seeding
- CI with GitHub Actions: Run UI + API on Every Push
- Docker & Selenium Grid: Reproducible Test Environments
- Parallel, Retries & Flaky-Test Quarantine