Back to articles
Ship Safer Code: The GitHub Actions Patterns That Actually Matter
How-ToTools

Ship Safer Code: The GitHub Actions Patterns That Actually Matter

via Dev.toprabhu ponnambalam

The Problem With Most CI Guides You search "GitHub Actions unit tests", find a guide, copy the YAML, and it works — until: A docs-only PR triggers a 20-minute build Tests pass in CI but crash in production One flaky test fails randomly and blocks your whole team These are real problems. Here's how to solve them. 1. Path Filtering — Skip Builds When Nothing Changed - name : Detect changes id : changes uses : dorny/paths-filter@v3 with : filters : | code: - '**/*.cpp' - '**/*.h' - '**/*.hpp' - '**/CMakeLists.txt' - name : Run Tests if : steps.changes.outputs.code == 'true' run : make run-tests Real impact: A typo fix in README.md used to burn 20 minutes of runner time. Now it passes in under 5 seconds. 2. Build and Test Inside Docker Runner environment drift is the silent killer of reproducibility. The Ubuntu version changes, a system library gets updated, and suddenly your green CI is red for no reason you can explain. - name : Build Docker image with tests enabled run : | docker build

Continue reading on Dev.to

Opens in a new tab

Read Full Article
3 views

Related Articles